| container.hpp | | container.hpp | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 49 | |
| * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| */ | | */ | |
| | | | |
| #ifndef GCN_CONTAINER_HPP | | #ifndef GCN_CONTAINER_HPP | |
| #define GCN_CONTAINER_HPP | | #define GCN_CONTAINER_HPP | |
| | | | |
| #include <list> | | #include <list> | |
| | | | |
|
| #include "guichan/basiccontainer.hpp" | | #include "guichan/containerlistener.hpp" | |
| #include "guichan/graphics.hpp" | | #include "guichan/graphics.hpp" | |
| #include "guichan/platform.hpp" | | #include "guichan/platform.hpp" | |
|
| | | #include "guichan/widget.hpp" | |
| | | | |
| namespace gcn | | namespace gcn | |
| { | | { | |
| /** | | /** | |
| * An implementation of a container able to contain other widgets. A wi
dget's | | * An implementation of a container able to contain other widgets. A wi
dget's | |
| * position in the container is relative to the container itself and no
t the screen. | | * position in the container is relative to the container itself and no
t the screen. | |
| * A container is the most common widget to use as the Gui's top widget
as makes the Gui | | * A container is the most common widget to use as the Gui's top widget
as makes the Gui | |
| * able to contain more than one widget. | | * able to contain more than one widget. | |
| * | | * | |
| * @see Gui::setTop | | * @see Gui::setTop | |
| */ | | */ | |
|
| class GCN_CORE_DECLSPEC Container: public BasicContainer | | class GCN_CORE_DECLSPEC Container: public Widget | |
| { | | { | |
| public: | | public: | |
| | | | |
| /** | | /** | |
| * Constructor. A container is opauqe as default, if you want a | | * Constructor. A container is opauqe as default, if you want a | |
| * none opaque container call setQpaque(false). | | * none opaque container call setQpaque(false). | |
| * | | * | |
| * @see setOpaque, isOpaque | | * @see setOpaque, isOpaque | |
| */ | | */ | |
| Container(); | | Container(); | |
| | | | |
| skipping to change at line 149 | | skipping to change at line 150 | |
| /** | | /** | |
| * Finds a widget given an id. | | * Finds a widget given an id. | |
| * | | * | |
| * @param id The id to find a widget by. | | * @param id The id to find a widget by. | |
| * @return A widget with a corrosponding id, NULL if no widget | | * @return A widget with a corrosponding id, NULL if no widget | |
| * is found. | | * is found. | |
| * @see Widget::setId | | * @see Widget::setId | |
| */ | | */ | |
| virtual Widget* findWidgetById(const std::string &id); | | virtual Widget* findWidgetById(const std::string &id); | |
| | | | |
|
| | | /** | |
| | | * Adds a container listener to the container. When a widget is | |
| | | * added or removed an event will be sent to all container | |
| | | * listeners of the container | |
| | | * | |
| | | * @param containerListener The container listener to add. | |
| | | * @since 0.9.0 | |
| | | */ | |
| | | void addContainerListener(ContainerListener* containerListener); | |
| | | | |
| | | /** | |
| | | * Removes a container listener from the container. | |
| | | * | |
| | | * @param containerListener The container listener to remove. | |
| | | * @since 0.9.0 | |
| | | */ | |
| | | void removeContainerListener(ContainerListener* containerListener); | |
| | | | |
| | | /** | |
| | | * Returns the children of the container. | |
| | | * | |
| | | * @return The children of the container. | |
| | | */ | |
| | | const std::list<Widget*>& getChildren() const; | |
| | | | |
| | | /** | |
| | | * Resizes the Container's size to fit te content exactly. | |
| | | */ | |
| | | void resizeToContent(); | |
| | | | |
| // Inherited from Widget | | // Inherited from Widget | |
| | | | |
| virtual void draw(Graphics* graphics); | | virtual void draw(Graphics* graphics); | |
| | | | |
|
| | | virtual Rectangle getChildrenArea(); | |
| | | | |
| protected: | | protected: | |
| /** | | /** | |
|
| | | * Distributes a widget added container event to all container list | |
| | | eners | |
| | | * of the container. | |
| | | * | |
| | | * @param source The source widget of the event. | |
| | | * @since 0.9.0 | |
| | | */ | |
| | | void distributeWidgetAddedEvent(Widget* source); | |
| | | | |
| | | /** | |
| | | * Distributes a widget removed container event to all container li | |
| | | steners | |
| | | * of the container. | |
| | | * | |
| | | * @param source The source widget of the event. | |
| | | * @since 0.9.0 | |
| | | */ | |
| | | void distributeWidgetRemovedEvent(Widget* source); | |
| | | | |
| | | /** | |
| * True if the container is opaque, false otherwise. | | * True if the container is opaque, false otherwise. | |
| */ | | */ | |
| bool mOpaque; | | bool mOpaque; | |
|
| | | | |
| | | /** | |
| | | * Typdef. | |
| | | */ | |
| | | typedef std::list<ContainerListener*> ContainerListenerList; | |
| | | | |
| | | /** | |
| | | * The container listeners of the container. | |
| | | */ | |
| | | ContainerListenerList mContainerListeners; | |
| | | | |
| | | /** | |
| | | * Typedef. | |
| | | */ | |
| | | typedef ContainerListenerList::iterator ContainerListenerIterator; | |
| }; | | }; | |
| } | | } | |
| | | | |
| #endif // end GCN_CONTAINER_HPP | | #endif // end GCN_CONTAINER_HPP | |
| | | | |
End of changes. 7 change blocks. |
| 2 lines changed or deleted | | 70 lines changed or added | |
|
| dropdown.hpp | | dropdown.hpp | |
| | | | |
| skipping to change at line 48 | | skipping to change at line 48 | |
| * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| */ | | */ | |
| | | | |
| #ifndef GCN_DROPDOWN_HPP | | #ifndef GCN_DROPDOWN_HPP | |
| #define GCN_DROPDOWN_HPP | | #define GCN_DROPDOWN_HPP | |
| | | | |
| #include "guichan/actionlistener.hpp" | | #include "guichan/actionlistener.hpp" | |
|
| #include "guichan/basiccontainer.hpp" | | | |
| #include "guichan/deathlistener.hpp" | | | |
| #include "guichan/focushandler.hpp" | | #include "guichan/focushandler.hpp" | |
| #include "guichan/focuslistener.hpp" | | #include "guichan/focuslistener.hpp" | |
| #include "guichan/keylistener.hpp" | | #include "guichan/keylistener.hpp" | |
|
| #include "guichan/listmodel.hpp" | | | |
| #include "guichan/mouselistener.hpp" | | #include "guichan/mouselistener.hpp" | |
| #include "guichan/platform.hpp" | | #include "guichan/platform.hpp" | |
| #include "guichan/selectionlistener.hpp" | | #include "guichan/selectionlistener.hpp" | |
|
| #include "guichan/widgets/listbox.hpp" | | #include "guichan/widget.hpp" | |
| #include "guichan/widgets/scrollarea.hpp" | | | |
| | | namespace gcn | |
| | | { | |
| | | class ListBox; | |
| | | class ListModel; | |
| | | class ScrollArea; | |
| | | | |
|
| namespace gcn { | | | |
| /** | | /** | |
| * An implementation of a drop downable list from which an item can be | | * An implementation of a drop downable list from which an item can be | |
| * selected. The drop down consists of an internal ScrollArea and an | | * selected. The drop down consists of an internal ScrollArea and an | |
| * internal ListBox. The drop down also uses an internal FocusHandler t
o | | * internal ListBox. The drop down also uses an internal FocusHandler t
o | |
| * handle the focus of the internal ScollArea and the internal ListBox.
The | | * handle the focus of the internal ScollArea and the internal ListBox.
The | |
| * scroll area and the list box can be passed to the drop down if a cus
tom | | * scroll area and the list box can be passed to the drop down if a cus
tom | |
| * scroll area and or a custom list box is preferable. | | * scroll area and or a custom list box is preferable. | |
| * | | * | |
| * To be able display a list the drop down uses a user provided list mo
del. | | * To be able display a list the drop down uses a user provided list mo
del. | |
| * A list model can be any class that implements the ListModel interfac
e. | | * A list model can be any class that implements the ListModel interfac
e. | |
| * | | * | |
| * If an item is selected in the drop down a select event will be sent
to | | * If an item is selected in the drop down a select event will be sent
to | |
| * all selection listeners of the drop down. If an item is selected by | | * all selection listeners of the drop down. If an item is selected by | |
| * using a mouse click or by using the enter or space key an action eve
nt | | * using a mouse click or by using the enter or space key an action eve
nt | |
| * will be sent to all action listeners of the drop down. | | * will be sent to all action listeners of the drop down. | |
| */ | | */ | |
| class GCN_CORE_DECLSPEC DropDown : | | class GCN_CORE_DECLSPEC DropDown : | |
| public ActionListener, | | public ActionListener, | |
|
| public BasicContainer, | | | |
| public KeyListener, | | public KeyListener, | |
| public MouseListener, | | public MouseListener, | |
| public FocusListener, | | public FocusListener, | |
|
| public SelectionListener | | public SelectionListener, | |
| | | public Widget | |
| { | | { | |
| public: | | public: | |
| /** | | /** | |
| * Contructor. | | * Contructor. | |
| * | | * | |
| * @param listModel the ListModel to use. | | * @param listModel the ListModel to use. | |
| * @param scrollArea the ScrollArea to use. | | * @param scrollArea the ScrollArea to use. | |
| * @param listBox the listBox to use. | | * @param listBox the listBox to use. | |
| * @see ListModel, ScrollArea, ListBox. | | * @see ListModel, ScrollArea, ListBox. | |
| */ | | */ | |
| | | | |
| skipping to change at line 134 | | skipping to change at line 135 | |
| * @see getListModel | | * @see getListModel | |
| */ | | */ | |
| void setListModel(ListModel *listModel); | | void setListModel(ListModel *listModel); | |
| | | | |
| /** | | /** | |
| * Gets the list model used. | | * Gets the list model used. | |
| * | | * | |
| * @return the ListModel used. | | * @return the ListModel used. | |
| * @see setListModel | | * @see setListModel | |
| */ | | */ | |
|
| ListModel *getListModel(); | | ListModel *getListModel() const; | |
| | | | |
| /** | | /** | |
| * Adjusts the height of the drop down to fit the height of the | | * Adjusts the height of the drop down to fit the height of the | |
| * drop down's parent's height. It's used to not make the drop down | | * drop down's parent's height. It's used to not make the drop down | |
| * draw itself outside of it's parent if folded down. | | * draw itself outside of it's parent if folded down. | |
| */ | | */ | |
| void adjustHeight(); | | void adjustHeight(); | |
| | | | |
| /** | | /** | |
| * Adds a selection listener to the drop down. When the selection | | * Adds a selection listener to the drop down. When the selection | |
| | | | |
End of changes. 7 change blocks. |
| 9 lines changed or deleted | | 10 lines changed or added | |
|
| graphics.hpp | | graphics.hpp | |
| | | | |
| skipping to change at line 102 | | skipping to change at line 102 | |
| * @since 0.1.0 | | * @since 0.1.0 | |
| */ | | */ | |
| class GCN_CORE_DECLSPEC Graphics | | class GCN_CORE_DECLSPEC Graphics | |
| { | | { | |
| public: | | public: | |
| /** | | /** | |
| * Alignments for text drawing. | | * Alignments for text drawing. | |
| */ | | */ | |
| enum Alignment | | enum Alignment | |
| { | | { | |
|
| LEFT = 0, | | Left = 0, | |
| CENTER, | | Center, | |
| RIGHT | | Right | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Constructor. | | * Constructor. | |
| */ | | */ | |
| Graphics(); | | Graphics(); | |
| | | | |
| /** | | /** | |
| * Destructor. | | * Destructor. | |
| */ | | */ | |
| | | | |
| skipping to change at line 228 | | skipping to change at line 228 | |
| * Ddraws a line. | | * Ddraws a line. | |
| * | | * | |
| * @param x1 The first x coordinate. | | * @param x1 The first x coordinate. | |
| * @param y1 The first y coordinate. | | * @param y1 The first y coordinate. | |
| * @param x2 The second x coordinate. | | * @param x2 The second x coordinate. | |
| * @param y2 The second y coordinate. | | * @param y2 The second y coordinate. | |
| */ | | */ | |
| virtual void drawLine(int x1, int y1, int x2, int y2) = 0; | | virtual void drawLine(int x1, int y1, int x2, int y2) = 0; | |
| | | | |
| /** | | /** | |
|
| * Draws a simple, non-filled, rectangle with a one pixel width. | | * Draws a simple, non-filled rectangle with a one pixel width. | |
| * | | * | |
| * @param rectangle The rectangle to draw. | | * @param rectangle The rectangle to draw. | |
| */ | | */ | |
| virtual void drawRectangle(const Rectangle& rectangle) = 0; | | virtual void drawRectangle(const Rectangle& rectangle) = 0; | |
| | | | |
| /** | | /** | |
|
| | | * Draws a simple, non-filled rectangle with a one pixel width. | |
| | | * | |
| | | * This is an overload provided for convenience. | |
| | | * | |
| | | * @param x The x coordinate of the rectangle | |
| | | * @param y The y coordinate of the rectangle | |
| | | * @param width The width of the rectangle | |
| | | * @param height The height of the rectangle | |
| | | * | |
| | | * @since 0.9.0 | |
| | | */ | |
| | | inline void drawRectangle(int x, int y, int width, int height) | |
| | | { drawRectangle(Rectangle(x, y, width, height)); } | |
| | | | |
| | | /** | |
| * Draws a filled rectangle. | | * Draws a filled rectangle. | |
| * | | * | |
| * @param rectangle The filled rectangle to draw. | | * @param rectangle The filled rectangle to draw. | |
| */ | | */ | |
| virtual void fillRectangle(const Rectangle& rectangle) = 0; | | virtual void fillRectangle(const Rectangle& rectangle) = 0; | |
| | | | |
| /** | | /** | |
|
| | | * Draws a filled rectangle. | |
| | | * | |
| | | * This is an overload provided for convenience. | |
| | | * | |
| | | * @param x The x coordinate of the rectangle | |
| | | * @param y The y coordinate of the rectangle | |
| | | * @param width The width of the rectangle | |
| | | * @param height The height of the rectangle | |
| | | * | |
| | | * @since 0.9.0 | |
| | | */ | |
| | | inline void fillRectangle(int x, int y, int width, int height) | |
| | | { fillRectangle(Rectangle(x, y, width, height)); } | |
| | | | |
| | | /** | |
| * Sets the color to use when drawing. | | * Sets the color to use when drawing. | |
| * | | * | |
| * @param color A color. | | * @param color A color. | |
| * @see getColor | | * @see getColor | |
| */ | | */ | |
| virtual void setColor(const Color& color) = 0; | | virtual void setColor(const Color& color) = 0; | |
| | | | |
| /** | | /** | |
| * Gets the color to use when drawing. | | * Gets the color to use when drawing. | |
| * | | * | |
| | | | |
| skipping to change at line 276 | | skipping to change at line 306 | |
| * | | * | |
| * @param text The text to draw. | | * @param text The text to draw. | |
| * @param x The x coordinate where to draw the text. | | * @param x The x coordinate where to draw the text. | |
| * @param y The y coordinate where to draw the text. | | * @param y The y coordinate where to draw the text. | |
| * @param alignment The alignemnt to use when drawing. | | * @param alignment The alignemnt to use when drawing. | |
| * @throws Exception when no font has been set. | | * @throws Exception when no font has been set. | |
| */ | | */ | |
| virtual void drawText(const std::string& text, | | virtual void drawText(const std::string& text, | |
| int x, | | int x, | |
| int y, | | int y, | |
|
| Alignment alignment = LEFT); | | Alignment alignment = Left); | |
| | | | |
| protected: | | protected: | |
| /** | | /** | |
| * Holds the clip area stack. | | * Holds the clip area stack. | |
| */ | | */ | |
| std::stack<ClipRectangle> mClipStack; | | std::stack<ClipRectangle> mClipStack; | |
| | | | |
| /** | | /** | |
| * Holds the current font. | | * Holds the current font. | |
| */ | | */ | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 35 lines changed or added | |
|
| tabbedarea.hpp | | tabbedarea.hpp | |
| | | | |
| skipping to change at line 52 | | skipping to change at line 52 | |
| */ | | */ | |
| | | | |
| #ifndef GCN_TABBEDAREA_HPP | | #ifndef GCN_TABBEDAREA_HPP | |
| #define GCN_TABBEDAREA_HPP | | #define GCN_TABBEDAREA_HPP | |
| | | | |
| #include <map> | | #include <map> | |
| #include <string> | | #include <string> | |
| #include <vector> | | #include <vector> | |
| | | | |
| #include "guichan/actionlistener.hpp" | | #include "guichan/actionlistener.hpp" | |
|
| #include "guichan/basiccontainer.hpp" | | | |
| #include "guichan/keylistener.hpp" | | #include "guichan/keylistener.hpp" | |
| #include "guichan/mouselistener.hpp" | | #include "guichan/mouselistener.hpp" | |
| #include "guichan/platform.hpp" | | #include "guichan/platform.hpp" | |
|
| | | #include "guichan/widget.hpp" | |
| | | | |
| namespace gcn | | namespace gcn | |
| { | | { | |
| class Container; | | class Container; | |
| class Tab; | | class Tab; | |
| | | | |
| /** | | /** | |
| * An implementation of a tabbed area where a user can display a widget
by | | * An implementation of a tabbed area where a user can display a widget
by | |
| * selecting a tab. | | * selecting a tab. | |
| * | | * | |
| * @since 0.8.0 | | * @since 0.8.0 | |
| */ | | */ | |
| class GCN_CORE_DECLSPEC TabbedArea: | | class GCN_CORE_DECLSPEC TabbedArea: | |
| public ActionListener, | | public ActionListener, | |
|
| public BasicContainer, | | | |
| public KeyListener, | | public KeyListener, | |
|
| public MouseListener | | public MouseListener, | |
| | | public Widget | |
| { | | { | |
| friend class Tab; | | friend class Tab; | |
| | | | |
| public: | | public: | |
| /** | | /** | |
| * Constructor. | | * Constructor. | |
| */ | | */ | |
| TabbedArea(); | | TabbedArea(); | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 148 | | skipping to change at line 148 | |
| | | | |
| /** | | /** | |
| * Removes a tab from the tabbed area. | | * Removes a tab from the tabbed area. | |
| * | | * | |
| * @param index The tab to remove. | | * @param index The tab to remove. | |
| * @see addTab | | * @see addTab | |
| */ | | */ | |
| virtual void removeTab(Tab* tab); | | virtual void removeTab(Tab* tab); | |
| | | | |
| /** | | /** | |
|
| | | * Returns the number of tabs in this tabbed area. | |
| | | * | |
| | | * @since 0.9.0 | |
| | | */ | |
| | | int getNumberOfTabs() const; | |
| | | | |
| | | /** | |
| * Checks if a tab given an index is selected or not. | | * Checks if a tab given an index is selected or not. | |
| * | | * | |
| * @param index The index of the tab to check. | | * @param index The index of the tab to check. | |
| * @return True if the tab is selected, false otherwise. | | * @return True if the tab is selected, false otherwise. | |
| * @see setSelectedTab | | * @see setSelectedTab | |
| */ | | */ | |
| virtual bool isTabSelected(unsigned int index) const; | | virtual bool isTabSelected(unsigned int index) const; | |
| | | | |
| /** | | /** | |
| * Checks if a tab is selected or not. | | * Checks if a tab is selected or not. | |
| * | | * | |
| * @param index The tab to check. | | * @param index The tab to check. | |
| * @return True if the tab is selected, false otherwise. | | * @return True if the tab is selected, false otherwise. | |
| * @see setSelectedTab | | * @see setSelectedTab | |
| */ | | */ | |
|
| virtual bool isTabSelected(Tab* tab); | | virtual bool isTabSelected(Tab* tab) const; | |
| | | | |
| /** | | /** | |
| * Sets a tab given an index to be selected. | | * Sets a tab given an index to be selected. | |
| * | | * | |
| * @param index The index of the tab to be selected. | | * @param index The index of the tab to be selected. | |
| * @see isTabSelected, getSelectedTab | | * @see isTabSelected, getSelectedTab | |
| */ | | */ | |
| virtual void setSelectedTab(unsigned int index); | | virtual void setSelectedTab(unsigned int index); | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 196 | | skipping to change at line 203 | |
| * @see isTabSelected, setSelectedTab | | * @see isTabSelected, setSelectedTab | |
| */ | | */ | |
| virtual int getSelectedTabIndex() const; | | virtual int getSelectedTabIndex() const; | |
| | | | |
| /** | | /** | |
| * Gets the selected tab. | | * Gets the selected tab. | |
| * | | * | |
| * @return The selected tab. | | * @return The selected tab. | |
| * @see isTabSelected, setSelectedTab | | * @see isTabSelected, setSelectedTab | |
| */ | | */ | |
|
| Tab* getSelectedTab(); | | Tab* getSelectedTab() const; | |
| | | | |
| // Inherited from Widget | | // Inherited from Widget | |
| | | | |
| virtual void draw(Graphics *graphics); | | virtual void draw(Graphics *graphics); | |
| | | | |
|
| virtual void logic(); | | | |
| | | | |
| void setWidth(int width); | | void setWidth(int width); | |
| | | | |
| void setHeight(int height); | | void setHeight(int height); | |
| | | | |
| void setSize(int width, int height); | | void setSize(int width, int height); | |
| | | | |
| void setDimension(const Rectangle& dimension); | | void setDimension(const Rectangle& dimension); | |
| | | | |
|
| | | void setBaseColor(const Color& color); | |
| | | | |
| // Inherited from ActionListener | | // Inherited from ActionListener | |
| | | | |
| void action(const ActionEvent& actionEvent); | | void action(const ActionEvent& actionEvent); | |
| | | | |
| // Inherited from DeathListener | | // Inherited from DeathListener | |
| | | | |
| virtual void death(const Event& event); | | virtual void death(const Event& event); | |
| | | | |
| // Inherited from KeyListener | | // Inherited from KeyListener | |
| | | | |
| | | | |
End of changes. 9 change blocks. |
| 7 lines changed or deleted | | 14 lines changed or added | |
|
| textfield.hpp | | textfield.hpp | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 56 | |
| | | | |
| #include "guichan/keylistener.hpp" | | #include "guichan/keylistener.hpp" | |
| #include "guichan/mouselistener.hpp" | | #include "guichan/mouselistener.hpp" | |
| #include "guichan/platform.hpp" | | #include "guichan/platform.hpp" | |
| #include "guichan/widget.hpp" | | #include "guichan/widget.hpp" | |
| | | | |
| #include <string> | | #include <string> | |
| | | | |
| namespace gcn | | namespace gcn | |
| { | | { | |
|
| | | class Text; | |
| | | | |
| /** | | /** | |
| * An implementation of a text field where a user can enter a line of t
ext. | | * An implementation of a text field where a user can enter a line of t
ext. | |
| */ | | */ | |
| class GCN_CORE_DECLSPEC TextField: | | class GCN_CORE_DECLSPEC TextField: | |
| public Widget, | | public Widget, | |
| public MouseListener, | | public MouseListener, | |
| public KeyListener | | public KeyListener | |
| { | | { | |
| public: | | public: | |
| /** | | /** | |
| | | | |
| skipping to change at line 92 | | skipping to change at line 94 | |
| * @see getText | | * @see getText | |
| */ | | */ | |
| void setText(const std::string& text); | | void setText(const std::string& text); | |
| | | | |
| /** | | /** | |
| * Gets the text of the text field. | | * Gets the text of the text field. | |
| * | | * | |
| * @return The text of the text field. | | * @return The text of the text field. | |
| * @see setText | | * @see setText | |
| */ | | */ | |
|
| const std::string& getText() const; | | std::string getText() const; | |
| | | | |
| /** | | /** | |
| * Adjusts the size of the text field to fit the text. | | * Adjusts the size of the text field to fit the text. | |
| */ | | */ | |
| void adjustSize(); | | void adjustSize(); | |
| | | | |
| /** | | /** | |
| * Adjusts the height of the text field to fit caption. | | * Adjusts the height of the text field to fit caption. | |
| */ | | */ | |
| void adjustHeight(); | | void adjustHeight(); | |
| | | | |
| /** | | /** | |
|
| | | * Checks if the text field is editable. | |
| | | * | |
| | | * @return True it the text field is editable, false otherwise. | |
| | | * @see setEditable | |
| | | */ | |
| | | bool isEditable() const; | |
| | | | |
| | | /** | |
| | | * Sets the text field to be editable or not. A text field is edita | |
| | | ble | |
| | | * by default. | |
| | | * | |
| | | * @param editable True if the text field should be editable, false | |
| | | * otherwise. | |
| | | */ | |
| | | void setEditable(bool editable); | |
| | | | |
| | | /** | |
| * Sets the caret position. As there is only one line of text | | * Sets the caret position. As there is only one line of text | |
| * in a text field the position is the caret's x coordinate. | | * in a text field the position is the caret's x coordinate. | |
| * | | * | |
| * @param position The caret position. | | * @param position The caret position. | |
| * @see getCaretPosition | | * @see getCaretPosition | |
| */ | | */ | |
| void setCaretPosition(unsigned int position); | | void setCaretPosition(unsigned int position); | |
| | | | |
| /** | | /** | |
| * Gets the caret position. As there is only one line of text | | * Gets the caret position. As there is only one line of text | |
| * in a text field the position is the caret's x coordinate. | | * in a text field the position is the caret's x coordinate. | |
| * | | * | |
| * @return The caret position. | | * @return The caret position. | |
| * @see setCaretPosition | | * @see setCaretPosition | |
| */ | | */ | |
| unsigned int getCaretPosition() const; | | unsigned int getCaretPosition() const; | |
| | | | |
| // Inherited from Widget | | // Inherited from Widget | |
| | | | |
|
| virtual void fontChanged(); | | | |
| | | | |
| virtual void draw(Graphics* graphics); | | virtual void draw(Graphics* graphics); | |
| | | | |
| // Inherited from MouseListener | | // Inherited from MouseListener | |
| | | | |
| virtual void mousePressed(MouseEvent& mouseEvent); | | virtual void mousePressed(MouseEvent& mouseEvent); | |
| | | | |
| virtual void mouseDragged(MouseEvent& mouseEvent); | | virtual void mouseDragged(MouseEvent& mouseEvent); | |
| | | | |
| // Inherited from KeyListener | | // Inherited from KeyListener | |
| | | | |
| | | | |
| skipping to change at line 156 | | skipping to change at line 173 | |
| virtual void drawCaret(Graphics* graphics, int x); | | virtual void drawCaret(Graphics* graphics, int x); | |
| | | | |
| /** | | /** | |
| * Scrolls the text horizontally so that the caret shows if needed. | | * Scrolls the text horizontally so that the caret shows if needed. | |
| * The method is used any time a user types in the text field so th
e | | * The method is used any time a user types in the text field so th
e | |
| * caret always will be shown. | | * caret always will be shown. | |
| */ | | */ | |
| void fixScroll(); | | void fixScroll(); | |
| | | | |
| /** | | /** | |
|
| * Holds the text of the text box. | | * True if the text field is editable, false otherwise. | |
| */ | | */ | |
|
| std::string mText; | | bool mEditable; | |
| | | | |
| /** | | /** | |
|
| * Holds the caret position. | | * Holds the text of the text field. | |
| */ | | */ | |
|
| unsigned int mCaretPosition; | | Text* mText; | |
| | | | |
| /** | | /** | |
| * Holds the amount scrolled in x. If a user types more characters
than | | * Holds the amount scrolled in x. If a user types more characters
than | |
| * the text field can display, due to the text field being to small
, the | | * the text field can display, due to the text field being to small
, the | |
| * text needs to scroll in order to show the last type character. | | * text needs to scroll in order to show the last type character. | |
| */ | | */ | |
| int mXScroll; | | int mXScroll; | |
| }; | | }; | |
| } | | } | |
| | | | |
| | | | |
End of changes. 8 change blocks. |
| 7 lines changed or deleted | | 25 lines changed or added | |
|
| widget.hpp | | widget.hpp | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 56 | |
| | | | |
| #include <list> | | #include <list> | |
| #include <string> | | #include <string> | |
| | | | |
| #include "guichan/color.hpp" | | #include "guichan/color.hpp" | |
| #include "guichan/rectangle.hpp" | | #include "guichan/rectangle.hpp" | |
| | | | |
| namespace gcn | | namespace gcn | |
| { | | { | |
| class ActionListener; | | class ActionListener; | |
|
| class BasicContainer; | | | |
| class DeathListener; | | class DeathListener; | |
| class DefaultFont; | | class DefaultFont; | |
| class FocusHandler; | | class FocusHandler; | |
| class FocusListener; | | class FocusListener; | |
| class Font; | | class Font; | |
| class Graphics; | | class Graphics; | |
| class KeyInput; | | class KeyInput; | |
| class KeyListener; | | class KeyListener; | |
| class MouseInput; | | class MouseInput; | |
| class MouseListener; | | class MouseListener; | |
| class WidgetListener; | | class WidgetListener; | |
| | | | |
| /** | | /** | |
| * Abstract class for widgets of Guichan. It contains basic functions | | * Abstract class for widgets of Guichan. It contains basic functions | |
| * every widget should have. | | * every widget should have. | |
| * | | * | |
| * NOTE: Functions begining with underscore "_" should not | | * NOTE: Functions begining with underscore "_" should not | |
|
| * be overloaded unless you know what you are doing | | * be overloaded unless you know what you are doing. | |
| * | | * | |
| * @author Olof Naessén | | * @author Olof Naessén | |
|
| * @author Per Larsson. | | * @author Per Larsson | |
| * @since 0.1.0 | | * @since 0.1.0 | |
| */ | | */ | |
| class GCN_CORE_DECLSPEC Widget | | class GCN_CORE_DECLSPEC Widget | |
| { | | { | |
| public: | | public: | |
| /** | | /** | |
| * Constructor. Resets member variables. Noteable, a widget is not | | * Constructor. Resets member variables. Noteable, a widget is not | |
| * focusable as default, therefore, widgets that are supposed to be | | * focusable as default, therefore, widgets that are supposed to be | |
| * focusable should overide this default in their own constructor. | | * focusable should overide this default in their own constructor. | |
| */ | | */ | |
| Widget(); | | Widget(); | |
| | | | |
| /** | | /** | |
| * Default destructor. | | * Default destructor. | |
| */ | | */ | |
| virtual ~Widget(); | | virtual ~Widget(); | |
| | | | |
| /** | | /** | |
|
| * Draws the widget. It is called by the parent widget when it is t | | * Draws the widget. The call to draw is initiated by the widget's | |
| ime | | * parent. The graphics object is set up so that all drawing is rel | |
| * for the widget to draw itself. The graphics object is set up so | | ative | |
| * that all drawing is relative to the widget, i.e coordinate (0,0) | | * to the widget, i.e coordinate (0,0) is the top left corner of th | |
| is | | e widget. | |
| * the top left corner of the widget. It is not possible to draw | | * It is not possible to draw outside of a widget's dimension. If a | |
| * outside of a widget's dimension. | | widget | |
| | | * has children, the parent's draw function will always be called b | |
| | | efore | |
| | | * the children's draw functions are called. | |
| | | * | |
| | | * NOTE: A widget with children won't draw its children unless the | |
| | | * children area given by Widget::getChildrenArea returns a | |
| | | * none empty rectangle inside the widgets dimension. The chi | |
| | | ldren | |
| | | * area is considered relative to the widget's position. | |
| * | | * | |
|
| * @param graphics aA graphics object to draw with. | | * @param graphics A graphics object to draw with. | |
| | | * @see getChildrenArea | |
| * @since 0.1.0 | | * @since 0.1.0 | |
| */ | | */ | |
| virtual void draw(Graphics* graphics) = 0; | | virtual void draw(Graphics* graphics) = 0; | |
| | | | |
| /** | | /** | |
| * Called when a widget is given a chance to draw a frame around it
self. | | * Called when a widget is given a chance to draw a frame around it
self. | |
| * The frame is not considered a part of the widget, it only allows
a frame | | * The frame is not considered a part of the widget, it only allows
a frame | |
| * to be drawn around the widget, thus a frame will never be includ
ed when | | * to be drawn around the widget, thus a frame will never be includ
ed when | |
| * calculating if a widget should receive events from user input. A
lso | | * calculating if a widget should receive events from user input. A
lso | |
| * a widget's frame will never be included when calculating a widge
t's | | * a widget's frame will never be included when calculating a widge
t's | |
| | | | |
| skipping to change at line 180 | | skipping to change at line 186 | |
| /** | | /** | |
| * Gets the widget's parent container. | | * Gets the widget's parent container. | |
| * | | * | |
| * @return The widget's parent container. NULL if the widget | | * @return The widget's parent container. NULL if the widget | |
| * has no parent. | | * has no parent. | |
| * @since 0.1.0 | | * @since 0.1.0 | |
| */ | | */ | |
| virtual Widget* getParent() const; | | virtual Widget* getParent() const; | |
| | | | |
| /** | | /** | |
|
| | | * Gets the top widget, or top parent, of this widget. | |
| | | * | |
| | | * @return The top widget, or top parent, for this widget. NULL if | |
| | | no top widget | |
| | | * exists (that is this widget doesn't have a parent). | |
| | | * @since 0.9.0 | |
| | | */ | |
| | | virtual Widget* getTop() const; | |
| | | | |
| | | /** | |
| * Sets the width of the widget. | | * Sets the width of the widget. | |
| * | | * | |
| * @param width The width of the widget. | | * @param width The width of the widget. | |
| * @see getWidth, setHeight, getHeight, setSize, | | * @see getWidth, setHeight, getHeight, setSize, | |
| * setDimension, getDimensi | | * setDimension, getDimensi | |
| * @since 0.1.0 | | * @since 0.1.0 | |
| */ | | */ | |
| void setWidth(int width); | | void setWidth(int width); | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 440 | | skipping to change at line 455 | |
| * | | * | |
| * @return The selection color. | | * @return The selection color. | |
| * @see setSelectionColor | | * @see setSelectionColor | |
| * @since 0.6.0 | | * @since 0.6.0 | |
| */ | | */ | |
| const Color& getSelectionColor() const; | | const Color& getSelectionColor() const; | |
| | | | |
| /** | | /** | |
| * Requests focus for the widget. A widget will only recieve focus | | * Requests focus for the widget. A widget will only recieve focus | |
| * if it is focusable. | | * if it is focusable. | |
|
| | | * | |
| | | * @since 0.1.0 | |
| */ | | */ | |
| virtual void requestFocus(); | | virtual void requestFocus(); | |
| | | | |
| /** | | /** | |
| * Requests a move to the top in the parent widget. | | * Requests a move to the top in the parent widget. | |
|
| | | * | |
| | | * @since 0.1.0 | |
| */ | | */ | |
| virtual void requestMoveToTop(); | | virtual void requestMoveToTop(); | |
| | | | |
| /** | | /** | |
| * Requests a move to the bottom in the parent widget. | | * Requests a move to the bottom in the parent widget. | |
|
| | | * | |
| | | * @since 0.1.0 | |
| */ | | */ | |
| virtual void requestMoveToBottom(); | | virtual void requestMoveToBottom(); | |
| | | | |
| /** | | /** | |
|
| | | * Called whenever a widget should draw itself. The function will | |
| | | * set up clip areas and call the draw function for this widget | |
| | | * and for all its children. | |
| | | * | |
| | | * WARNING: This function is used internally and should not | |
| | | * be called or overloaded unless you know what you | |
| | | * are doing. | |
| | | * @since 0.9.0 | |
| | | */ | |
| | | virtual void _draw(Graphics* graphics); | |
| | | | |
| | | /** | |
| | | * Called whenever a widget should perform logic. The function will | |
| | | * call the logic function for this widget and for all its children | |
| | | . | |
| | | * | |
| | | * WARNING: This function is used internally and should not | |
| | | * be called or overloaded unless you know what you | |
| | | * are doing. | |
| | | * @since 0.9.0 | |
| | | */ | |
| | | virtual void _logic(); | |
| | | | |
| | | /** | |
| * Sets the focus handler to be used. | | * Sets the focus handler to be used. | |
| * | | * | |
| * WARNING: This function is used internally and should not | | * WARNING: This function is used internally and should not | |
| * be called or overloaded unless you know what you | | * be called or overloaded unless you know what you | |
| * are doing. | | * are doing. | |
| * | | * | |
| * @param focusHandler The focus handler to use. | | * @param focusHandler The focus handler to use. | |
| * @see _getFocusHandler | | * @see _getFocusHandler | |
| * @since 0.1.0 | | * @since 0.1.0 | |
| */ | | */ | |
| | | | |
| skipping to change at line 800 | | skipping to change at line 844 | |
| * Checks if the widget or it's parent has modal mouse input focus. | | * Checks if the widget or it's parent has modal mouse input focus. | |
| * | | * | |
| * @return True if the widget has modal mouse input focus, false | | * @return True if the widget has modal mouse input focus, false | |
| * otherwise. | | * otherwise. | |
| * @see requestModalMouseInputFocus, releaseModalMouseInputFocus | | * @see requestModalMouseInputFocus, releaseModalMouseInputFocus | |
| * @since 0.8.0 | | * @since 0.8.0 | |
| */ | | */ | |
| virtual bool isModalMouseInputFocused() const; | | virtual bool isModalMouseInputFocused() const; | |
| | | | |
| /** | | /** | |
|
| * Gets a widget from a certain position in the widget. | | * Gets a widget at a certain position in the widget. | |
| * This function is used to decide which gets mouse input, | | * This function is used to decide which gets mouse input, | |
| * thus it can be overloaded to change that behaviour. | | * thus it can be overloaded to change that behaviour. | |
| * | | * | |
| * NOTE: This always returns NULL if the widget is not | | * NOTE: This always returns NULL if the widget is not | |
| * a container. | | * a container. | |
| * | | * | |
| * @param x The x coordinate of the widget to get. | | * @param x The x coordinate of the widget to get. | |
| * @param y The y coordinate of the widget to get. | | * @param y The y coordinate of the widget to get. | |
| * @return The widget at the specified coodinate, NULL | | * @return The widget at the specified coodinate, NULL | |
| * if no widget is found. | | * if no widget is found. | |
| * @since 0.6.0 | | * @since 0.6.0 | |
| */ | | */ | |
| virtual Widget *getWidgetAt(int x, int y); | | virtual Widget *getWidgetAt(int x, int y); | |
| | | | |
| /** | | /** | |
|
| | | * Gets all widgets inside a certain area of the widget. | |
| | | * | |
| | | * NOTE: This always returns an emtpy list if the widget is not | |
| | | * a container. | |
| | | * | |
| | | * @param area The area to check. | |
| | | * @param ignore If supplied, this widget will be ignored. | |
| | | * @return A list of widgets. An empty list if no widgets was found | |
| | | . | |
| | | * @since 0.9.0 | |
| | | */ | |
| | | virtual std::list<Widget*> getWidgetsIn(const Rectangle& area, | |
| | | Widget* ignore = NULL); | |
| | | | |
| | | /** | |
| * Gets the mouse listeners of the widget. | | * Gets the mouse listeners of the widget. | |
| * | | * | |
| * @return The mouse listeners of the widget. | | * @return The mouse listeners of the widget. | |
| * @since 0.6.0 | | * @since 0.6.0 | |
| */ | | */ | |
| virtual const std::list<MouseListener*>& _getMouseListeners(); | | virtual const std::list<MouseListener*>& _getMouseListeners(); | |
| | | | |
| /** | | /** | |
| * Gets the key listeners of the widget. | | * Gets the key listeners of the widget. | |
| * | | * | |
| | | | |
| skipping to change at line 847 | | skipping to change at line 905 | |
| virtual const std::list<FocusListener*>& _getFocusListeners(); | | virtual const std::list<FocusListener*>& _getFocusListeners(); | |
| | | | |
| /** | | /** | |
| * Gets the area of the widget occupied by the widget's children. | | * Gets the area of the widget occupied by the widget's children. | |
| * By default this method returns an empty rectangle as not all | | * By default this method returns an empty rectangle as not all | |
| * widgets are containers. If you want to make a container this | | * widgets are containers. If you want to make a container this | |
| * method should return the area where the children resides. This | | * method should return the area where the children resides. This | |
| * method is used when drawing children of a widget when computing | | * method is used when drawing children of a widget when computing | |
| * clip rectangles for the children. | | * clip rectangles for the children. | |
| * | | * | |
|
| | | * NOTE: The returned rectangle should be relative to the widget, | |
| | | * i.e a rectangle with x and y coordinate (0,0) and with | |
| | | * width and height the same as the widget will let the | |
| | | * children draw themselves in the whole widget. | |
| | | * | |
| * An example of a widget that overloads this method is ScrollArea. | | * An example of a widget that overloads this method is ScrollArea. | |
| * A ScrollArea has a view of its contant and that view is the | | * A ScrollArea has a view of its contant and that view is the | |
| * children area. The size of a ScrollArea's children area might | | * children area. The size of a ScrollArea's children area might | |
| * vary depending on if the scroll bars of the ScrollArea is shown | | * vary depending on if the scroll bars of the ScrollArea is shown | |
| * or not. | | * or not. | |
| * | | * | |
| * @return The area of the widget occupied by the widget's children
. | | * @return The area of the widget occupied by the widget's children
. | |
|
| * @see BasicContainer | | * @since 0.5.0 | |
| * @see BasicContainer::getChildrenArea | | | |
| * @see BasicContainer::drawChildren | | | |
| * @since 0.1.0 | | | |
| */ | | */ | |
| virtual Rectangle getChildrenArea(); | | virtual Rectangle getChildrenArea(); | |
| | | | |
| /** | | /** | |
| * Gets the internal focus handler used. | | * Gets the internal focus handler used. | |
| * | | * | |
| * @return the internalFocusHandler used. If no internal focus hand
ler | | * @return the internalFocusHandler used. If no internal focus hand
ler | |
| * is used, NULL will be returned. | | * is used, NULL will be returned. | |
| * @see setInternalFocusHandler | | * @see setInternalFocusHandler | |
| * @since 0.1.0 | | * @since 0.1.0 | |
| | | | |
| skipping to change at line 886 | | skipping to change at line 946 | |
| * @param focusHandler The internal focus handler to be used. | | * @param focusHandler The internal focus handler to be used. | |
| * @see getInternalFocusHandler | | * @see getInternalFocusHandler | |
| * @since 0.1.0 | | * @since 0.1.0 | |
| */ | | */ | |
| void setInternalFocusHandler(FocusHandler* internalFocusHandler); | | void setInternalFocusHandler(FocusHandler* internalFocusHandler); | |
| | | | |
| /** | | /** | |
| * Moves a widget to the top of this widget. The moved widget will
be | | * Moves a widget to the top of this widget. The moved widget will
be | |
| * drawn above all other widgets in this widget. | | * drawn above all other widgets in this widget. | |
| * | | * | |
|
| | | * This method is safe to call at any time. | |
| | | * | |
| * @param widget The widget to move to the top. | | * @param widget The widget to move to the top. | |
| * @see moveToBottom | | * @see moveToBottom | |
| * @since 0.1.0 | | * @since 0.1.0 | |
| */ | | */ | |
|
| virtual void moveToTop(Widget* widget) { }; | | virtual void moveToTop(Widget* widget); | |
| | | | |
| /** | | /** | |
| * Moves a widget in this widget to the bottom of this widget. | | * Moves a widget in this widget to the bottom of this widget. | |
| * The moved widget will be drawn below all other widgets in this w
idget. | | * The moved widget will be drawn below all other widgets in this w
idget. | |
| * | | * | |
|
| | | * This method is safe to call at any time. | |
| | | * | |
| * @param widget The widget to move to the bottom. | | * @param widget The widget to move to the bottom. | |
| * @see moveToTop | | * @see moveToTop | |
| * @since 0.1.0 | | * @since 0.1.0 | |
| */ | | */ | |
|
| virtual void moveToBottom(Widget* widget) { }; | | virtual void moveToBottom(Widget* widget); | |
| | | | |
| /** | | /** | |
| * Focuses the next widget in the widget. | | * Focuses the next widget in the widget. | |
| * | | * | |
| * @see moveToBottom | | * @see moveToBottom | |
| * @since 0.1.0 | | * @since 0.1.0 | |
| */ | | */ | |
|
| virtual void focusNext() { }; | | virtual void focusNext(); | |
| | | | |
| /** | | /** | |
| * Focuses the previous widget in the widget. | | * Focuses the previous widget in the widget. | |
| * | | * | |
| * @see moveToBottom | | * @see moveToBottom | |
| * @since 0.1.0 | | * @since 0.1.0 | |
| */ | | */ | |
|
| virtual void focusPrevious() { }; | | virtual void focusPrevious(); | |
| | | | |
| /** | | /** | |
| * Tries to show a specific part of a widget by moving it. Used if
the | | * Tries to show a specific part of a widget by moving it. Used if
the | |
| * widget should act as a container. | | * widget should act as a container. | |
| * | | * | |
| * @param widget The target widget. | | * @param widget The target widget. | |
| * @param area The area to show. | | * @param area The area to show. | |
| * @since 0.1.0 | | * @since 0.1.0 | |
| */ | | */ | |
|
| virtual void showWidgetPart(Widget* widget, Rectangle area) { }; | | virtual void showWidgetPart(Widget* widget, Rectangle area); | |
| | | | |
| /** | | /** | |
| * Sets an id of a widget. An id can be useful if a widget needs to
be | | * Sets an id of a widget. An id can be useful if a widget needs to
be | |
| * identified in a container. For example, if widgets are created b
y an | | * identified in a container. For example, if widgets are created b
y an | |
| * XML document, a certain widget can be retrieved given that the w
idget | | * XML document, a certain widget can be retrieved given that the w
idget | |
| * has an id. | | * has an id. | |
| * | | * | |
| * @param id The id to set to the widget. | | * @param id The id to set to the widget. | |
| * @see getId, BasicContainer::findWidgetById | | * @see getId, BasicContainer::findWidgetById | |
| * @since 0.8.0 | | * @since 0.8.0 | |
| | | | |
| skipping to change at line 950 | | skipping to change at line 1014 | |
| /** | | /** | |
| * Gets the id of a widget. An id can be useful if a widget needs t
o be | | * Gets the id of a widget. An id can be useful if a widget needs t
o be | |
| * identified in a container. For example, if widgets are created b
y an | | * identified in a container. For example, if widgets are created b
y an | |
| * XML document, a certain widget can be retrieved given that the w
idget | | * XML document, a certain widget can be retrieved given that the w
idget | |
| * has an id. | | * has an id. | |
| * | | * | |
| * @param id The id to set to the widget. | | * @param id The id to set to the widget. | |
| * @see setId, BasicContainer::findWidgetById | | * @see setId, BasicContainer::findWidgetById | |
| * @since 0.8.0 | | * @since 0.8.0 | |
| */ | | */ | |
|
| const std::string& getId(); | | const std::string& getId() const; | |
| | | | |
| /** | | /** | |
| * Shows a certain part of a widget in the widget's parent. | | * Shows a certain part of a widget in the widget's parent. | |
| * Used when widgets want a specific part to be visible in | | * Used when widgets want a specific part to be visible in | |
| * its parent. An example is a TextArea that wants a specific | | * its parent. An example is a TextArea that wants a specific | |
| * part of its text to be visible when a TextArea is a child | | * part of its text to be visible when a TextArea is a child | |
| * of a ScrollArea. | | * of a ScrollArea. | |
| * | | * | |
| * @param rectangle The rectangle to be shown. | | * @param rectangle The rectangle to be shown. | |
| * @since 0.8.0 | | * @since 0.8.0 | |
| | | | |
| skipping to change at line 991 | | skipping to change at line 1055 | |
| * Distributes moved events to all of the widget's listeners. | | * Distributes moved events to all of the widget's listeners. | |
| * | | * | |
| * @since 0.8.0 | | * @since 0.8.0 | |
| */ | | */ | |
| void distributeMovedEvent(); | | void distributeMovedEvent(); | |
| | | | |
| /** | | /** | |
| * Distributes hidden events to all of the widget's listeners. | | * Distributes hidden events to all of the widget's listeners. | |
| * | | * | |
| * @since 0.8.0 | | * @since 0.8.0 | |
|
| * @author Olof Naessén | | | |
| */ | | */ | |
| void distributeHiddenEvent(); | | void distributeHiddenEvent(); | |
| | | | |
| /** | | /** | |
| * Distributes shown events to all of the widget's listeners. | | * Distributes shown events to all of the widget's listeners. | |
| * | | * | |
| * @since 0.8.0 | | * @since 0.8.0 | |
|
| * @author Olof Naessén | | | |
| */ | | */ | |
| void distributeShownEvent(); | | void distributeShownEvent(); | |
| | | | |
| /** | | /** | |
|
| * Typdef. | | * Adds a child to the widget. | |
| */ | | * | |
| typedef std::list<MouseListener*> MouseListenerList; | | * THIS METHOD IS NOT SAFE TO CALL INSIDE A WIDGETS LOGIC FUNCTION | |
| | | * INSIDE ANY LISTER FUNCTIONS! | |
| /** | | * | |
| * Typdef. | | * @param widget The widget to add. | |
| | | * @see remove, clear | |
| | | * @since 0.9.0 | |
| */ | | */ | |
|
| typedef MouseListenerList::iterator MouseListenerIterator; | | void add(Widget* widget); | |
| | | | |
| /** | | /** | |
|
| * Holds the mouse listeners of the widget. | | * Removes a child from the widget. | |
| | | * | |
| | | * THIS METHOD IS NOT SAFE TO CALL INSIDE A WIDGETS LOGIC FUNCTION | |
| | | * INSIDE ANY LISTER FUNCTIONS! | |
| | | * | |
| | | * @param widget The widget to remove. | |
| | | * @see add, clear | |
| | | * @since 0.9.0 | |
| */ | | */ | |
|
| MouseListenerList mMouseListeners; | | virtual void remove(Widget* widget); | |
| | | | |
| /** | | /** | |
|
| * Typdef. | | * Clears the widget from all its children. | |
| | | * | |
| | | * THIS METHOD IS NOT SAFE TO CALL INSIDE A WIDGETS LOGIC FUNCTION | |
| | | * INSIDE ANY LISTER FUNCTIONS! | |
| | | * | |
| | | * @see remove, clear | |
| | | * @since 0.9.0 | |
| */ | | */ | |
|
| typedef std::list<KeyListener*> KeyListenerList; | | virtual void clear(); | |
| | | | |
| /** | | /** | |
|
| * Holds the key listeners of the widget. | | * Finds a widget given an id. This function can be useful | |
| | | * when implementing a GUI generator for Guichan, such as | |
| | | * the ability to create a Guichan GUI from an XML file. | |
| | | * | |
| | | * @param id The id to find a widget by. | |
| | | * @return The widget with the corrosponding id, | |
| | | * NULL of no widget is found. | |
| | | * | |
| | | * @since 0.8.0 | |
| */ | | */ | |
|
| KeyListenerList mKeyListeners; | | virtual Widget* findWidgetById(const std::string& id); | |
| | | | |
| /** | | /** | |
|
| * Typdef. | | * Resizes the widget to fit it's children exactly. | |
| | | * | |
| | | * @since 0.9.0 | |
| */ | | */ | |
|
| typedef KeyListenerList::iterator KeyListenerIterator; | | void resizeToChildren(); | |
| | | | |
| /** | | /** | |
|
| * Typdef. | | * Gets the children of the widget. | |
| | | * | |
| | | * @return A list of the widgets children. | |
| | | * @since 0.9.0 | |
| */ | | */ | |
|
| typedef std::list<ActionListener*> ActionListenerList; | | const std::list<Widget*>& getChildren() const; | |
| | | | |
| /** | | /** | |
|
| * Holds the action listeners of the widget. | | * Holds the mouse listeners of the widget. | |
| */ | | */ | |
|
| ActionListenerList mActionListeners; | | std::list<MouseListener*> mMouseListeners; | |
| | | | |
| /** | | /** | |
|
| * Typdef. | | * Holds the key listeners of the widget. | |
| */ | | */ | |
|
| typedef ActionListenerList::iterator ActionListenerIterator; | | std::list<KeyListener*> mKeyListeners; | |
| | | | |
| /** | | /** | |
|
| * Typdef. | | * Holds the action listeners of the widget. | |
| */ | | */ | |
|
| typedef std::list<DeathListener*> DeathListenerList; | | std::list<ActionListener*> mActionListeners; | |
| | | | |
| /** | | /** | |
| * Holds the death listeners of the widget. | | * Holds the death listeners of the widget. | |
| */ | | */ | |
|
| DeathListenerList mDeathListeners; | | std::list<DeathListener*> mDeathListeners; | |
| | | | |
| /** | | | |
| * Typdef. | | | |
| */ | | | |
| typedef DeathListenerList::iterator DeathListenerIterator; | | | |
| | | | |
| /** | | | |
| * Typdef. | | | |
| */ | | | |
| typedef std::list<FocusListener*> FocusListenerList; | | | |
| | | | |
| /** | | /** | |
| * Holds the focus listeners of the widget. | | * Holds the focus listeners of the widget. | |
| */ | | */ | |
|
| FocusListenerList mFocusListeners; | | std::list<FocusListener*> mFocusListeners; | |
| | | | |
| /** | | | |
| * Typdef. | | | |
| */ | | | |
| typedef FocusListenerList::iterator FocusListenerIterator; | | | |
| | | | |
| typedef std::list<WidgetListener*> WidgetListenerList; | | | |
| | | | |
| /** | | /** | |
| * Holds the widget listeners of the widget. | | * Holds the widget listeners of the widget. | |
| */ | | */ | |
|
| WidgetListenerList mWidgetListeners; | | std::list<WidgetListener*> mWidgetListeners; | |
| | | | |
| /** | | | |
| * Typdef. | | | |
| */ | | | |
| typedef WidgetListenerList::iterator WidgetListenerIterator; | | | |
| | | | |
| /** | | /** | |
| * Holds the foreground color of the widget. | | * Holds the foreground color of the widget. | |
| */ | | */ | |
| Color mForegroundColor; | | Color mForegroundColor; | |
| | | | |
| /** | | /** | |
| * Holds the background color of the widget. | | * Holds the background color of the widget. | |
| */ | | */ | |
| Color mBackgroundColor; | | Color mBackgroundColor; | |
| | | | |
| skipping to change at line 1190 | | skipping to change at line 1258 | |
| static DefaultFont mDefaultFont; | | static DefaultFont mDefaultFont; | |
| | | | |
| /** | | /** | |
| * Holds the global font used by the widget. | | * Holds the global font used by the widget. | |
| */ | | */ | |
| static Font* mGlobalFont; | | static Font* mGlobalFont; | |
| | | | |
| /** | | /** | |
| * Holds a list of all instances of widgets. | | * Holds a list of all instances of widgets. | |
| */ | | */ | |
|
| static std::list<Widget*> mWidgets; | | static std::list<Widget*> mWidgetInstances; | |
| | | | |
| | | /** | |
| | | * Holds all children of the widget. | |
| | | */ | |
| | | std::list<Widget*> mChildren; | |
| }; | | }; | |
| } | | } | |
| | | | |
| #endif // end GCN_WIDGET_HPP | | #endif // end GCN_WIDGET_HPP | |
| | | | |
End of changes. 46 change blocks. |
| 73 lines changed or deleted | | 152 lines changed or added | |
|