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 | |||
gui.hpp | gui.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_GUI_HPP | #ifndef GCN_GUI_HPP | |||
#define GCN_GUI_HPP | #define GCN_GUI_HPP | |||
#include <list> | #include <list> | |||
#include <deque> | #include <set> | |||
#include "guichan/keyevent.hpp" | #include "guichan/keyevent.hpp" | |||
#include "guichan/mouseevent.hpp" | #include "guichan/mouseevent.hpp" | |||
#include "guichan/mouseinput.hpp" | #include "guichan/mouseinput.hpp" | |||
#include "guichan/platform.hpp" | #include "guichan/platform.hpp" | |||
namespace gcn | namespace gcn | |||
{ | { | |||
class FocusHandler; | class FocusHandler; | |||
class Graphics; | class Graphics; | |||
skipping to change at line 397 | skipping to change at line 397 | |||
/** | /** | |||
* Gets the source of the key event. | * Gets the source of the key event. | |||
* | * | |||
* @return The source widget of the key event. | * @return The source widget of the key event. | |||
* @since 0.6.0 | * @since 0.6.0 | |||
*/ | */ | |||
virtual Widget* getKeyEventSource(); | virtual Widget* getKeyEventSource(); | |||
/** | /** | |||
* Gets all widgets a certain coordinate in the Gui. | ||||
* | ||||
* @param x The x coordinate. | ||||
* @param y The y coordinate. | ||||
* @return A set of all widgets at the specified coordinate. | ||||
* @since 0.9.0 | ||||
*/ | ||||
virtual std::set<Widget*> getWidgetsAt(int x, int y); | ||||
/** | ||||
* Holds the top widget. | * Holds the top widget. | |||
*/ | */ | |||
Widget* mTop; | Widget* mTop; | |||
/** | /** | |||
* Holds the graphics implementation used. | * Holds the graphics implementation used. | |||
*/ | */ | |||
Graphics* mGraphics; | Graphics* mGraphics; | |||
/** | /** | |||
skipping to change at line 488 | skipping to change at line 498 | |||
* of clicks for a the last pressed button. | * of clicks for a the last pressed button. | |||
*/ | */ | |||
int mClickCount; | int mClickCount; | |||
/** | /** | |||
* Holds the last button used when a drag of a widget | * Holds the last button used when a drag of a widget | |||
* was initiated. Used to be able to release a drag | * was initiated. Used to be able to release a drag | |||
* when the same button is released. | * when the same button is released. | |||
*/ | */ | |||
int mLastMouseDragButton; | int mLastMouseDragButton; | |||
/** | ||||
* Holds a stack with all the widgets with the mouse. | ||||
* Used to properly distribute mouse events. | ||||
*/ | ||||
std::deque<Widget*> mWidgetWithMouseQueue; | ||||
}; | }; | |||
} | } | |||
#endif // end GCN_GUI_HPP | #endif // end GCN_GUI_HPP | |||
/* yakslem - "Women, it's a constant struggle." | ||||
* finalman - "Yes, but sometimes they succeed with their guesses." | ||||
* yaklsem - "...eh...I was talking about love." | ||||
* finalman - "Oh...ok..." | ||||
* An awkward silence followed. | ||||
*/ | ||||
End of changes. 4 change blocks. | ||||
7 lines changed or deleted | 11 lines changed or added | |||
guichan.hpp | guichan.hpp | |||
---|---|---|---|---|
skipping to change at line 51 | skipping to change at line 51 | |||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
*/ | */ | |||
#ifndef GCN_GUICHAN_HPP | #ifndef GCN_GUICHAN_HPP | |||
#define GCN_GUICHAN_HPP | #define GCN_GUICHAN_HPP | |||
#include <guichan/actionevent.hpp> | #include <guichan/actionevent.hpp> | |||
#include <guichan/actionlistener.hpp> | #include <guichan/actionlistener.hpp> | |||
#include <guichan/cliprectangle.hpp> | #include <guichan/cliprectangle.hpp> | |||
#include <guichan/color.hpp> | #include <guichan/color.hpp> | |||
#include <guichan/containerevent.hpp> | ||||
#include <guichan/containerlistener.hpp> | ||||
#include <guichan/deathlistener.hpp> | #include <guichan/deathlistener.hpp> | |||
#include <guichan/event.hpp> | #include <guichan/event.hpp> | |||
#include <guichan/exception.hpp> | #include <guichan/exception.hpp> | |||
#include <guichan/focushandler.hpp> | #include <guichan/focushandler.hpp> | |||
#include <guichan/focuslistener.hpp> | #include <guichan/focuslistener.hpp> | |||
#include <guichan/font.hpp> | #include <guichan/font.hpp> | |||
#include <guichan/genericinput.hpp> | #include <guichan/genericinput.hpp> | |||
#include <guichan/graphics.hpp> | #include <guichan/graphics.hpp> | |||
#include <guichan/gui.hpp> | #include <guichan/gui.hpp> | |||
#include <guichan/image.hpp> | #include <guichan/image.hpp> | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 2 lines changed or added | |||
inputevent.hpp | inputevent.hpp | |||
---|---|---|---|---|
skipping to change at line 65 | skipping to change at line 65 | |||
* @author Olof Naess�n | * @author Olof Naess�n | |||
* @since 0.6.0 | * @since 0.6.0 | |||
*/ | */ | |||
class GCN_CORE_DECLSPEC InputEvent: public Event | class GCN_CORE_DECLSPEC InputEvent: public Event | |||
{ | { | |||
public: | public: | |||
/** | /** | |||
* Constructor. | * Constructor. | |||
* | * | |||
* @param source The source widget of the event. | * @param source The widget the event concerns. | |||
* @param distributor The distributor of the event. | ||||
* @param isShiftPressed True if shift is pressed, false otherwise. | * @param isShiftPressed True if shift is pressed, false otherwise. | |||
* @param isControlPressed True if control is pressed, false otherw ise. | * @param isControlPressed True if control is pressed, false otherw ise. | |||
* @param isAltPressed True if alt is pressed, false otherwise. | * @param isAltPressed True if alt is pressed, false otherwise. | |||
* @param isMetaPressed True if meta is pressed, false otherwise. | * @param isMetaPressed True if meta is pressed, false otherwise. | |||
*/ | */ | |||
InputEvent(Widget* source, | InputEvent(Widget* source, | |||
Widget* distributor, | ||||
bool isShiftPressed, | bool isShiftPressed, | |||
bool isControlPressed, | bool isControlPressed, | |||
bool isAltPressed, | bool isAltPressed, | |||
bool isMetaPressed); | bool isMetaPressed); | |||
/** | /** | |||
* Checks if shift is pressed. | * Checks if shift is pressed. | |||
* | * | |||
* @return True if shift was pressed at the same time as the key, | * @return True if shift was pressed at the same time as the key, | |||
* false otherwise. | * false otherwise. | |||
skipping to change at line 130 | skipping to change at line 132 | |||
/** | /** | |||
* Checks if the input event is consumed. | * Checks if the input event is consumed. | |||
* | * | |||
* @return True if the input event is consumed, | * @return True if the input event is consumed, | |||
* false otherwise. | * false otherwise. | |||
* @see consume | * @see consume | |||
*/ | */ | |||
bool isConsumed() const; | bool isConsumed() const; | |||
/** | ||||
* Gets the distributor of the event. The function is | ||||
* used to tell which widget actually distributed the | ||||
* event. As input events bubbles up, the source of the event | ||||
* may not be the same as the distributor of the event. | ||||
*/ | ||||
Widget* getDistributor() const; | ||||
protected: | protected: | |||
/** | /** | |||
* True if shift is pressed, false otherwise. | * True if shift is pressed, false otherwise. | |||
*/ | */ | |||
bool mShiftPressed; | bool mShiftPressed; | |||
/** | /** | |||
* True if control is pressed, false otherwise. | * True if control is pressed, false otherwise. | |||
*/ | */ | |||
bool mControlPressed; | bool mControlPressed; | |||
skipping to change at line 156 | skipping to change at line 166 | |||
/** | /** | |||
* True if meta is pressed, false otherwise. | * True if meta is pressed, false otherwise. | |||
*/ | */ | |||
bool mMetaPressed; | bool mMetaPressed; | |||
/** | /** | |||
* True if the input event is consumed, | * True if the input event is consumed, | |||
* false otherwise. | * false otherwise. | |||
*/ | */ | |||
bool mIsConsumed; | bool mIsConsumed; | |||
/** | ||||
* Holds the distributor of the event. | ||||
*/ | ||||
Widget* mDistributor; | ||||
/** | ||||
* Gui is a friend of this class in order to be able to manipulate | ||||
* the protected member variables of this class and at the same tim | ||||
e | ||||
* keep the MouseEvent class as const as possible. Gui needs to | ||||
* update the distributer of this class whenever the distributer | ||||
* changes as events bubble up. | ||||
*/ | ||||
friend class Gui; | ||||
}; | }; | |||
} | } | |||
#endif // end GCN_INPUTEVENT_HPP | #endif // end GCN_INPUTEVENT_HPP | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 26 lines changed or added | |||
key.hpp | key.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_KEY_HPP | #ifndef GCN_KEY_HPP | |||
#define GCN_KEY_HPP | #define GCN_KEY_HPP | |||
#include "guichan/platform.hpp" | #include "guichan/platform.hpp" | |||
// windows.h defines DELETE which breaks this file as we have a constant na | ||||
med | ||||
// DELETE, hence we undefine DELETE if it is defined and hope people don't | ||||
use | ||||
// that windows define with Guichan. | ||||
#if defined (_WIN32) && defined(DELETE) | ||||
#undef DELETE | ||||
#endif | ||||
namespace gcn | namespace gcn | |||
{ | { | |||
/** | /** | |||
* Represents a key or a character. | * Represents a key or a character. | |||
*/ | */ | |||
class GCN_CORE_DECLSPEC Key | class GCN_CORE_DECLSPEC Key | |||
{ | { | |||
public: | public: | |||
/** | /** | |||
skipping to change at line 125 | skipping to change at line 118 | |||
* @param key The key to compare this key with. | * @param key The key to compare this key with. | |||
* @return True if the keys are not equal, false otherwise. | * @return True if the keys are not equal, false otherwise. | |||
*/ | */ | |||
bool operator!=(const Key& key) const; | bool operator!=(const Key& key) const; | |||
/** | /** | |||
* An enum with key values. | * An enum with key values. | |||
*/ | */ | |||
enum | enum | |||
{ | { | |||
SPACE = ' ', | Space = ' ', | |||
TAB = '\t', | Tab = '\t', | |||
ENTER = '\n', | Enter = '\n', | |||
LEFT_ALT = 1000, | // Negative values, to avoid conflicts with higher character co | |||
RIGHT_ALT, | des | |||
LEFT_SHIFT, | LeftAlt = -1000, | |||
RIGHT_SHIFT, | RightAlt, | |||
LEFT_CONTROL, | LeftShift, | |||
RIGHT_CONTROL, | RightShift, | |||
LEFT_META, | LeftControl, | |||
RIGHT_META, | RightControl, | |||
LEFT_SUPER, | LeftMeta, | |||
RIGHT_SUPER, | RightMeta, | |||
INSERT, | LeftSuper, | |||
HOME, | RightSuper, | |||
PAGE_UP, | Insert, | |||
DELETE, | Home, | |||
END, | PageUp, | |||
PAGE_DOWN, | Delete, | |||
ESCAPE, | End, | |||
CAPS_LOCK, | PageDown, | |||
BACKSPACE, | Escape, | |||
CapsLock, | ||||
Backspace, | ||||
F1, | F1, | |||
F2, | F2, | |||
F3, | F3, | |||
F4, | F4, | |||
F5, | F5, | |||
F6, | F6, | |||
F7, | F7, | |||
F8, | F8, | |||
F9, | F9, | |||
F10, | F10, | |||
F11, | F11, | |||
F12, | F12, | |||
F13, | F13, | |||
F14, | F14, | |||
F15, | F15, | |||
PRINT_SCREEN, | PrintScreen, | |||
SCROLL_LOCK, | ScrollLock, | |||
PAUSE, | Pause, | |||
NUM_LOCK, | NumLock, | |||
ALT_GR, | AltGr, | |||
LEFT, | Left, | |||
RIGHT, | Right, | |||
UP, | Up, | |||
DOWN | Down | |||
}; | }; | |||
protected: | protected: | |||
/** | /** | |||
* Holds the value of the key. It may be an ascii value | * Holds the value of the key. It may be an ascii value | |||
* or an enum value. | * or an enum value. | |||
*/ | */ | |||
int mValue; | int mValue; | |||
}; | }; | |||
} | } | |||
End of changes. 3 change blocks. | ||||
40 lines changed or deleted | 33 lines changed or added | |||
keyevent.hpp | keyevent.hpp | |||
---|---|---|---|---|
skipping to change at line 66 | skipping to change at line 66 | |||
* Represents a key event. | * Represents a key event. | |||
*/ | */ | |||
class GCN_CORE_DECLSPEC KeyEvent: public InputEvent | class GCN_CORE_DECLSPEC KeyEvent: public InputEvent | |||
{ | { | |||
public: | public: | |||
/** | /** | |||
* Key event types. | * Key event types. | |||
*/ | */ | |||
enum | enum | |||
{ | { | |||
PRESSED = 0, | Pressed = 0, | |||
RELEASED | Released | |||
}; | }; | |||
/** | /** | |||
* Constructor. | * Constructor. | |||
* | * | |||
* @param source The source widget of the event. | * @param source The widget the event concerns.. | |||
* @param distributor The distributor of the event. | ||||
* @param isShiftPressed True if shift is pressed, false otherwise. | * @param isShiftPressed True if shift is pressed, false otherwise. | |||
* @param isControlPressed True if control is pressed, false otherw ise. | * @param isControlPressed True if control is pressed, false otherw ise. | |||
* @param isAltPressed True if alt is pressed, false otherwise. | * @param isAltPressed True if alt is pressed, false otherwise. | |||
* @param isMetaPressed True if meta is pressed, false otherwise. | * @param isMetaPressed True if meta is pressed, false otherwise. | |||
* @param type The type of the event. A value from KeyEventType. | * @param type The type of the event. A value from KeyEventType. | |||
* @param isNumericPad True if the event occured on the numeric pad , | * @param isNumericPad True if the event occured on the numeric pad , | |||
* false otherwise. | * false otherwise. | |||
* @param key The key of the event. | * @param key The key of the event. | |||
*/ | */ | |||
KeyEvent(Widget* source, | KeyEvent(Widget* source, | |||
Widget* distributor, | ||||
bool isShiftPressed, | bool isShiftPressed, | |||
bool isControlPressed, | bool isControlPressed, | |||
bool isAltPressed, | bool isAltPressed, | |||
bool isMetaPressed, | bool isMetaPressed, | |||
unsigned int type, | unsigned int type, | |||
bool isNumericPad, | bool isNumericPad, | |||
const Key& key); | const Key& key); | |||
/** | /** | |||
* Destructor. | * Destructor. | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 5 lines changed or added | |||
keyinput.hpp | keyinput.hpp | |||
---|---|---|---|---|
skipping to change at line 216 | skipping to change at line 216 | |||
* @since 0.6.0 | * @since 0.6.0 | |||
*/ | */ | |||
void setNumericPad(bool numpad); | void setNumericPad(bool numpad); | |||
/** | /** | |||
* Key input types. This enum corresponds to the enum with event | * Key input types. This enum corresponds to the enum with event | |||
* types on KeyEvent for easy mapping. | * types on KeyEvent for easy mapping. | |||
*/ | */ | |||
enum | enum | |||
{ | { | |||
PRESSED = 0, | Pressed = 0, | |||
RELEASED | Released | |||
}; | }; | |||
protected: | protected: | |||
/** | /** | |||
* Holds the key of the key input. | * Holds the key of the key input. | |||
*/ | */ | |||
Key mKey; | Key mKey; | |||
/** | /** | |||
* Holds the type of the key input. | * Holds the type of the key input. | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
listbox.hpp | listbox.hpp | |||
---|---|---|---|---|
skipping to change at line 124 | skipping to change at line 124 | |||
* @see getListModel | * @see getListModel | |||
*/ | */ | |||
void setListModel(ListModel *listModel); | void setListModel(ListModel *listModel); | |||
/** | /** | |||
* Gets the list model used. | * Gets the list model used. | |||
* | * | |||
* @return the list model used. | * @return the list model used. | |||
* @see setListModel | * @see setListModel | |||
*/ | */ | |||
ListModel *getListModel(); | ListModel *getListModel() const; | |||
/** | /** | |||
* Adjusts the size of the list box to fit it's list model. | * Adjusts the size of the list box to fit it's list model. | |||
*/ | */ | |||
void adjustSize(); | void adjustSize(); | |||
/** | /** | |||
* Checks whether the list box wraps when selecting items with a | * Checks whether the list box wraps when selecting items with a | |||
* keyboard. | * keyboard. | |||
* | * | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
mouseevent.hpp | mouseevent.hpp | |||
---|---|---|---|---|
skipping to change at line 68 | skipping to change at line 68 | |||
* @author Olof Naess�n | * @author Olof Naess�n | |||
* @since 0.6.0 | * @since 0.6.0 | |||
*/ | */ | |||
class GCN_CORE_DECLSPEC MouseEvent: public InputEvent | class GCN_CORE_DECLSPEC MouseEvent: public InputEvent | |||
{ | { | |||
public: | public: | |||
/** | /** | |||
* Constructor. | * Constructor. | |||
* | * | |||
* @param source The source widget of the mouse event. | * @param source The widget the event concerns. | |||
* @param distributor The distributor of the mouse event. | ||||
* @param isShiftPressed True if shift is pressed, false otherwise. | * @param isShiftPressed True if shift is pressed, false otherwise. | |||
* @param isControlPressed True if control is pressed, false otherw ise. | * @param isControlPressed True if control is pressed, false otherw ise. | |||
* @param isAltPressed True if alt is pressed, false otherwise. | * @param isAltPressed True if alt is pressed, false otherwise. | |||
* @param isMetaPressed True if meta is pressed, false otherwise. | * @param isMetaPressed True if meta is pressed, false otherwise. | |||
* @param type The type of the mouse event. | * @param type The type of the mouse event. | |||
* @param button The button of the mouse event. | * @param button The button of the mouse event. | |||
* @param x The x coordinate of the event relative to the source wi dget. | * @param x The x coordinate of the event relative to the source wi dget. | |||
* @param y The y coordinate of the event relative the source widge t. | * @param y The y coordinate of the event relative the source widge t. | |||
* @param clickCount The number of clicks generated with the same b utton. | * @param clickCount The number of clicks generated with the same b utton. | |||
* It's set to zero if another button is used. | * It's set to zero if another button is used. | |||
*/ | */ | |||
MouseEvent(Widget* source, | MouseEvent(Widget* source, | |||
Widget* distributor, | ||||
bool isShiftPressed, | bool isShiftPressed, | |||
bool isControlPressed, | bool isControlPressed, | |||
bool isAltPressed, | bool isAltPressed, | |||
bool isMetaPressed, | bool isMetaPressed, | |||
unsigned int type, | unsigned int type, | |||
unsigned int button, | unsigned int button, | |||
int x, | int x, | |||
int y, | int y, | |||
int clickCount); | int clickCount); | |||
skipping to change at line 138 | skipping to change at line 140 | |||
* | * | |||
* @return The type of the event. | * @return The type of the event. | |||
*/ | */ | |||
unsigned int getType() const; | unsigned int getType() const; | |||
/** | /** | |||
* Mouse event types. | * Mouse event types. | |||
*/ | */ | |||
enum | enum | |||
{ | { | |||
MOVED = 0, | Moved = 0, | |||
PRESSED, | Pressed, | |||
RELEASED, | Released, | |||
WHEEL_MOVED_DOWN, | WheelMovedDown, | |||
WHEEL_MOVED_UP, | WheelMovedUp, | |||
CLICKED, | Clicked, | |||
ENTERED, | Entered, | |||
EXITED, | Exited, | |||
DRAGGED | Dragged | |||
}; | }; | |||
/** | /** | |||
* Mouse button types. | * Mouse button types. | |||
*/ | */ | |||
enum | enum | |||
{ | { | |||
EMPTY = 0, | Empty = 0, | |||
LEFT, | Left, | |||
RIGHT, | Right, | |||
MIDDLE | Middle | |||
}; | }; | |||
protected: | protected: | |||
/** | /** | |||
* Holds the type of the mouse event. | * Holds the type of the mouse event. | |||
*/ | */ | |||
unsigned int mType; | unsigned int mType; | |||
/** | /** | |||
* Holds the button of the mouse event. | * Holds the button of the mouse event. | |||
End of changes. 4 change blocks. | ||||
14 lines changed or deleted | 16 lines changed or added | |||
mouseinput.hpp | mouseinput.hpp | |||
---|---|---|---|---|
skipping to change at line 188 | skipping to change at line 188 | |||
* @since 0.6.0 | * @since 0.6.0 | |||
*/ | */ | |||
int getY() const; | int getY() const; | |||
/** | /** | |||
* Mouse input event types. This enum partially corresponds | * Mouse input event types. This enum partially corresponds | |||
* to the enum with event types in MouseEvent for easy mapping. | * to the enum with event types in MouseEvent for easy mapping. | |||
*/ | */ | |||
enum | enum | |||
{ | { | |||
MOVED = 0, | Moved = 0, | |||
PRESSED, | Pressed, | |||
RELEASED, | Released, | |||
WHEEL_MOVED_DOWN, | WheelMovedDown, | |||
WHEEL_MOVED_UP | WheelMovedUp | |||
}; | }; | |||
/** | /** | |||
* Mouse button types. | * Mouse button types. | |||
*/ | */ | |||
enum | enum | |||
{ | { | |||
EMPTY = 0, | Empty = 0, | |||
LEFT, | Left, | |||
RIGHT, | Right, | |||
MIDDLE | Middle | |||
}; | }; | |||
protected: | protected: | |||
/** | /** | |||
* Holds the type of the mouse input. | * Holds the type of the mouse input. | |||
*/ | */ | |||
unsigned int mType; | unsigned int mType; | |||
/** | /** | |||
* Holds the button of the mouse input. | * Holds the button of the mouse input. | |||
End of changes. 2 change blocks. | ||||
9 lines changed or deleted | 9 lines changed or added | |||
openglgraphics.hpp | openglgraphics.hpp | |||
---|---|---|---|---|
skipping to change at line 94 | skipping to change at line 94 | |||
/** | /** | |||
* Sets the target plane on where to draw. | * Sets the target plane on where to draw. | |||
* | * | |||
* @param width the width of the logical drawing surface. Sh ould be the | * @param width the width of the logical drawing surface. Sh ould be the | |||
* same as the screen resolution. | * same as the screen resolution. | |||
* @param height the height ot the logical drawing surface. Should be | * @param height the height ot the logical drawing surface. Should be | |||
* the same as the screen resolution. | * the same as the screen resolution. | |||
*/ | */ | |||
virtual void setTargetPlane(int width, int height); | virtual void setTargetPlane(int width, int height); | |||
/** | ||||
* Gets the target plane width. | ||||
* | ||||
* @return The target plane width. | ||||
*/ | ||||
virtual int getTargetPlaneWidth() const; | ||||
/** | ||||
* Gets the target plane height. | ||||
* | ||||
* @return The target plane height. | ||||
*/ | ||||
virtual int getTargetPlaneHeight() const; | ||||
// Inherited from Graphics | // Inherited from Graphics | |||
virtual void _beginDraw(); | virtual void _beginDraw(); | |||
virtual void _endDraw(); | virtual void _endDraw(); | |||
virtual bool pushClipArea(Rectangle area); | virtual bool pushClipArea(Rectangle area); | |||
virtual void popClipArea(); | virtual void popClipArea(); | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 14 lines changed or added | |||
rectangle.hpp | rectangle.hpp | |||
---|---|---|---|---|
skipping to change at line 100 | skipping to change at line 100 | |||
/** | /** | |||
* Checks if another rectangle intersects with the rectangle. | * Checks if another rectangle intersects with the rectangle. | |||
* | * | |||
* @param rectangle Another rectangle to check for intersection. | * @param rectangle Another rectangle to check for intersection. | |||
* @return True if the rectangles intersect, false otherwise. | * @return True if the rectangles intersect, false otherwise. | |||
* @since 0.1.0 | * @since 0.1.0 | |||
*/ | */ | |||
bool isIntersecting(const Rectangle& rectangle) const; | bool isIntersecting(const Rectangle& rectangle) const; | |||
/** | /** | |||
* Checks if a point is inside the rectangle | * Checks the rectangle contains a point. | |||
* | * | |||
* @param x The x coordinate of the point. | * @param x The x coordinate of the point. | |||
* @param y The y coordinate of the point. | * @param y The y coordinate of the point. | |||
* @return True if the point is inside the rectangle. | * @return True if the rectangle contains the point, | |||
* @since 0.1.0 | * false otherwise. | |||
* @since 0.9.0 | ||||
*/ | ||||
bool isContaining(int x, int y) const; | ||||
/** | ||||
* Checks if the rectangle contains a rectangle. | ||||
* | ||||
* @param other The rectangle to check. | ||||
* @return True if the rectangle contains the rectangle, | ||||
* false otherwise. | ||||
* @since 0.9.0 | ||||
*/ | ||||
bool isContaining(const Rectangle& other) const; | ||||
/** | ||||
* Checks whether the rectangle is empty or not. A rectangle | ||||
* is considered empty when it's width or height is either | ||||
* zero or negative. | ||||
* | ||||
* @return True if the rectangle is empty, false otherwise. | ||||
*/ | ||||
bool isEmpty() const; | ||||
/** | ||||
* Adds a rectangle to this rectangle. The resulting rectangle | ||||
* is the union of the two rectangles. | ||||
* | ||||
* @param rh The rectangle to add. | ||||
* @return The union of the two rectangles. | ||||
*/ | ||||
Rectangle operator+(const Rectangle& rh) const; | ||||
/** | ||||
* Adds a rectangle to this rectangle. This rectangle will be | ||||
* the union of the two rectangles. | ||||
* | ||||
* @param rh The rectangle to add. | ||||
* @return A reference to this rectangle. | ||||
*/ | ||||
const Rectangle& operator+=(const Rectangle& rh); | ||||
/** | ||||
* Gets the intersection between two rectangles. | ||||
* | ||||
* @param rh The rectangle to calculate the intersection with. | ||||
* @return The intersection between two rectangles. | ||||
*/ | */ | |||
bool isPointInRect(int x, int y) const; | Rectangle intersection(const Rectangle& rh) const; | |||
/** | /** | |||
* Output operator for output. | * Output operator for output. | |||
* | * | |||
* @param out The stream to output to. | * @param out The stream to output to. | |||
* @param rectangle The rectangle to output. | * @param rectangle The rectangle to output. | |||
*/ | */ | |||
friend std::ostream& operator<<(std::ostream& out, | friend std::ostream& operator<<(std::ostream& out, | |||
const Rectangle& rectangle); | const Rectangle& rectangle); | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 50 lines changed or added | |||
scrollarea.hpp | scrollarea.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_SCROLLAREA_HPP | #ifndef GCN_SCROLLAREA_HPP | |||
#define GCN_SCROLLAREA_HPP | #define GCN_SCROLLAREA_HPP | |||
#include <string> | #include <string> | |||
#include "guichan/basiccontainer.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 | |||
{ | { | |||
/** | /** | |||
* Implementation if a scrollable area used to view widgets larger than the scroll area. | * Implementation if a scrollable area used to view widgets larger than the scroll area. | |||
* A scroll area can be customized to always show scroll bars or to sho w them only when | * A scroll area can be customized to always show scroll bars or to sho w them only when | |||
* necessary. | * necessary. | |||
*/ | */ | |||
class GCN_CORE_DECLSPEC ScrollArea: | class GCN_CORE_DECLSPEC ScrollArea: | |||
public BasicContainer, | public MouseListener, | |||
public MouseListener | public Widget | |||
{ | { | |||
public: | public: | |||
/** | /** | |||
* Scrollpolicies for the horizontal and vertical scrollbar. | * Scrollpolicies for the horizontal and vertical scrollbar. | |||
* The policies are: | * The policies are: | |||
* | * | |||
* SHOW_ALWAYS - Always show the scrollbars no matter what. | * SHOW_ALWAYS - Always show the scrollbars no matter what. | |||
* SHOW_NEVER - Never show the scrollbars no matter waht. | * SHOW_NEVER - Never show the scrollbars no matter waht. | |||
* SHOW_AUTO - Show the scrollbars only when needed. That is if t he | * SHOW_AUTO - Show the scrollbars only when needed. That is if t he | |||
* content grows larger then the ScrollArea. | * content grows larger then the ScrollArea. | |||
*/ | */ | |||
enum ScrollPolicy | enum ScrollPolicy | |||
{ | { | |||
SHOW_ALWAYS = 0, | ShowAlways = 0, | |||
SHOW_NEVER, | ShowNever, | |||
SHOW_AUTO | ShowAuto | |||
}; | }; | |||
/** | /** | |||
* Constructor. | * Constructor. | |||
*/ | */ | |||
ScrollArea(); | ScrollArea(); | |||
/** | /** | |||
* Constructor. | * Constructor. | |||
* | * | |||
skipping to change at line 124 | skipping to change at line 124 | |||
* | * | |||
* @param widget The content of the scroll area. | * @param widget The content of the scroll area. | |||
*/ | */ | |||
void setContent(Widget* widget); | void setContent(Widget* widget); | |||
/** | /** | |||
* Gets the content. | * Gets the content. | |||
* | * | |||
* @return The content of the scroll area. | * @return The content of the scroll area. | |||
*/ | */ | |||
Widget* getContent(); | Widget* getContent() const; | |||
/** | /** | |||
* Sets the horizontal scrollbar policy. See enum with policies. | * Sets the horizontal scrollbar policy. See enum with policies. | |||
* | * | |||
* @param hPolicy The policy for the horizontal scrollbar. | * @param hPolicy The policy for the horizontal scrollbar. | |||
* @see getHorizontalScrollPolicy | * @see getHorizontalScrollPolicy | |||
*/ | */ | |||
void setHorizontalScrollPolicy(ScrollPolicy hPolicy); | void setHorizontalScrollPolicy(ScrollPolicy hPolicy); | |||
/** | /** | |||
End of changes. 5 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added | |||
slider.hpp | slider.hpp | |||
---|---|---|---|---|
skipping to change at line 74 | skipping to change at line 74 | |||
public KeyListener | public KeyListener | |||
{ | { | |||
public: | public: | |||
/** | /** | |||
* Draw orientations for the slider. A slider can be drawn vertical ly or | * Draw orientations for the slider. A slider can be drawn vertical ly or | |||
* horizontally. | * horizontally. | |||
*/ | */ | |||
enum Orientation | enum Orientation | |||
{ | { | |||
HORIZONTAL = 0, | Horizontal = 0, | |||
VERTICAL | Vertical | |||
}; | }; | |||
/** | /** | |||
* Constructor. The default start value of the slider scale is zero . | * Constructor. The default start value of the slider scale is zero . | |||
* | * | |||
* @param scaleEnd The end value of the slider scale. | * @param scaleEnd The end value of the slider scale. | |||
*/ | */ | |||
Slider(double scaleEnd = 1.0); | Slider(double scaleEnd = 1.0); | |||
/** | /** | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
tab.hpp | tab.hpp | |||
---|---|---|---|---|
skipping to change at line 50 | skipping to change at line 50 | |||
* 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_TAB_HPP | #ifndef GCN_TAB_HPP | |||
#define GCN_TAB_HPP | #define GCN_TAB_HPP | |||
#include <map> | #include <map> | |||
#include <string> | #include <string> | |||
#include "guichan/basiccontainer.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 Label; | class Label; | |||
class TabbedArea; | class TabbedArea; | |||
/** | /** | |||
* An implementation of a simple tab to be used in a tabbed area. | * An implementation of a simple tab to be used in a tabbed area. | |||
* | * | |||
* @see TabbedArea | * @see TabbedArea | |||
* @since 0.8.0 | * @since 0.8.0 | |||
*/ | */ | |||
class GCN_CORE_DECLSPEC Tab: | class GCN_CORE_DECLSPEC Tab: | |||
public BasicContainer, | public MouseListener, | |||
public MouseListener | public Widget | |||
{ | { | |||
public: | public: | |||
/** | /** | |||
* Constructor. | * Constructor. | |||
*/ | */ | |||
Tab(); | Tab(); | |||
/** | /** | |||
* Destructor. | * Destructor. | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 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 | |||
textbox.hpp | textbox.hpp | |||
---|---|---|---|---|
skipping to change at line 58 | skipping to change at line 58 | |||
#include <string> | #include <string> | |||
#include <vector> | #include <vector> | |||
#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" | |||
namespace gcn | namespace gcn | |||
{ | { | |||
class Text; | ||||
/** | /** | |||
* An implementation of a text box where a user can enter text that con tains of many lines. | * An implementation of a text box where a user can enter text that con tains of many lines. | |||
*/ | */ | |||
class GCN_CORE_DECLSPEC TextBox: | class GCN_CORE_DECLSPEC TextBox: | |||
public Widget, | public Widget, | |||
public MouseListener, | public MouseListener, | |||
public KeyListener | public KeyListener | |||
{ | { | |||
public: | public: | |||
/** | /** | |||
skipping to change at line 102 | skipping to change at line 104 | |||
*/ | */ | |||
std::string getText() const; | std::string getText() const; | |||
/** | /** | |||
* Gets a certain row from the text. | * Gets a certain row from the text. | |||
* | * | |||
* @param row The number of the row to get from the text. | * @param row The number of the row to get from the text. | |||
* @return A row from the text of the text box. | * @return A row from the text of the text box. | |||
* @see setTextRow | * @see setTextRow | |||
*/ | */ | |||
const std::string& getTextRow(int row) const; | std::string getTextRow(int row) const; | |||
/** | /** | |||
* Sets the text of a certain row of the text. | * Sets the text of a certain row of the text. | |||
* | * | |||
* @param row The number of the row to set in the text. | * @param row The number of the row to set in the text. | |||
* @param text The text to set in the given row number. | * @param text The text to set in the given row number. | |||
* @see getTextRow | * @see getTextRow | |||
*/ | */ | |||
void setTextRow(int row, const std::string& text); | void setTextRow(int row, const std::string& text); | |||
skipping to change at line 205 | skipping to change at line 207 | |||
* | * | |||
* @param editable True if the text box should be editable, false o therwise. | * @param editable True if the text box should be editable, false o therwise. | |||
*/ | */ | |||
void setEditable(bool editable); | void setEditable(bool editable); | |||
/** | /** | |||
* Adds a row of text to the end of the text. | * Adds a row of text to the end of the text. | |||
* | * | |||
* @param row The row to add. | * @param row The row to add. | |||
*/ | */ | |||
virtual void addRow(const std::string row); | virtual void addRow(const std::string &row); | |||
/** | /** | |||
* Checks if the text box is opaque. An opaque text box will draw | * Checks if the text box is opaque. An opaque text box will draw | |||
* it's background and it's text. A non opaque text box only draw i t's | * it's background and it's text. A non opaque text box only draw i t's | |||
* text making it transparent. | * text making it transparent. | |||
* | * | |||
* @return True if the text box is opaque, false otherwise. | * @return True if the text box is opaque, false otherwise. | |||
* @see setOpaque | * @see setOpaque | |||
*/ | */ | |||
bool isOpaque(); | bool isOpaque(); | |||
skipping to change at line 260 | skipping to change at line 262 | |||
* @param y the y position. | * @param y the y position. | |||
*/ | */ | |||
virtual void drawCaret(Graphics* graphics, int x, int y); | virtual void drawCaret(Graphics* graphics, int x, int y); | |||
/** | /** | |||
* Adjusts the text box's size to fit the text. | * Adjusts the text box's size to fit the text. | |||
*/ | */ | |||
virtual void adjustSize(); | virtual void adjustSize(); | |||
/** | /** | |||
* Holds all the rows of the text. | * Holds the text of the text box. | |||
*/ | ||||
std::vector<std::string> mTextRows; | ||||
/** | ||||
* Holds the current column of the caret. | ||||
*/ | ||||
int mCaretColumn; | ||||
/** | ||||
* Holds the current row of the caret. | ||||
*/ | */ | |||
int mCaretRow; | Text* mText; | |||
/** | /** | |||
* True if the text box is editable, false otherwise. | * True if the text box is editable, false otherwise. | |||
*/ | */ | |||
bool mEditable; | bool mEditable; | |||
/** | /** | |||
* True if the text box is editable, false otherwise. | * True if the text box is editable, false otherwise. | |||
*/ | */ | |||
bool mOpaque; | bool mOpaque; | |||
End of changes. 5 change blocks. | ||||
14 lines changed or deleted | 6 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 | |||
window.hpp | window.hpp | |||
---|---|---|---|---|
skipping to change at line 144 | skipping to change at line 144 | |||
* @see getTitleBarHeight | * @see getTitleBarHeight | |||
*/ | */ | |||
void setTitleBarHeight(unsigned int height); | void setTitleBarHeight(unsigned int height); | |||
/** | /** | |||
* Gets the title bar height. | * Gets the title bar height. | |||
* | * | |||
* @return The title bar height. | * @return The title bar height. | |||
* @see setTitleBarHeight | * @see setTitleBarHeight | |||
*/ | */ | |||
unsigned int getTitleBarHeight(); | unsigned int getTitleBarHeight() const; | |||
/** | /** | |||
* Sets the window to be moveble or not. | * Sets the window to be moveble or not. | |||
* | * | |||
* @param movable True if the window should be movable, false other wise. | * @param movable True if the window should be movable, false other wise. | |||
* @see isMovable | * @see isMovable | |||
*/ | */ | |||
void setMovable(bool movable); | void setMovable(bool movable); | |||
/** | /** | |||
skipping to change at line 177 | skipping to change at line 177 | |||
* @see isOpaque | * @see isOpaque | |||
*/ | */ | |||
void setOpaque(bool opaque); | void setOpaque(bool opaque); | |||
/** | /** | |||
* Checks if the window is opaque. | * Checks if the window is opaque. | |||
* | * | |||
* @return True if the window is opaque, false otherwise. | * @return True if the window is opaque, false otherwise. | |||
* @see setOpaque | * @see setOpaque | |||
*/ | */ | |||
bool isOpaque(); | bool isOpaque() const; | |||
/** | /** | |||
* Resizes the window to fit the content. | * Resizes the window to fit the content. | |||
*/ | */ | |||
virtual void resizeToContent(); | virtual void resizeToContent(); | |||
// Inherited from BasicContainer | // Inherited from BasicContainer | |||
virtual Rectangle getChildrenArea(); | virtual Rectangle getChildrenArea(); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||