Merged from 1.5 branch to trunk, all changes from 2088 to 2120. Mainly doc updates. Fix for non-skinned animated meshes with different current frames.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2121 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2009-01-22 12:40:06 +00:00
parent 2c203d8401
commit ca8f261819
63 changed files with 493 additions and 440 deletions

View File

@ -186,3 +186,5 @@ int main()
return 0; return 0;
} }
/*
**/

View File

@ -290,3 +290,6 @@ int main()
return 0; return 0;
} }
/*
**/

View File

@ -44,10 +44,10 @@ namespace gui
virtual void setSelected(s32 idx) = 0; virtual void setSelected(s32 idx) = 0;
//! Sets text justification of the text area //! Sets text justification of the text area
/** \param horizontal: EGUIA_UPPERLEFT for left justified (default), /** \param horizontal: EGUIA_UPPERLEFT for left justified (default),
EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text. EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text.
\param vertical: EGUIA_UPPERLEFT to align with top edge, \param vertical: EGUIA_UPPERLEFT to align with top edge,
EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */ EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0; virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0;
}; };

View File

@ -36,9 +36,7 @@ namespace gui
\param checked: Specifies if the menu item should be initially checked. \param checked: Specifies if the menu item should be initially checked.
\return Returns the index of the new item */ \return Returns the index of the new item */
virtual u32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true, virtual u32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true,
bool hasSubMenu=false, bool hasSubMenu=false, bool checked=false) = 0;
bool checked=false
) = 0;
//! Adds a separator item to the menu //! Adds a separator item to the menu
virtual void addSeparator() = 0; virtual void addSeparator() = 0;

View File

@ -61,7 +61,7 @@ namespace gui
virtual void setWordWrap(bool enable) = 0; virtual void setWordWrap(bool enable) = 0;
//! Checks if word wrap is enabled //! Checks if word wrap is enabled
//! \return true if word wrap is enabled, false otherwise /** \return true if word wrap is enabled, false otherwise */
virtual bool isWordWrapEnabled() const = 0; virtual bool isWordWrapEnabled() const = 0;
//! Enables or disables newlines. //! Enables or disables newlines.
@ -70,15 +70,15 @@ namespace gui
virtual void setMultiLine(bool enable) = 0; virtual void setMultiLine(bool enable) = 0;
//! Checks if multi line editing is enabled //! Checks if multi line editing is enabled
//! \return true if mult-line is enabled, false otherwise /** \return true if mult-line is enabled, false otherwise */
virtual bool isMultiLineEnabled() const = 0; virtual bool isMultiLineEnabled() const = 0;
//! Enables or disables automatic scrolling with cursor position //! Enables or disables automatic scrolling with cursor position
//! \param enable: If set to true, the text will move around with the cursor position /** \param enable: If set to true, the text will move around with the cursor position */
virtual void setAutoScroll(bool enable) = 0; virtual void setAutoScroll(bool enable) = 0;
//! Checks to see if automatic scrolling is enabled //! Checks to see if automatic scrolling is enabled
//! \return true if automatic scrolling is enabled, false if not /** \return true if automatic scrolling is enabled, false if not */
virtual bool isAutoScrollEnabled() const = 0; virtual bool isAutoScrollEnabled() const = 0;
//! Sets whether the edit box is a password box. Setting this to true will //! Sets whether the edit box is a password box. Setting this to true will
@ -91,7 +91,7 @@ namespace gui
virtual bool isPasswordBox() const = 0; virtual bool isPasswordBox() const = 0;
//! Gets the size area of the text in the edit box //! Gets the size area of the text in the edit box
//! \return Returns the size in pixels of the text /** \return The size in pixels of the text */
virtual core::dimension2du getTextDimension() = 0; virtual core::dimension2du getTextDimension() = 0;
//! Sets the maximum amount of characters which may be entered in the box. //! Sets the maximum amount of characters which may be entered in the box.

View File

@ -83,7 +83,7 @@ public:
//! Sets the relative rectangle of this element. //! Sets the relative rectangle of this element.
/** \param r The absolute position to set */ /** \param r The absolute position to set */
void setRelativePosition(const core::rect<s32>& r) void setRelativePosition(const core::rect<s32>& r)
{ {
if (Parent) if (Parent)
@ -107,12 +107,12 @@ public:
} }
//! Sets the relative rectangle of this element, maintaining its current width and height //! Sets the relative rectangle of this element, maintaining its current width and height
/** \param position The new relative position to set. Width and height will not be changed. */ /** \param position The new relative position to set. Width and height will not be changed. */
void setRelativePosition(const core::position2di & position) void setRelativePosition(const core::position2di & position)
{ {
const core::dimension2di mySize = RelativeRect.getSize(); const core::dimension2di mySize = RelativeRect.getSize();
const core::rect<s32> rectangle(position.X, position.Y, const core::rect<s32> rectangle(position.X, position.Y,
position.X + mySize.Width, position.Y + mySize.Height); position.X + mySize.Width, position.Y + mySize.Height);
setRelativePosition(rectangle); setRelativePosition(rectangle);
} }
@ -156,7 +156,7 @@ public:
//! Sets whether the element will ignore its parent's clipping rectangle //! Sets whether the element will ignore its parent's clipping rectangle
/** \param noClip If true, the element will not be clipped by its parent's clipping rectangle. */ /** \param noClip If true, the element will not be clipped by its parent's clipping rectangle. */
void setNotClipped(bool noClip) void setNotClipped(bool noClip)
{ {
NoClip = noClip; NoClip = noClip;
@ -222,7 +222,6 @@ public:
{ {
core::rect<s32> parentAbsolute(0,0,0,0); core::rect<s32> parentAbsolute(0,0,0,0);
core::rect<s32> parentAbsoluteClip; core::rect<s32> parentAbsoluteClip;
s32 diffx, diffy;
f32 fw=0.f, fh=0.f; f32 fw=0.f, fh=0.f;
if (Parent) if (Parent)
@ -240,8 +239,8 @@ public:
parentAbsoluteClip = Parent->AbsoluteClippingRect; parentAbsoluteClip = Parent->AbsoluteClippingRect;
} }
diffx = parentAbsolute.getWidth() - LastParentRect.getWidth(); const s32 diffx = parentAbsolute.getWidth() - LastParentRect.getWidth();
diffy = parentAbsolute.getHeight() - LastParentRect.getHeight(); const s32 diffy = parentAbsolute.getHeight() - LastParentRect.getHeight();
if (AlignLeft == EGUIA_SCALE || AlignRight == EGUIA_SCALE) if (AlignLeft == EGUIA_SCALE || AlignRight == EGUIA_SCALE)
fw = (f32)parentAbsolute.getWidth(); fw = (f32)parentAbsolute.getWidth();
@ -345,7 +344,18 @@ public:
} }
//! Returns the child element, which is at the position of the point. //! Returns the topmost GUI element at the specific position.
/**
This will check this GUI element and all of its descendants, so it
may return this GUI element. To check all GUI elements, call this
function on device->getGUIEnvironment()->getRootGUIElement(). Note
that the root element is the size of the screen, so doing so (with
an on-screen point) will always return the root element if no other
element is above it at that point.
\param point: The point at which to find a GUI element.
\return The topmost GUI element at that point, or 0 if there are
no candidate elements at this point.
*/
IGUIElement* getElementFromPoint(const core::position2d<s32>& point) IGUIElement* getElementFromPoint(const core::position2d<s32>& point)
{ {
IGUIElement* target = 0; IGUIElement* target = 0;
@ -356,6 +366,7 @@ public:
core::list<IGUIElement*>::Iterator it = Children.getLast(); core::list<IGUIElement*>::Iterator it = Children.getLast();
if (IsVisible) if (IsVisible)
{
while(it != Children.end()) while(it != Children.end())
{ {
target = (*it)->getElementFromPoint(point); target = (*it)->getElementFromPoint(point);
@ -364,6 +375,7 @@ public:
--it; --it;
} }
}
if (IsVisible && isPointInside(point)) if (IsVisible && isPointInside(point))
target = this; target = this;
@ -373,12 +385,13 @@ public:
//! Returns true if a point is within this element. //! Returns true if a point is within this element.
//! Elements with a shape other than a rectangle will override this method /** Elements with a shape other than a rectangle should override this method */
virtual bool isPointInside(const core::position2d<s32>& point) const virtual bool isPointInside(const core::position2d<s32>& point) const
{ {
return AbsoluteClippingRect.isPointInside(point); return AbsoluteClippingRect.isPointInside(point);
} }
//! Adds a GUI element as new child of this element. //! Adds a GUI element as new child of this element.
virtual void addChild(IGUIElement* child) virtual void addChild(IGUIElement* child)
{ {
@ -470,19 +483,18 @@ public:
} }
//! Sets whether this control was created as part of its parent, //! Sets whether this control was created as part of its parent.
//! for example when a scrollbar is part of a listbox. /** For example, it is true when a scrollbar is part of a listbox.
//! SubElements are not saved to disk when calling guiEnvironment->saveGUI() SubElements are not saved to disk when calling guiEnvironment->saveGUI() */
virtual void setSubElement(bool subElement) virtual void setSubElement(bool subElement)
{ {
IsSubElement = subElement; IsSubElement = subElement;
} }
//! If set to true, the focus will visit this element when using //! If set to true, the focus will visit this element when using the tab key to cycle through elements.
//! the tab key to cycle through elements. /** If this element is a tab group (see isTabGroup/setTabGroup) then
//! If this element is a tab group (see isTabGroup/setTabGroup) then ctrl+tab will be used instead. */
//! ctrl+tab will be used instead.
void setTabStop(bool enable) void setTabStop(bool enable)
{ {
IsTabStop = enable; IsTabStop = enable;
@ -497,9 +509,9 @@ public:
} }
//! Sets the priority of focus when using the tab key to navigate between a group //! Sets the priority of focus when using the tab key to navigate between a group of elements.
//! of elements. See setTabGroup, isTabGroup and getTabGroup for information on tab groups. /** See setTabGroup, isTabGroup and getTabGroup for information on tab groups.
//! Elements with a lower number are focused first Elements with a lower number are focused first */
void setTabOrder(s32 index) void setTabOrder(s32 index)
{ {
// negative = autonumber // negative = autonumber
@ -534,9 +546,9 @@ public:
} }
//! Sets whether this element is a container for a group of elements which //! Sets whether this element is a container for a group of elements which can be navigated using the tab key.
//! can be navigated using the tab key. For example, windows are tab groups. /** For example, windows are tab groups.
//! Groups can be navigated using ctrl+tab, providing isTabStop is true. Groups can be navigated using ctrl+tab, providing isTabStop is true. */
void setTabGroup(bool isGroup) void setTabGroup(bool isGroup)
{ {
IsTabGroup = isGroup; IsTabGroup = isGroup;
@ -551,8 +563,7 @@ public:
} }
//! Returns the container element which holds all elements in this element's //! Returns the container element which holds all elements in this element's tab group.
//! tab group.
IGUIElement* getTabGroup() IGUIElement* getTabGroup()
{ {
IGUIElement *ret=this; IGUIElement *ret=this;
@ -629,7 +640,7 @@ public:
//! Brings a child to front //! Brings a child to front
/** \return Returns true if successful, false if not. */ /** \return True if successful, false if not. */
virtual bool bringToFront(IGUIElement* element) virtual bool bringToFront(IGUIElement* element)
{ {
core::list<IGUIElement*>::Iterator it = Children.begin(); core::list<IGUIElement*>::Iterator it = Children.begin();
@ -702,13 +713,13 @@ public:
//! searches elements to find the closest next element to tab to //! searches elements to find the closest next element to tab to
//! \param startOrder: The TabOrder of the current element, -1 if none /** \param startOrder: The TabOrder of the current element, -1 if none
//! \param reverse: true if searching for a lower number \param reverse: true if searching for a lower number
//! \param group: true if searching for a higher one \param group: true if searching for a higher one
//! \param first: element with the highest/lowest known tab order depending on search direction \param first: element with the highest/lowest known tab order depending on search direction
//! \param closest: the closest match, depending on tab order and direction \param closest: the closest match, depending on tab order and direction
//! \param includeInvisible: includes invisible elements in the search (default=false) \param includeInvisible: includes invisible elements in the search (default=false)
//! \return true if successfully found an element, false to continue searching/fail \return true if successfully found an element, false to continue searching/fail */
bool getNextElement(s32 startOrder, bool reverse, bool group, bool getNextElement(s32 startOrder, bool reverse, bool group,
IGUIElement*& first, IGUIElement*& closest, bool includeInvisible=false) const IGUIElement*& first, IGUIElement*& closest, bool includeInvisible=false) const
{ {
@ -805,8 +816,8 @@ public:
//! Writes attributes of the scene node. //! Writes attributes of the scene node.
//! Implement this to expose the attributes of your scene node for /** Implement this to expose the attributes of your scene node for
//! scripting languages, editors, debuggers or xml serialization purposes. scripting languages, editors, debuggers or xml serialization purposes. */
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{ {
out->addInt("Id", ID ); out->addInt("Id", ID );
@ -828,8 +839,8 @@ public:
//! Reads attributes of the scene node. //! Reads attributes of the scene node.
//! Implement this to set the attributes of your scene node for /** Implement this to set the attributes of your scene node for
//! scripting languages, editors, debuggers or xml deserialization purposes. scripting languages, editors, debuggers or xml deserialization purposes. */
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{ {
setID(in->getAttributeAsInt("Id")); setID(in->getAttributeAsInt("Id"));

View File

@ -62,8 +62,7 @@ class IGUIEnvironment : public virtual IReferenceCounted
{ {
public: public:
//! Draws all gui elements by traversing the GUI environment starting //! Draws all gui elements by traversing the GUI environment starting at the root node.
//! at the root node.
virtual void drawAll() = 0; virtual void drawAll() = 0;
//! Sets the focus to an element. //! Sets the focus to an element.
@ -173,10 +172,10 @@ public:
virtual IGUISpriteBank* addEmptySpriteBank(const c8 *name) = 0; virtual IGUISpriteBank* addEmptySpriteBank(const c8 *name) = 0;
//! Returns the root gui element. //! Returns the root gui element.
/** This is the first gui element, parent of all other /** This is the first gui element, the (direct or indirect) parent of all
gui elements. You'll never need to use this method, unless you are other gui elements. It is a valid IGUIElement, with dimensions the same
creating your own gui elements, trying to add them to the gui elements size as the screen. You should not need to use this method directly, unless
without a parent. you wish to reparent GUI elements to the top level.
\return Pointer to the root element of the GUI. The returned pointer \return Pointer to the root element of the GUI. The returned pointer
should not be dropped. See IReferenceCounted::drop() for more should not be dropped. See IReferenceCounted::drop() for more
information. */ information. */
@ -209,7 +208,7 @@ public:
const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0; const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a modal screen. //! Adds a modal screen.
/** This control stops its parent's members from being able to recieve /** This control stops its parent's members from being able to receive
input until its last child is removed, it then deletes itself. input until its last child is removed, it then deletes itself.
\param parent Parent gui element of the modal. \param parent Parent gui element of the modal.
\return Pointer to the created modal. Returns 0 if an error occured. \return Pointer to the created modal. Returns 0 if an error occured.
@ -475,7 +474,7 @@ public:
\return Pointer to the created table. Returns 0 if an error occured. \return Pointer to the created table. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */ more information. */
virtual IGUITable* addTable(const core::rect<s32>& rectangle, virtual IGUITable* addTable(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, bool drawBackground = false) = 0; IGUIElement* parent=0, s32 id=-1, bool drawBackground = false) = 0;
//! Returns the default element factory which can create all built in elements //! Returns the default element factory which can create all built in elements

View File

@ -21,13 +21,13 @@ enum EGUI_FONT_TYPE
EGFT_BITMAP = 0, EGFT_BITMAP = 0,
//! Scalable vector fonts loaded from an XML file. //! Scalable vector fonts loaded from an XML file.
//! These fonts reside in system memory and use no video memory /** These fonts reside in system memory and use no video memory
//! until they are displayed. These are slower than bitmap fonts until they are displayed. These are slower than bitmap fonts
//! but can be easily scaled and rotated. but can be easily scaled and rotated. */
EGFT_VECTOR, EGFT_VECTOR,
//! A font which uses a the native API provided by the operating system. //! A font which uses a the native API provided by the operating system.
//! Currently not used. /** Currently not used. */
EGFT_OS, EGFT_OS,
//! An external font type provided by the user. //! An external font type provided by the user.
@ -66,8 +66,10 @@ public:
//! Returns the type of this font //! Returns the type of this font
virtual EGUI_FONT_TYPE getType() const { return EGFT_CUSTOM; } virtual EGUI_FONT_TYPE getType() const { return EGFT_CUSTOM; }
//! Sets global kerning for the font. //! Sets global kerning width for the font.
virtual void setKerningWidth (s32 kerning) = 0; virtual void setKerningWidth (s32 kerning) = 0;
//! Sets global kerning height for the font.
virtual void setKerningHeight (s32 kerning) = 0; virtual void setKerningHeight (s32 kerning) = 0;
//! Gets kerning values (distance between letters) for the font. If no parameters are provided, //! Gets kerning values (distance between letters) for the font. If no parameters are provided,

View File

@ -36,22 +36,23 @@ namespace gui
virtual video::SColor getColor() const = 0; virtual video::SColor getColor() const = 0;
//! Sets the color to fade out to or to fade in from. //! Sets the color to fade out to or to fade in from.
//! \param color: Color to where it is faded out od from it is faded in. /** \param color: Color to where it is faded out od from it is faded in. */
virtual void setColor(video::SColor color) = 0; virtual void setColor(video::SColor color) = 0;
virtual void setColor(video::SColor source, video::SColor dest) = 0; virtual void setColor(video::SColor source, video::SColor dest) = 0;
//! Starts the fade in process. In the beginning the whole rect is drawn by //! Starts the fade in process.
//! the set color (black by default) and at the end of the overgiven /** In the beginning the whole rect is drawn by the set color
//! time the color has faded out. (black by default) and at the end of the overgiven time the
//! \param time: Time specifing how long it should need to fade in, color has faded out.
//! in milliseconds. \param time: Time specifing how long it should need to fade in,
in milliseconds. */
virtual void fadeIn(u32 time) = 0; virtual void fadeIn(u32 time) = 0;
//! Starts the fade out process. In the beginning everything is visible, //! Starts the fade out process.
//! and at the end of the time only the set color (black by the fault) /** In the beginning everything is visible, and at the end of
//! will be drawn. the time only the set color (black by the fault) will be drawn.
//! \param time: Time specifing how long it should need to fade out, \param time: Time specifing how long it should need to fade out,
//! in milliseconds. in milliseconds. */
virtual void fadeOut(u32 time) = 0; virtual void fadeOut(u32 time) = 0;
//! Returns if the fade in or out process is done. //! Returns if the fade in or out process is done.

View File

@ -48,10 +48,9 @@ namespace gui
virtual u32 addItem(const wchar_t* text) = 0; virtual u32 addItem(const wchar_t* text) = 0;
//! adds an list item with an icon //! adds an list item with an icon
//! \param text Text of list entry /** \param text Text of list entry
//! \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon
//! \return \return The id of the new created item */
//! returns the id of the new created item
virtual u32 addItem(const wchar_t* text, s32 icon) = 0; virtual u32 addItem(const wchar_t* text, s32 icon) = 0;
//! Removes an item from the list //! Removes an item from the list
@ -60,10 +59,11 @@ namespace gui
//! Returns the icon of an item //! Returns the icon of an item
virtual s32 getIcon(u32 index) const = 0; virtual s32 getIcon(u32 index) const = 0;
//! Sets the sprite bank which should be used to draw list icons. This font is set to the sprite bank of //! Sets the sprite bank which should be used to draw list icons.
//! the built-in-font by default. A sprite can be displayed in front of every list item. /** This font is set to the sprite bank of the built-in-font by
//! An icon is an index within the icon sprite bank. Several default icons are available in the default. A sprite can be displayed in front of every list item.
//! skin through getIcon An icon is an index within the icon sprite bank. Several
default icons are available in the skin through getIcon. */
virtual void setSpriteBank(IGUISpriteBank* bank) = 0; virtual void setSpriteBank(IGUISpriteBank* bank) = 0;
//! clears the list, deletes all items in the listbox //! clears the list, deletes all items in the listbox
@ -75,8 +75,7 @@ namespace gui
//! sets the selected item. Set this to -1 if no item should be selected //! sets the selected item. Set this to -1 if no item should be selected
virtual void setSelected(s32 index) = 0; virtual void setSelected(s32 index) = 0;
//! set whether the listbox should scroll to show a newly selected item //! set whether the listbox should scroll to new or newly selected items
//! or a new item as it is added to the list.
virtual void setAutoScrollEnabled(bool scroll) = 0; virtual void setAutoScrollEnabled(bool scroll) = 0;
//! returns true if automatic scrolling is enabled, false if not. //! returns true if automatic scrolling is enabled, false if not.
@ -107,7 +106,7 @@ namespace gui
virtual void setItem(u32 index, const wchar_t* text, s32 icon) = 0; virtual void setItem(u32 index, const wchar_t* text, s32 icon) = 0;
//! Insert the item at the given index //! Insert the item at the given index
//! Return the index on success or -1 on failure. /** \return The index on success or -1 on failure. */
virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon) = 0; virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon) = 0;
//! Swap the items at the given indices //! Swap the items at the given indices

View File

@ -30,15 +30,17 @@ namespace gui
//! gets the small step value //! gets the small step value
virtual s32 getSmallStep() const = 0; virtual s32 getSmallStep() const = 0;
//! Sets the small step, the amount that the value changes by when clicking //! Sets the small step
//! on the buttons or using the cursor keys. /** That is the amount that the value changes by when clicking
on the buttons or using the cursor keys. */
virtual void setSmallStep(s32 step) = 0; virtual void setSmallStep(s32 step) = 0;
//! gets the large step value //! gets the large step value
virtual s32 getLargeStep() const = 0; virtual s32 getLargeStep() const = 0;
//! Sets the large step, the amount that the value changes by when clicking //! Sets the large step
//! in the tray, or using the page up and page down keys. /** That is the amount that the value changes by when clicking
in the tray, or using the page up and page down keys. */
virtual void setLargeStep(s32 step) = 0; virtual void setLargeStep(s32 step) = 0;
//! gets the current position of the scrollbar //! gets the current position of the scrollbar

View File

@ -514,6 +514,3 @@ namespace gui
#endif #endif

View File

@ -29,7 +29,7 @@ namespace gui
virtual void setOverrideFont(IGUIFont* font=0) = 0; virtual void setOverrideFont(IGUIFont* font=0) = 0;
//! Gets the override font (if any) //! Gets the override font (if any)
//! \return The override font (may be 0) /** \return The override font (may be 0) */
virtual IGUIFont* getOverrideFont(void) const = 0; virtual IGUIFont* getOverrideFont(void) const = 0;
//! Sets another color for the text. //! Sets another color for the text.
@ -43,7 +43,7 @@ namespace gui
virtual void setOverrideColor(video::SColor color) = 0; virtual void setOverrideColor(video::SColor color) = 0;
//! Gets the override color //! Gets the override color
//! \return: The override color /** \return: The override color */
virtual video::SColor const& getOverrideColor(void) const = 0; virtual video::SColor const& getOverrideColor(void) const = 0;
//! Sets if the static text should use the overide color or the color in the gui skin. //! Sets if the static text should use the overide color or the color in the gui skin.
@ -53,7 +53,7 @@ namespace gui
virtual void enableOverrideColor(bool enable) = 0; virtual void enableOverrideColor(bool enable) = 0;
//! Checks if an override color is enabled //! Checks if an override color is enabled
//! \return true if the override color is enabled, false otherwise /** \return true if the override color is enabled, false otherwise */
virtual bool isOverrideColorEnabled(void) const = 0; virtual bool isOverrideColorEnabled(void) const = 0;
//! Sets another color for the background. //! Sets another color for the background.
@ -78,7 +78,7 @@ namespace gui
virtual void setWordWrap(bool enable) = 0; virtual void setWordWrap(bool enable) = 0;
//! Checks if word wrap is enabled //! Checks if word wrap is enabled
//! \return true if word wrap is enabled, false otherwise /** \return true if word wrap is enabled, false otherwise */
virtual bool isWordWrapEnabled(void) const = 0; virtual bool isWordWrapEnabled(void) const = 0;
//! Returns the height of the text in pixels when it is drawn. //! Returns the height of the text in pixels when it is drawn.

View File

@ -87,7 +87,7 @@ namespace gui
virtual s32 getTabHeight() const = 0; virtual s32 getTabHeight() const = 0;
//! Set the alignment of the tabs //! Set the alignment of the tabs
//! Use EGUIA_UPPERLEFT or EGUIA_LOWERRIGHT /** Use EGUIA_UPPERLEFT or EGUIA_LOWERRIGHT */
virtual void setTabVerticalAlignment( gui::EGUI_ALIGNMENT alignment ) = 0; virtual void setTabVerticalAlignment( gui::EGUI_ALIGNMENT alignment ) = 0;
//! Get the alignment of the tabs //! Get the alignment of the tabs
@ -108,7 +108,3 @@ namespace gui
#endif #endif

View File

@ -21,7 +21,7 @@ namespace gui
//! Do not use ordering //! Do not use ordering
EGCO_NONE, EGCO_NONE,
//! Send a EGET_TABLE_HEADER_CHANGED message when a column header is clicked. //! Send a EGET_TABLE_HEADER_CHANGED message when a column header is clicked.
EGCO_CUSTOM, EGCO_CUSTOM,
//! Sort it ascending by it's ascii value like: a,b,c,... //! Sort it ascending by it's ascii value like: a,b,c,...
@ -48,7 +48,7 @@ namespace gui
0, 0,
}; };
enum EGUI_ORDERING_MODE enum EGUI_ORDERING_MODE
{ {
//! No element ordering //! No element ordering
EGOM_NONE, EGOM_NONE,
@ -111,14 +111,14 @@ namespace gui
//! Set the width of a column //! Set the width of a column
virtual void setColumnWidth(u32 columnIndex, u32 width) = 0; virtual void setColumnWidth(u32 columnIndex, u32 width) = 0;
//! columns can be resized by drag 'n drop //! columns can be resized by drag 'n drop
virtual void setResizableColumns(bool resizable) = 0; virtual void setResizableColumns(bool resizable) = 0;
//! can columns be resized by dran 'n drop? //! can columns be resized by dran 'n drop?
virtual bool hasResizableColumns() const = 0; virtual bool hasResizableColumns() const = 0;
//! This tells the table control which ordering mode should be used when a column header is clicked. //! This tells the table control which ordering mode should be used when a column header is clicked.
/** \param columnIndex The index of the column header. /** \param columnIndex The index of the column header.
\param mode: One of the modes defined in EGUI_COLUMN_ORDERING */ \param mode: One of the modes defined in EGUI_COLUMN_ORDERING */
virtual void setColumnOrdering(u32 columnIndex, EGUI_COLUMN_ORDERING mode) = 0; virtual void setColumnOrdering(u32 columnIndex, EGUI_COLUMN_ORDERING mode) = 0;

View File

@ -361,7 +361,6 @@ namespace scene
virtual gui::IGUIEnvironment* getGUIEnvironment() = 0; virtual gui::IGUIEnvironment* getGUIEnvironment() = 0;
//! adds Volume Lighting Scene Node. //! adds Volume Lighting Scene Node.
//! the returned pointer must not be dropped.
/** Example Usage: /** Example Usage:
scene::IVolumeLightSceneNode * n = smgr->addVolumeLightSceneNode(NULL, -1, scene::IVolumeLightSceneNode * n = smgr->addVolumeLightSceneNode(NULL, -1,
32, 32, //Subdivide U/V 32, 32, //Subdivide U/V
@ -373,7 +372,8 @@ namespace scene
n->setScale(core::vector3df(46.0f, 45.0f, 46.0f)); n->setScale(core::vector3df(46.0f, 45.0f, 46.0f));
n->getMaterial(0).setTexture(0, smgr->getVideoDriver()->getTexture("lightFalloff.png")); n->getMaterial(0).setTexture(0, smgr->getVideoDriver()->getTexture("lightFalloff.png"));
} }
**/ \return Pointer to the volumeLight if successful, otherwise NULL.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IVolumeLightSceneNode* addVolumeLightSceneNode(ISceneNode* parent=0, s32 id=-1, virtual IVolumeLightSceneNode* addVolumeLightSceneNode(ISceneNode* parent=0, s32 id=-1,
const u32 subdivU = 32, const u32 subdivV = 32, const u32 subdivU = 32, const u32 subdivV = 32,
const video::SColor foot = video::SColor(51, 0, 230, 180), const video::SColor foot = video::SColor(51, 0, 230, 180),
@ -514,16 +514,16 @@ namespace scene
addCameraSceneNodeFPS(). If you want to move or animate it, use animators or the addCameraSceneNodeFPS(). If you want to move or animate it, use animators or the
ISceneNode::setPosition(), ICameraSceneNode::setTarget() etc methods. ISceneNode::setPosition(), ICameraSceneNode::setTarget() etc methods.
By default, a camera's look at position (set with setTarget()) and its scene node By default, a camera's look at position (set with setTarget()) and its scene node
rotation (set with setRotation()) are independent. If you want to be able to rotation (set with setRotation()) are independent. If you want to be able to
control the direction that the camera looks by using setRotation() then call control the direction that the camera looks by using setRotation() then call
ICameraSceneNode::bindTargetAndRotation(true) on it. ICameraSceneNode::bindTargetAndRotation(true) on it.
\param position: Position of the space relative to its parent where the camera will be placed. \param position: Position of the space relative to its parent where the camera will be placed.
\param lookat: Position where the camera will look at. Also known as target. \param lookat: Position where the camera will look at. Also known as target.
\param parent: Parent scene node of the camera. Can be null. If the parent moves, \param parent: Parent scene node of the camera. Can be null. If the parent moves,
the camera will move too. the camera will move too.
\param id: id of the camera. This id can be used to identify the camera. \param id: id of the camera. This id can be used to identify the camera.
\return Pointer to interface to camera if successful, otherwise 0. \return Pointer to interface to camera if successful, otherwise 0.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0, virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0,
const core::vector3df& position = core::vector3df(0,0,0), const core::vector3df& position = core::vector3df(0,0,0),
const core::vector3df& lookat = core::vector3df(0,0,100), s32 id=-1) = 0; const core::vector3df& lookat = core::vector3df(0,0,100), s32 id=-1) = 0;
@ -929,7 +929,9 @@ namespace scene
\param height Total height of the arrow \param height Total height of the arrow
\param cylinderHeight Total height of the cylinder, should be lesser than total height \param cylinderHeight Total height of the cylinder, should be lesser than total height
\param width0 Diameter of the cylinder \param width0 Diameter of the cylinder
\param width1 Diameter of the cone's base, should be not smaller than the cylinder's diameter */ \param width1 Diameter of the cone's base, should be not smaller than the cylinder's diameter
\return Pointer to the arrow mesh if successful, otherwise 0.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IAnimatedMesh* addArrowMesh(const c8* name, virtual IAnimatedMesh* addArrowMesh(const c8* name,
video::SColor vtxColor0=0xFFFFFFFF, video::SColor vtxColor0=0xFFFFFFFF,
video::SColor vtxColor1=0xFFFFFFFF, video::SColor vtxColor1=0xFFFFFFFF,
@ -941,44 +943,50 @@ namespace scene
/** \param name Name of the mesh /** \param name Name of the mesh
\param radius Radius of the sphere \param radius Radius of the sphere
\param polyCountX Number of quads used for the horizontal tiling \param polyCountX Number of quads used for the horizontal tiling
\param polyCountY Number of quads used for the vertical tiling */ \param polyCountY Number of quads used for the vertical tiling
\return Pointer to the sphere mesh if successful, otherwise 0.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IAnimatedMesh* addSphereMesh(const c8* name, virtual IAnimatedMesh* addSphereMesh(const c8* name,
f32 radius=5.f, u32 polyCountX = 16, f32 radius=5.f, u32 polyCountX = 16,
u32 polyCountY = 16) = 0; u32 polyCountY = 16) = 0;
//! Gets the root scene node. //! Gets the root scene node.
/** This is the scene node which is parent /** This is the scene node which is parent
of all scene nodes. The root scene node is a special scene node which of all scene nodes. The root scene node is a special scene node which
only exists to manage all scene nodes. It will not be rendered and cannot only exists to manage all scene nodes. It will not be rendered and cannot
be removed from the scene. be removed from the scene.
\return Pointer to the root scene node. */ \return Pointer to the root scene node.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneNode* getRootSceneNode() = 0; virtual ISceneNode* getRootSceneNode() = 0;
//! Get the first scene node with the specified id. //! Get the first scene node with the specified id.
/** \param id: The id to search for /** \param id: The id to search for
\param start: Scene node to start from. All children of this scene \param start: Scene node to start from. All children of this scene
node are searched. If null is specified, the root scene node is node are searched. If null is specified, the root scene node is
taken. taken.
\return Pointer to the first scene node with this id, \return Pointer to the first scene node with this id,
and null if no scene node could be found. */ and null if no scene node could be found.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneNode* getSceneNodeFromId(s32 id, ISceneNode* start=0) = 0; virtual ISceneNode* getSceneNodeFromId(s32 id, ISceneNode* start=0) = 0;
//! Get the first scene node with the specified name. //! Get the first scene node with the specified name.
/** \param name: The name to search for /** \param name: The name to search for
\param start: Scene node to start from. All children of this scene \param start: Scene node to start from. All children of this scene
node are searched. If null is specified, the root scene node is node are searched. If null is specified, the root scene node is
taken. taken.
\return Pointer to the first scene node with this id, \return Pointer to the first scene node with this id,
and null if no scene node could be found. */ and null if no scene node could be found.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneNode* getSceneNodeFromName(const c8* name, ISceneNode* start=0) = 0; virtual ISceneNode* getSceneNodeFromName(const c8* name, ISceneNode* start=0) = 0;
//! Get the first scene node with the specified type. //! Get the first scene node with the specified type.
/** \param type: The type to search for /** \param type: The type to search for
\param start: Scene node to start from. All children of this scene \param start: Scene node to start from. All children of this scene
node are searched. If null is specified, the root scene node is node are searched. If null is specified, the root scene node is
taken. taken.
\return Pointer to the first scene node with this type, \return Pointer to the first scene node with this type,
and null if no scene node could be found. */ and null if no scene node could be found.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneNode* getSceneNodeFromType(scene::ESCENE_NODE_TYPE type, ISceneNode* start=0) = 0; virtual ISceneNode* getSceneNodeFromType(scene::ESCENE_NODE_TYPE type, ISceneNode* start=0) = 0;
//! Get scene nodes by type. //! Get scene nodes by type.
@ -992,13 +1000,14 @@ namespace scene
ISceneNode* start=0) = 0; ISceneNode* start=0) = 0;
//! Get the current active camera. //! Get the current active camera.
/** \return The active camera is returned. Note that this can be NULL, if there /** \return The active camera is returned. Note that this can
was no camera created yet. */ be NULL, if there was no camera created yet.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ICameraSceneNode* getActiveCamera() = 0; virtual ICameraSceneNode* getActiveCamera() = 0;
//! Sets the currently active camera. //! Sets the currently active camera.
/** The previous active camera will be deactivated. /** The previous active camera will be deactivated.
\param camera: The new camera which should be active. */ \param camera: The new camera which should be active. */
virtual void setActiveCamera(ICameraSceneNode* camera) = 0; virtual void setActiveCamera(ICameraSceneNode* camera) = 0;
//! Sets the color of stencil buffers shadows drawn by the scene manager. //! Sets the color of stencil buffers shadows drawn by the scene manager.
@ -1126,11 +1135,13 @@ namespace scene
//! Creates a follow spline animator. //! Creates a follow spline animator.
/** The animator modifies the position of /** The animator modifies the position of
the attached scene node to make it follow a hermite spline. the attached scene node to make it follow a hermite spline.
It uses a subset of hermite splines: either cardinal splines It uses a subset of hermite splines: either cardinal splines
(tightness != 0.5) or catmull-rom-splines (tightness == 0.5). (tightness != 0.5) or catmull-rom-splines (tightness == 0.5).
The animator moves from one control point to the next in The animator moves from one control point to the next in
1/speed seconds. This code was sent in by Matthias Gall. */ 1/speed seconds. This code was sent in by Matthias Gall.
If you no longer need the animator, you should call ISceneNodeAnimator::drop().
See IReferenceCounted::drop() for more information. */
virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime, virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime,
const core::array< core::vector3df >& points, const core::array< core::vector3df >& points,
f32 speed = 1.0f, f32 tightness = 0.5f) = 0; f32 speed = 1.0f, f32 tightness = 0.5f) = 0;
@ -1205,23 +1216,30 @@ namespace scene
//! Creates a triangle selector which can select triangles from a terrain scene node. //! Creates a triangle selector which can select triangles from a terrain scene node.
/** \param node: Pointer to the created terrain scene node /** \param node: Pointer to the created terrain scene node
\param LOD: Level of detail, 0 for highest detail. */ \param LOD: Level of detail, 0 for highest detail.
\return The selector, or null if not successful.
If you no longer need the selector, you should call ITriangleSelector::drop().
See IReferenceCounted::drop() for more information. */
virtual ITriangleSelector* createTerrainTriangleSelector( virtual ITriangleSelector* createTerrainTriangleSelector(
ITerrainSceneNode* node, s32 LOD=0) = 0; ITerrainSceneNode* node, s32 LOD=0) = 0;
//! Adds an external mesh loader for extending the engine with new file formats. //! Adds an external mesh loader for extending the engine with new file formats.
/** If you want the engine to be extended with /** If you want the engine to be extended with
file formats it currently is not able to load (e.g. .cob), just implement file formats it currently is not able to load (e.g. .cob), just implement
the IMeshLoader interface in your loading class and add it with this method. the IMeshLoader interface in your loading class and add it with this method.
Using this method it is also possible to override built-in mesh loaders with Using this method it is also possible to override built-in mesh loaders with
newer or updated versions without the need of recompiling the engine. newer or updated versions without the need of recompiling the engine.
\param externalLoader: Implementation of a new mesh loader. */ \param externalLoader: Implementation of a new mesh loader. */
virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0; virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0;
//! Get pointer to the scene collision manager. //! Get pointer to the scene collision manager.
/** \return Pointer to the collision manager
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneCollisionManager* getSceneCollisionManager() = 0; virtual ISceneCollisionManager* getSceneCollisionManager() = 0;
//! Get pointer to the mesh manipulator. //! Get pointer to the mesh manipulator.
/** \return Pointer to the mesh manipulator
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IMeshManipulator* getMeshManipulator() = 0; virtual IMeshManipulator* getMeshManipulator() = 0;
//! Adds a scene node to the deletion queue. //! Adds a scene node to the deletion queue.
@ -1262,6 +1280,8 @@ namespace scene
virtual E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const = 0; virtual E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const = 0;
//! Get the default scene node factory which can create all built in scene nodes //! Get the default scene node factory which can create all built in scene nodes
/** \return Pointer to the default scene node factory
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneNodeFactory* getDefaultSceneNodeFactory() = 0; virtual ISceneNodeFactory* getDefaultSceneNodeFactory() = 0;
//! Adds a scene node factory to the scene manager. //! Adds a scene node factory to the scene manager.
@ -1273,9 +1293,13 @@ namespace scene
virtual u32 getRegisteredSceneNodeFactoryCount() const = 0; virtual u32 getRegisteredSceneNodeFactoryCount() const = 0;
//! Get a scene node factory by index //! Get a scene node factory by index
/** \return Pointer to the requested scene node factory, or 0 if it does not exist.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneNodeFactory* getSceneNodeFactory(u32 index) = 0; virtual ISceneNodeFactory* getSceneNodeFactory(u32 index) = 0;
//! Get the default scene node animator factory which can create all built-in scene node animators //! Get the default scene node animator factory which can create all built-in scene node animators
/** \return Pointer to the default scene node animator factory
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory() = 0; virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory() = 0;
//! Adds a scene node animator factory to the scene manager. //! Adds a scene node animator factory to the scene manager.
@ -1287,12 +1311,16 @@ namespace scene
virtual u32 getRegisteredSceneNodeAnimatorFactoryCount() const = 0; virtual u32 getRegisteredSceneNodeAnimatorFactoryCount() const = 0;
//! Get scene node animator factory by index //! Get scene node animator factory by index
/** \return Pointer to the requested scene node animator factory, or 0 if it does not exist.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneNodeAnimatorFactory* getSceneNodeAnimatorFactory(u32 index) = 0; virtual ISceneNodeAnimatorFactory* getSceneNodeAnimatorFactory(u32 index) = 0;
//! Get typename from a scene node type or null if not found //! Get typename from a scene node type or null if not found
virtual const c8* getSceneNodeTypeName(ESCENE_NODE_TYPE type) = 0; virtual const c8* getSceneNodeTypeName(ESCENE_NODE_TYPE type) = 0;
//! Adds a scene node to the scene by name //! Adds a scene node to the scene by name
/** \return Pointer to the scene node added by a factory
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) = 0; virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) = 0;
//! Creates a new scene manager. //! Creates a new scene manager.

View File

@ -33,13 +33,15 @@ namespace scene
//! adds a scene node to the scene graph based on its type id //! adds a scene node to the scene graph based on its type id
/** \param type: Type of the scene node to add. /** \param type: Type of the scene node to add.
\param parent: Parent scene node of the new node, can be null to add the scene node to the root. \param parent: Parent scene node of the new node, can be null to add the scene node to the root.
\return Returns pointer to the new scene node or null if not successful. */ \return Returns pointer to the new scene node or null if not successful.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneNode* addSceneNode(ESCENE_NODE_TYPE type, ISceneNode* parent=0) = 0; virtual ISceneNode* addSceneNode(ESCENE_NODE_TYPE type, ISceneNode* parent=0) = 0;
//! adds a scene node to the scene graph based on its type name //! adds a scene node to the scene graph based on its type name
/** \param typeName: Type name of the scene node to add. /** \param typeName: Type name of the scene node to add.
\param parent: Parent scene node of the new node, can be null to add the scene node to the root. \param parent: Parent scene node of the new node, can be null to add the scene node to the root.
\return Returns pointer to the new scene node or null if not successful. */ \return Returns pointer to the new scene node or null if not successful.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneNode* addSceneNode(const c8* typeName, ISceneNode* parent=0) = 0; virtual ISceneNode* addSceneNode(const c8* typeName, ISceneNode* parent=0) = 0;
//! returns amount of scene node types this factory is able to create //! returns amount of scene node types this factory is able to create

BIN
media/017shot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
media/019shot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -32,9 +32,8 @@ CAnimatedMeshSceneNode::CAnimatedMeshSceneNode(IAnimatedMesh* mesh,
const core::vector3df& rotation, const core::vector3df& rotation,
const core::vector3df& scale) const core::vector3df& scale)
: IAnimatedMeshSceneNode(parent, mgr, id, position, rotation, scale), Mesh(0), : IAnimatedMeshSceneNode(parent, mgr, id, position, rotation, scale), Mesh(0),
MeshForCurrentFrame(0),
BeginFrameTime(0), StartFrame(0), EndFrame(0), FramesPerSecond(0.f), BeginFrameTime(0), StartFrame(0), EndFrame(0), FramesPerSecond(0.f),
CurrentFrameNr(0.f), FrameWhenCurrentMeshWasGenerated(0.f), CurrentFrameNr(0.f),
JointMode(EJUOR_NONE), JointsUsed(false), JointMode(EJUOR_NONE), JointsUsed(false),
TransitionTime(0), Transiting(0.f), TransitingBlend(0.f), TransitionTime(0), Transiting(0.f), TransitingBlend(0.f),
Looping(true), ReadOnlyMaterials(false), RenderFromIdentity(0), Looping(true), ReadOnlyMaterials(false), RenderFromIdentity(0),
@ -205,8 +204,7 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(void)
{ {
if(Mesh->getMeshType() != EAMT_SKINNED) if(Mesh->getMeshType() != EAMT_SKINNED)
{ {
if(!MeshForCurrentFrame || !core::equals(CurrentFrameNr, FrameWhenCurrentMeshWasGenerated)) return Mesh->getMesh((s32)getFrameNr(), 255, StartFrame, EndFrame);
MeshForCurrentFrame = Mesh->getMesh((s32)getFrameNr(), 255, StartFrame, EndFrame);
} }
else else
{ {
@ -241,11 +239,8 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(void)
skinnedMesh->updateBoundingBox(); skinnedMesh->updateBoundingBox();
} }
MeshForCurrentFrame = skinnedMesh; return skinnedMesh;
} }
FrameWhenCurrentMeshWasGenerated = CurrentFrameNr;
return MeshForCurrentFrame;
} }
@ -822,9 +817,6 @@ void CAnimatedMeshSceneNode::setMesh(IAnimatedMesh* mesh)
Mesh = mesh; Mesh = mesh;
// Forget about the stored frame of any existing mesh.
MeshForCurrentFrame = 0;
// get materials and bounding box // get materials and bounding box
Box = Mesh->getBoundingBox(); Box = Mesh->getBoundingBox();

View File

@ -171,14 +171,12 @@ namespace scene
core::array<video::SMaterial> Materials; core::array<video::SMaterial> Materials;
core::aabbox3d<f32> Box; core::aabbox3d<f32> Box;
IAnimatedMesh* Mesh; IAnimatedMesh* Mesh;
IMesh* MeshForCurrentFrame;
u32 BeginFrameTime; u32 BeginFrameTime;
s32 StartFrame; s32 StartFrame;
s32 EndFrame; s32 EndFrame;
f32 FramesPerSecond; f32 FramesPerSecond;
f32 CurrentFrameNr; f32 CurrentFrameNr;
f32 FrameWhenCurrentMeshWasGenerated;
//0-unused, 1-get joints only, 2-set joints only, 3-move and set //0-unused, 1-get joints only, 2-set joints only, 3-move and set
E_JOINT_UPDATE_ON_RENDER JointMode; E_JOINT_UPDATE_ON_RENDER JointMode;

View File

@ -18,7 +18,7 @@ namespace gui
//! constructor //! constructor
CGUIButton::CGUIButton(IGUIEnvironment* environment, IGUIElement* parent, CGUIButton::CGUIButton(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle, bool noclip) s32 id, core::rect<s32> rectangle, bool noclip)
: IGUIButton(environment, parent, id, rectangle), Pressed(false), : IGUIButton(environment, parent, id, rectangle), Pressed(false),
IsPushButton(false), UseAlphaChannel(false), Border(true), IsPushButton(false), UseAlphaChannel(false), Border(true),
ClickTime(0), SpriteBank(0), OverrideFont(0), Image(0), PressedImage(0) ClickTime(0), SpriteBank(0), OverrideFont(0), Image(0), PressedImage(0)
@ -99,8 +99,7 @@ bool CGUIButton::OnEvent(const SEvent& event)
{ {
case EET_KEY_INPUT_EVENT: case EET_KEY_INPUT_EVENT:
if (event.KeyInput.PressedDown && if (event.KeyInput.PressedDown &&
(event.KeyInput.Key == KEY_RETURN || (event.KeyInput.Key == KEY_RETURN || event.KeyInput.Key == KEY_SPACE))
event.KeyInput.Key == KEY_SPACE))
{ {
if (!IsPushButton) if (!IsPushButton)
setPressed(true); setPressed(true);
@ -116,8 +115,7 @@ bool CGUIButton::OnEvent(const SEvent& event)
} }
else else
if (!event.KeyInput.PressedDown && Pressed && if (!event.KeyInput.PressedDown && Pressed &&
(event.KeyInput.Key == KEY_RETURN || (event.KeyInput.Key == KEY_RETURN || event.KeyInput.Key == KEY_SPACE))
event.KeyInput.Key == KEY_SPACE))
{ {
//Environment->removeFocus(this); //Environment->removeFocus(this);
@ -147,7 +145,7 @@ bool CGUIButton::OnEvent(const SEvent& event)
if (event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN) if (event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
{ {
if (Environment->hasFocus(this) && if (Environment->hasFocus(this) &&
!AbsoluteClippingRect.isPointInside(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y))) !AbsoluteClippingRect.isPointInside(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y)))
{ {
Environment->removeFocus(this); Environment->removeFocus(this);
return false; return false;

View File

@ -105,7 +105,6 @@ namespace gui
bool Pressed; bool Pressed;
bool IsPushButton; bool IsPushButton;
bool UseAlphaChannel; bool UseAlphaChannel;
bool Border; bool Border;
u32 ClickTime; u32 ClickTime;

View File

@ -19,7 +19,7 @@ namespace gui
//! constructor //! constructor
CGUICheckBox::CGUICheckBox(bool checked, IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) CGUICheckBox::CGUICheckBox(bool checked, IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUICheckBox(environment, parent, id, rectangle), Pressed(false), Checked(checked), checkTime(0) : IGUICheckBox(environment, parent, id, rectangle), checkTime(0), Pressed(false), Checked(checked)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CGUICheckBox"); setDebugName("CGUICheckBox");
@ -31,7 +31,6 @@ CGUICheckBox::CGUICheckBox(bool checked, IGUIEnvironment* environment, IGUIEleme
} }
//! called if an event happened. //! called if an event happened.
bool CGUICheckBox::OnEvent(const SEvent& event) bool CGUICheckBox::OnEvent(const SEvent& event)
{ {
@ -41,8 +40,7 @@ bool CGUICheckBox::OnEvent(const SEvent& event)
{ {
case EET_KEY_INPUT_EVENT: case EET_KEY_INPUT_EVENT:
if (event.KeyInput.PressedDown && if (event.KeyInput.PressedDown &&
(event.KeyInput.Key == KEY_RETURN || (event.KeyInput.Key == KEY_RETURN || event.KeyInput.Key == KEY_SPACE))
event.KeyInput.Key == KEY_SPACE))
{ {
Pressed = true; Pressed = true;
return true; return true;
@ -55,8 +53,7 @@ bool CGUICheckBox::OnEvent(const SEvent& event)
} }
else else
if (!event.KeyInput.PressedDown && Pressed && if (!event.KeyInput.PressedDown && Pressed &&
(event.KeyInput.Key == KEY_RETURN || (event.KeyInput.Key == KEY_RETURN || event.KeyInput.Key == KEY_SPACE))
event.KeyInput.Key == KEY_SPACE))
{ {
Pressed = false; Pressed = false;
if (Parent) if (Parent)
@ -123,7 +120,6 @@ bool CGUICheckBox::OnEvent(const SEvent& event)
} }
//! draws the element and its children //! draws the element and its children
void CGUICheckBox::draw() void CGUICheckBox::draw()
{ {
@ -137,8 +133,8 @@ void CGUICheckBox::draw()
s32 height = skin->getSize(EGDS_CHECK_BOX_WIDTH); s32 height = skin->getSize(EGDS_CHECK_BOX_WIDTH);
core::rect<s32> checkRect(AbsoluteRect.UpperLeftCorner.X, core::rect<s32> checkRect(AbsoluteRect.UpperLeftCorner.X,
((AbsoluteRect.getHeight() - height) / 2) + AbsoluteRect.UpperLeftCorner.Y, ((AbsoluteRect.getHeight() - height) / 2) + AbsoluteRect.UpperLeftCorner.Y,
0, 0); 0, 0);
checkRect.LowerRightCorner.X = checkRect.UpperLeftCorner.X + height; checkRect.LowerRightCorner.X = checkRect.UpperLeftCorner.X + height;
checkRect.LowerRightCorner.Y = checkRect.UpperLeftCorner.Y + height; checkRect.LowerRightCorner.Y = checkRect.UpperLeftCorner.Y + height;
@ -147,7 +143,7 @@ void CGUICheckBox::draw()
false, true, checkRect, &AbsoluteClippingRect); false, true, checkRect, &AbsoluteClippingRect);
if (Checked && Environment->getSkin()) if (Checked && Environment->getSkin())
Environment->getSkin()->drawIcon(this, EGDI_CHECK_BOX_CHECKED, checkRect.getCenter(), Environment->getSkin()->drawIcon(this, EGDI_CHECK_BOX_CHECKED, checkRect.getCenter(),
checkTime, os::Timer::getTime(), false, &AbsoluteClippingRect); checkTime, os::Timer::getTime(), false, &AbsoluteClippingRect);
if (Text.size()) if (Text.size())
@ -157,7 +153,7 @@ void CGUICheckBox::draw()
IGUIFont* font = skin->getFont(); IGUIFont* font = skin->getFont();
if (font) if (font)
font->draw(Text.c_str(), checkRect, font->draw(Text.c_str(), checkRect,
skin->getColor(EGDC_BUTTON_TEXT), false, true, &AbsoluteClippingRect); skin->getColor(EGDC_BUTTON_TEXT), false, true, &AbsoluteClippingRect);
} }
@ -179,13 +175,15 @@ bool CGUICheckBox::isChecked() const
return Checked; return Checked;
} }
//! Writes attributes of the element. //! Writes attributes of the element.
void CGUICheckBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const void CGUICheckBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{ {
IGUICheckBox::serializeAttributes(out,options); IGUICheckBox::serializeAttributes(out,options);
out->addBool ("Checked", Checked ); out->addBool("Checked", Checked);
} }
//! Reads attributes of the element //! Reads attributes of the element
void CGUICheckBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) void CGUICheckBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{ {
@ -199,3 +197,4 @@ void CGUICheckBox::deserializeAttributes(io::IAttributes* in, io::SAttributeRead
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_

View File

@ -42,9 +42,9 @@ namespace gui
private: private:
u32 checkTime;
bool Pressed; bool Pressed;
bool Checked; bool Checked;
u32 checkTime;
}; };
} // end namespace gui } // end namespace gui

View File

@ -67,8 +67,7 @@ namespace gui
}; };
SColorCircle ColorRing; SColorCircle ColorRing;
void buildColorRing( const core::dimension2d<u32> & dim, s32 supersample, const u32 borderColor ); void buildColorRing( const core::dimension2d<s32> & dim, s32 supersample, const u32 borderColor );
}; };
@ -78,3 +77,4 @@ namespace gui
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_
#endif // __C_GUI_COLOR_SELECT_DIALOG_H_INCLUDED__ #endif // __C_GUI_COLOR_SELECT_DIALOG_H_INCLUDED__

View File

@ -23,8 +23,8 @@ namespace gui
CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle) s32 id, core::rect<s32> rectangle)
: IGUIComboBox(environment, parent, id, rectangle), : IGUIComboBox(environment, parent, id, rectangle),
ListButton(0), SelectedText(0), ListBox(0), Selected(-1), HasFocus(false), LastFocus(0), ListButton(0), SelectedText(0), ListBox(0), LastFocus(0),
HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_CENTER) Selected(-1), HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_CENTER), HasFocus(false)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CGUIComboBox"); setDebugName("CGUIComboBox");
@ -39,7 +39,7 @@ CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent,
core::rect<s32> r; core::rect<s32> r;
r.UpperLeftCorner.X = rectangle.getWidth() - width - 2; r.UpperLeftCorner.X = rectangle.getWidth() - width - 2;
r.LowerRightCorner.X = rectangle.getWidth() - 2; r.LowerRightCorner.X = rectangle.getWidth() - 2;
r.UpperLeftCorner.Y = 2; r.UpperLeftCorner.Y = 2;
r.LowerRightCorner.Y = rectangle.getHeight() - 2; r.LowerRightCorner.Y = rectangle.getHeight() - 2;
@ -72,6 +72,7 @@ CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent,
setTabOrder(-1); setTabOrder(-1);
} }
void CGUIComboBox::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) void CGUIComboBox::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical)
{ {
HAlign = horizontal; HAlign = horizontal;
@ -79,6 +80,7 @@ void CGUIComboBox::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT ve
SelectedText->setTextAlignment(horizontal, vertical); SelectedText->setTextAlignment(horizontal, vertical);
} }
//! Returns amount of items in box //! Returns amount of items in box
u32 CGUIComboBox::getItemCount() const u32 CGUIComboBox::getItemCount() const
{ {
@ -108,6 +110,7 @@ void CGUIComboBox::removeItem(u32 idx)
Items.erase(idx); Items.erase(idx);
} }
//! Returns caption of this element. //! Returns caption of this element.
const wchar_t* CGUIComboBox::getText() const const wchar_t* CGUIComboBox::getText() const
{ {
@ -127,7 +130,6 @@ u32 CGUIComboBox::addItem(const wchar_t* text)
} }
//! deletes all items in the combo box //! deletes all items in the combo box
void CGUIComboBox::clear() void CGUIComboBox::clear()
{ {
@ -136,7 +138,6 @@ void CGUIComboBox::clear()
} }
//! returns id of selected item. returns -1 if no item is selected. //! returns id of selected item. returns -1 if no item is selected.
s32 CGUIComboBox::getSelected() const s32 CGUIComboBox::getSelected() const
{ {
@ -144,7 +145,6 @@ s32 CGUIComboBox::getSelected() const
} }
//! sets the selected item. Set this to -1 if no item should be selected //! sets the selected item. Set this to -1 if no item should be selected
void CGUIComboBox::setSelected(s32 idx) void CGUIComboBox::setSelected(s32 idx)
{ {
@ -153,11 +153,12 @@ void CGUIComboBox::setSelected(s32 idx)
Selected = idx; Selected = idx;
if (Selected == -1) if (Selected == -1)
SelectedText->setText(L""); SelectedText->setText(L"");
else else
SelectedText->setText(Items[Selected].c_str()); SelectedText->setText(Items[Selected].c_str());
} }
//! called if an event happened. //! called if an event happened.
bool CGUIComboBox::OnEvent(const SEvent& event) bool CGUIComboBox::OnEvent(const SEvent& event)
{ {
@ -190,10 +191,10 @@ bool CGUIComboBox::OnEvent(const SEvent& event)
bool absorb = true; bool absorb = true;
switch (event.KeyInput.Key) switch (event.KeyInput.Key)
{ {
case KEY_DOWN: case KEY_DOWN:
setSelected(Selected+1); setSelected(Selected+1);
break; break;
case KEY_UP: case KEY_UP:
setSelected(Selected-1); setSelected(Selected-1);
break; break;
case KEY_HOME: case KEY_HOME:
@ -227,11 +228,11 @@ bool CGUIComboBox::OnEvent(const SEvent& event)
switch(event.GUIEvent.EventType) switch(event.GUIEvent.EventType)
{ {
case EGET_ELEMENT_FOCUS_LOST: case EGET_ELEMENT_FOCUS_LOST:
if (ListBox && if (ListBox &&
(Environment->hasFocus(ListBox) || ListBox->isMyChild(event.GUIEvent.Caller) ) && (Environment->hasFocus(ListBox) || ListBox->isMyChild(event.GUIEvent.Caller) ) &&
event.GUIEvent.Element != this && event.GUIEvent.Element != this &&
event.GUIEvent.Element != ListButton && event.GUIEvent.Element != ListButton &&
event.GUIEvent.Element != ListBox && event.GUIEvent.Element != ListBox &&
!ListBox->isMyChild(event.GUIEvent.Element)) !ListBox->isMyChild(event.GUIEvent.Element))
{ {
openCloseMenu(); openCloseMenu();
@ -267,7 +268,7 @@ bool CGUIComboBox::OnEvent(const SEvent& event)
case EMIE_LMOUSE_PRESSED_DOWN: case EMIE_LMOUSE_PRESSED_DOWN:
{ {
core::position2d<s32> p(event.MouseInput.X, event.MouseInput.Y); core::position2d<s32> p(event.MouseInput.X, event.MouseInput.Y);
// send to list box // send to list box
if (ListBox && ListBox->isPointInside(p) && ListBox->OnEvent(event)) if (ListBox && ListBox->isPointInside(p) && ListBox->OnEvent(event))
return true; return true;
@ -312,7 +313,6 @@ bool CGUIComboBox::OnEvent(const SEvent& event)
} }
void CGUIComboBox::sendSelectionChangedEvent() void CGUIComboBox::sendSelectionChangedEvent()
{ {
if (Parent) if (Parent)
@ -328,7 +328,6 @@ void CGUIComboBox::sendSelectionChangedEvent()
} }
//! draws the element and its children //! draws the element and its children
void CGUIComboBox::draw() void CGUIComboBox::draw()
{ {
@ -382,7 +381,7 @@ void CGUIComboBox::openCloseMenu()
if (Parent) if (Parent)
Parent->bringToFront(this); Parent->bringToFront(this);
IGUISkin* skin = Environment->getSkin(); IGUISkin* skin = Environment->getSkin();
s32 h = Items.size(); s32 h = Items.size();
if (h > 5) if (h > 5)
@ -412,6 +411,7 @@ void CGUIComboBox::openCloseMenu()
} }
} }
//! Writes attributes of the element. //! Writes attributes of the element.
void CGUIComboBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const void CGUIComboBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{ {
@ -431,6 +431,7 @@ void CGUIComboBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadW
} }
} }
//! Reads attributes of the element //! Reads attributes of the element
void CGUIComboBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) void CGUIComboBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{ {

View File

@ -76,11 +76,11 @@ namespace gui
IGUIButton* ListButton; IGUIButton* ListButton;
IGUIStaticText* SelectedText; IGUIStaticText* SelectedText;
IGUIListBox* ListBox; IGUIListBox* ListBox;
IGUIElement *LastFocus;
core::array< core::stringw > Items; core::array< core::stringw > Items;
s32 Selected; s32 Selected;
bool HasFocus;
IGUIElement *LastFocus;
EGUI_ALIGNMENT HAlign, VAlign; EGUI_ALIGNMENT HAlign, VAlign;
bool HasFocus;
}; };

View File

@ -23,8 +23,8 @@ namespace gui
CGUIContextMenu::CGUIContextMenu(IGUIEnvironment* environment, CGUIContextMenu::CGUIContextMenu(IGUIEnvironment* environment,
IGUIElement* parent, s32 id, IGUIElement* parent, s32 id,
core::rect<s32> rectangle, bool getFocus, bool allowFocus) core::rect<s32> rectangle, bool getFocus, bool allowFocus)
: IGUIContextMenu(environment, parent, id, rectangle), HighLighted(-1), : IGUIContextMenu(environment, parent, id, rectangle), EventParent(0), LastFont(0),
ChangeTime(0), EventParent(0), AllowFocus(allowFocus), LastFont(0) HighLighted(-1), ChangeTime(0), AllowFocus(allowFocus)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CGUIContextMenu"); setDebugName("CGUIContextMenu");
@ -242,7 +242,7 @@ bool CGUIContextMenu::OnEvent(const SEvent& event)
} }
break; break;
default: default:
break; break;
} }
break; break;
case EET_MOUSE_INPUT_EVENT: case EET_MOUSE_INPUT_EVENT:
@ -265,7 +265,7 @@ bool CGUIContextMenu::OnEvent(const SEvent& event)
highlight(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y), true); highlight(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y), true);
return true; return true;
default: default:
break; break;
} }
break; break;
default: default:

View File

@ -132,13 +132,13 @@ namespace gui
void setEventParent(IGUIElement *parent); void setEventParent(IGUIElement *parent);
s32 HighLighted;
core::array<SItem> Items; core::array<SItem> Items;
core::position2d<s32> Pos; core::position2d<s32> Pos;
u32 ChangeTime;
IGUIElement* EventParent; IGUIElement* EventParent;
bool AllowFocus;
IGUIFont *LastFont; IGUIFont *LastFont;
s32 HighLighted;
u32 ChangeTime;
bool AllowFocus;
}; };

View File

@ -665,6 +665,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
return true; return true;
} }
//! draws the element and its children //! draws the element and its children
void CGUIEditBox::draw() void CGUIEditBox::draw()
{ {
@ -878,6 +879,7 @@ bool CGUIEditBox::isAutoScrollEnabled() const
return AutoScroll; return AutoScroll;
} }
//! Gets the area of the text in the edit box //! Gets the area of the text in the edit box
//! \return Returns the size in pixels of the text //! \return Returns the size in pixels of the text
core::dimension2du CGUIEditBox::getTextDimension() core::dimension2du CGUIEditBox::getTextDimension()

View File

@ -327,18 +327,21 @@ video::IVideoDriver* CGUIEnvironment::getVideoDriver() const
return Driver; return Driver;
} }
//! returns the current file system //! returns the current file system
io::IFileSystem* CGUIEnvironment::getFileSystem() const io::IFileSystem* CGUIEnvironment::getFileSystem() const
{ {
return FileSystem; return FileSystem;
} }
//! returns the current file system //! returns the current file system
IOSOperator* CGUIEnvironment::getOSOperator() const IOSOperator* CGUIEnvironment::getOSOperator() const
{ {
return Operator; return Operator;
} }
//! clear all GUI elements //! clear all GUI elements
void CGUIEnvironment::clear() void CGUIEnvironment::clear()
{ {
@ -809,7 +812,7 @@ void CGUIEnvironment::readGUIElement(io::IXMLReader* reader, IGUIElement* node)
else else
{ {
os::Printer::log("Found unknown element in irrlicht GUI file", os::Printer::log("Found unknown element in irrlicht GUI file",
core::stringc(reader->getNodeName()).c_str()); core::stringc(reader->getNodeName()).c_str());
} }
break; break;
@ -919,7 +922,7 @@ void CGUIEnvironment::deserializeAttributes(io::IAttributes* in, io::SAttributeR
RelativeRect = AbsoluteRect = RelativeRect = AbsoluteRect =
core::rect<s32>(core::position2d<s32>(0,0), core::rect<s32>(core::position2d<s32>(0,0),
Driver ? core::dimension2d<s32>(Driver->getScreenSize()) : core::dimension2d<s32>(0,0)); Driver ? Driver->getScreenSize() : core::dimension2d<s32>(0,0));
} }
@ -1015,6 +1018,7 @@ IGUIScrollBar* CGUIEnvironment::addScrollBar(bool horizontal, const core::rect<s
return bar; return bar;
} }
IGUITable* CGUIEnvironment::addTable(const core::rect<s32>& rectangle, IGUIElement* parent, s32 id, bool drawBackground) IGUITable* CGUIEnvironment::addTable(const core::rect<s32>& rectangle, IGUIElement* parent, s32 id, bool drawBackground)
{ {
CGUITable* b = new CGUITable(this, parent ? parent : this, id, rectangle, true, drawBackground, false); CGUITable* b = new CGUITable(this, parent ? parent : this, id, rectangle, true, drawBackground, false);
@ -1022,6 +1026,7 @@ IGUITable* CGUIEnvironment::addTable(const core::rect<s32>& rectangle, IGUIEleme
return b; return b;
} }
//! Adds an image element. //! Adds an image element.
IGUIImage* CGUIEnvironment::addImage(video::ITexture* image, core::position2d<s32> pos, IGUIImage* CGUIEnvironment::addImage(video::ITexture* image, core::position2d<s32> pos,
bool useAlphaChannel, IGUIElement* parent, s32 id, const wchar_t* text) bool useAlphaChannel, IGUIElement* parent, s32 id, const wchar_t* text)
@ -1091,8 +1096,7 @@ IGUICheckBox* CGUIEnvironment::addCheckBox(bool checked, const core::rect<s32>&
//! adds a list box //! adds a list box
IGUIListBox* CGUIEnvironment::addListBox(const core::rect<s32>& rectangle, IGUIListBox* CGUIEnvironment::addListBox(const core::rect<s32>& rectangle,
IGUIElement* parent, s32 id, IGUIElement* parent, s32 id, bool drawBackground)
bool drawBackground)
{ {
IGUIListBox* b = new CGUIListBox(this, parent ? parent : this, id, rectangle, IGUIListBox* b = new CGUIListBox(this, parent ? parent : this, id, rectangle,
true, drawBackground, false); true, drawBackground, false);
@ -1113,8 +1117,7 @@ IGUIListBox* CGUIEnvironment::addListBox(const core::rect<s32>& rectangle,
//! adds a file open dialog. The returned pointer must not be dropped. //! adds a file open dialog. The returned pointer must not be dropped.
IGUIFileOpenDialog* CGUIEnvironment::addFileOpenDialog(const wchar_t* title, IGUIFileOpenDialog* CGUIEnvironment::addFileOpenDialog(const wchar_t* title,
bool modal, bool modal, IGUIElement* parent, s32 id)
IGUIElement* parent, s32 id)
{ {
parent = parent ? parent : this; parent = parent ? parent : this;
@ -1133,8 +1136,7 @@ IGUIFileOpenDialog* CGUIEnvironment::addFileOpenDialog(const wchar_t* title,
//! adds a color select dialog. The returned pointer must not be dropped. //! adds a color select dialog. The returned pointer must not be dropped.
IGUIColorSelectDialog* CGUIEnvironment::addColorSelectDialog(const wchar_t* title, IGUIColorSelectDialog* CGUIEnvironment::addColorSelectDialog(const wchar_t* title,
bool modal, bool modal, IGUIElement* parent, s32 id)
IGUIElement* parent, s32 id)
{ {
parent = parent ? parent : this; parent = parent ? parent : this;
@ -1154,10 +1156,9 @@ IGUIColorSelectDialog* CGUIEnvironment::addColorSelectDialog(const wchar_t* titl
//! adds a static text. The returned pointer must not be dropped. //! adds a static text. The returned pointer must not be dropped.
IGUIStaticText* CGUIEnvironment::addStaticText(const wchar_t* text, IGUIStaticText* CGUIEnvironment::addStaticText(const wchar_t* text,
const core::rect<s32>& rectangle, const core::rect<s32>& rectangle,
bool border, bool wordWrap, bool border, bool wordWrap,
IGUIElement* parent, s32 id, IGUIElement* parent, s32 id, bool background)
bool background)
{ {
IGUIStaticText* d = new CGUIStaticText(text, border, this, IGUIStaticText* d = new CGUIStaticText(text, border, this,
parent ? parent : this, id, rectangle, background); parent ? parent : this, id, rectangle, background);
@ -1171,9 +1172,8 @@ IGUIStaticText* CGUIEnvironment::addStaticText(const wchar_t* text,
//! Adds an edit box. The returned pointer must not be dropped. //! Adds an edit box. The returned pointer must not be dropped.
IGUIEditBox* CGUIEnvironment::addEditBox(const wchar_t* text, IGUIEditBox* CGUIEnvironment::addEditBox(const wchar_t* text,
const core::rect<s32>& rectangle, const core::rect<s32>& rectangle, bool border,
bool border, IGUIElement* parent, IGUIElement* parent, s32 id)
s32 id)
{ {
IGUIEditBox* d = new CGUIEditBox(text, border, this, IGUIEditBox* d = new CGUIEditBox(text, border, this,
parent ? parent : this, id, rectangle); parent ? parent : this, id, rectangle);
@ -1185,8 +1185,8 @@ IGUIEditBox* CGUIEnvironment::addEditBox(const wchar_t* text,
//! Adds a spin box to the environment //! Adds a spin box to the environment
IGUISpinBox* CGUIEnvironment::addSpinBox(const wchar_t* text, IGUISpinBox* CGUIEnvironment::addSpinBox(const wchar_t* text,
const core::rect<s32> &rectangle, const core::rect<s32> &rectangle,
IGUIElement* parent, s32 id) IGUIElement* parent, s32 id)
{ {
IGUISpinBox* d = new CGUISpinBox(text, this, parent ? parent : this, id, rectangle); IGUISpinBox* d = new CGUISpinBox(text, this, parent ? parent : this, id, rectangle);
@ -1264,9 +1264,8 @@ IGUIInOutFader* CGUIEnvironment::addInOutFader(const core::rect<s32>* rectangle,
if (rectangle) if (rectangle)
rect = *rectangle; rect = *rectangle;
else else if (Driver)
if (Driver) rect = core::rect<s32>(core::position2d<s32>(0,0), Driver->getScreenSize());
rect = core::rect<s32>(core::position2d<s32>(0,0), core::dimension2d<s32>(Driver->getScreenSize()));
if (!parent) if (!parent)
parent = this; parent = this;
@ -1530,4 +1529,3 @@ IGUIEnvironment* createGUIEnvironment(io::IFileSystem* fs,
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_

View File

@ -83,7 +83,7 @@ public:
virtual IGUIButton* addButton(const core::rect<s32>& rectangle, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0,const wchar_t* tooltiptext = 0); virtual IGUIButton* addButton(const core::rect<s32>& rectangle, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0,const wchar_t* tooltiptext = 0);
//! adds a window. The returned pointer must not be dropped. //! adds a window. The returned pointer must not be dropped.
virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false, virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false,
const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1); const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1);
//! adds a modal screen. The returned pointer must not be dropped. //! adds a modal screen. The returned pointer must not be dropped.
@ -96,12 +96,12 @@ public:
//! adds a scrollbar. The returned pointer must not be dropped. //! adds a scrollbar. The returned pointer must not be dropped.
virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle, IGUIElement* parent=0, s32 id=-1); virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle, IGUIElement* parent=0, s32 id=-1);
//! Adds an image element. //! Adds an image element.
virtual IGUIImage* addImage(video::ITexture* image, core::position2d<s32> pos, virtual IGUIImage* addImage(video::ITexture* image, core::position2d<s32> pos,
bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0); bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0);
//! adds an image. The returned pointer must not be dropped. //! adds an image. The returned pointer must not be dropped.
virtual IGUIImage* addImage(const core::rect<s32>& rectangle, virtual IGUIImage* addImage(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0); IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0);
//! adds a checkbox //! adds a checkbox
@ -125,18 +125,18 @@ public:
bool border=false, bool wordWrap=true, IGUIElement* parent=0, s32 id=-1, bool drawBackground = false); bool border=false, bool wordWrap=true, IGUIElement* parent=0, s32 id=-1, bool drawBackground = false);
//! Adds an edit box. The returned pointer must not be dropped. //! Adds an edit box. The returned pointer must not be dropped.
virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle, virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,
bool border=false, IGUIElement* parent=0, s32 id=-1); bool border=false, IGUIElement* parent=0, s32 id=-1);
//! Adds a spin box to the environment //! Adds a spin box to the environment
virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle, virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1); IGUIElement* parent=0, s32 id=-1);
//! Adds a tab control to the environment. //! Adds a tab control to the environment.
virtual IGUITabControl* addTabControl(const core::rect<s32>& rectangle, virtual IGUITabControl* addTabControl(const core::rect<s32>& rectangle,
IGUIElement* parent=0, bool fillbackground=false, bool border=true, s32 id=-1); IGUIElement* parent=0, bool fillbackground=false, bool border=true, s32 id=-1);
//! Adds tab to the environment. //! Adds tab to the environment.
virtual IGUITab* addTab(const core::rect<s32>& rectangle, virtual IGUITab* addTab(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1); IGUIElement* parent=0, s32 id=-1);
@ -156,7 +156,7 @@ public:
IGUIElement* parent=0, s32 id=-1); IGUIElement* parent=0, s32 id=-1);
//! Adds a table element. //! Adds a table element.
virtual IGUITable* addTable(const core::rect<s32>& rectangle, virtual IGUITable* addTable(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, bool drawBackground=false); IGUIElement* parent=0, s32 id=-1, bool drawBackground=false);
//! sets the focus to an element //! sets the focus to an element
@ -177,7 +177,7 @@ public:
//! Adds an element for fading in or out. //! Adds an element for fading in or out.
virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1); virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1);
//! Returns the root gui element. //! Returns the root gui element.
virtual IGUIElement* getRootGUIElement(); virtual IGUIElement* getRootGUIElement();
virtual void OnPostRender( u32 time ); virtual void OnPostRender( u32 time );
@ -201,27 +201,27 @@ public:
//! Saves the current gui into a file. //! Saves the current gui into a file.
/** \param filename: Name of the file. /** \param filename: Name of the file.
\param start: The element to start saving from. \param start: The element to start saving from.
if not specified, the root element will be used */ if not specified, the root element will be used */
virtual bool saveGUI(const c8* filename, IGUIElement* start=0); virtual bool saveGUI(const c8* filename, IGUIElement* start=0);
//! Saves the current gui into a file. //! Saves the current gui into a file.
/** \param file: The file to save the GUI to. /** \param file: The file to save the GUI to.
\param start: The element to start saving from. \param start: The element to start saving from.
if not specified, the root element will be used */ if not specified, the root element will be used */
virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0); virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0);
//! Loads the gui. Note that the current gui is not cleared before. //! Loads the gui. Note that the current gui is not cleared before.
/** \param filename: Name of the file. /** \param filename: Name of the file.
\param parent: The parent of all loaded GUI elements, \param parent: The parent of all loaded GUI elements,
if not specified, the root element will be used */ if not specified, the root element will be used */
virtual bool loadGUI(const c8* filename, IGUIElement* parent=0); virtual bool loadGUI(const c8* filename, IGUIElement* parent=0);
//! Loads the gui. Note that the current gui is not cleared before. //! Loads the gui. Note that the current gui is not cleared before.
/** \param file: IReadFile to load the GUI from /** \param file: IReadFile to load the GUI from
\param parent: The parent of all loaded GUI elements, \param parent: The parent of all loaded GUI elements,
if not specified, the root element will be used */ if not specified, the root element will be used */
virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0); virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0);
//! Writes attributes of the environment //! Writes attributes of the environment
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
@ -235,7 +235,6 @@ public:
//! reads an element //! reads an element
virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* node); virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* node);
private: private:
IGUIElement* getNextElement(bool reverse=false, bool group=false); IGUIElement* getNextElement(bool reverse=false, bool group=false);
@ -268,9 +267,9 @@ private:
struct SToolTip struct SToolTip
{ {
IGUIStaticText* Element;
u32 LastTime; u32 LastTime;
u32 LaunchTime; u32 LaunchTime;
IGUIStaticText* Element;
}; };
SToolTip ToolTip; SToolTip ToolTip;

View File

@ -32,7 +32,7 @@ CGUIFileOpenDialog::CGUIFileOpenDialog(const wchar_t* title,
(parent->getAbsolutePosition().getHeight()-FOD_HEIGHT)/2, (parent->getAbsolutePosition().getHeight()-FOD_HEIGHT)/2,
(parent->getAbsolutePosition().getWidth()-FOD_WIDTH)/2+FOD_WIDTH, (parent->getAbsolutePosition().getWidth()-FOD_WIDTH)/2+FOD_WIDTH,
(parent->getAbsolutePosition().getHeight()-FOD_HEIGHT)/2+FOD_HEIGHT)), (parent->getAbsolutePosition().getHeight()-FOD_HEIGHT)/2+FOD_HEIGHT)),
Dragging(false), FileNameText(0), FileList(0) FileNameText(0), FileList(0), Dragging(false)
{ {
#ifdef _DEBUG #ifdef _DEBUG
IGUIElement::setDebugName("CGUIFileOpenDialog"); IGUIElement::setDebugName("CGUIFileOpenDialog");
@ -49,8 +49,8 @@ CGUIFileOpenDialog::CGUIFileOpenDialog(const wchar_t* title,
color = skin->getColor(EGDC_WINDOW_SYMBOL); color = skin->getColor(EGDC_WINDOW_SYMBOL);
} }
s32 buttonw = environment->getSkin()->getSize(EGDS_WINDOW_BUTTON_WIDTH); const s32 buttonw = environment->getSkin()->getSize(EGDS_WINDOW_BUTTON_WIDTH);
s32 posx = RelativeRect.getWidth() - buttonw - 4; const s32 posx = RelativeRect.getWidth() - buttonw - 4;
CloseButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1, CloseButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1,
L"", skin ? skin->getDefaultText(EGDT_WINDOW_CLOSE) : L"Close"); L"", skin ? skin->getDefaultText(EGDT_WINDOW_CLOSE) : L"Close");

View File

@ -50,7 +50,6 @@ namespace gui
core::position2d<s32> DragStart; core::position2d<s32> DragStart;
core::stringw FileName; core::stringw FileName;
bool Dragging;
IGUIButton* CloseButton; IGUIButton* CloseButton;
IGUIButton* OKButton; IGUIButton* OKButton;
IGUIButton* CancelButton; IGUIButton* CancelButton;
@ -58,8 +57,8 @@ namespace gui
IGUIElement* FileNameText; IGUIElement* FileNameText;
IGUIElement* EventParent; IGUIElement* EventParent;
io::IFileSystem* FileSystem; io::IFileSystem* FileSystem;
io::IFileList* FileList; io::IFileList* FileList;
bool Dragging;
}; };

View File

@ -112,7 +112,7 @@ bool CGUIFont::load(io::IXMLReader* xml)
// parse rectangle // parse rectangle
core::stringc rectstr = xml->getAttributeValue(L"r"); core::stringc rectstr = xml->getAttributeValue(L"r");
wchar_t ch = xml->getAttributeValue(L"c")[0]; wchar_t ch = xml->getAttributeValue(L"c")[0];
const c8 *c = rectstr.c_str(); const c8 *c = rectstr.c_str();
s32 val; s32 val;
@ -158,7 +158,7 @@ bool CGUIFont::load(io::IXMLReader* xml)
CharacterMap.insert(ch,Areas.size()); CharacterMap.insert(ch,Areas.size());
// make frame // make frame
f.rectNumber = SpriteBank->getPositions().size(); f.rectNumber = SpriteBank->getPositions().size();
f.textureNumber = texno; f.textureNumber = texno;
// add frame to sprite // add frame to sprite
@ -481,7 +481,7 @@ core::dimension2d<u32> CGUIFont::getDimension(const wchar_t* text) const
//! set an Pixel Offset on Drawing ( scale position on width ) //! set an Pixel Offset on Drawing ( scale position on width )
void CGUIFont::setKerningWidth ( s32 kerning ) void CGUIFont::setKerningWidth(s32 kerning)
{ {
GlobalKerningWidth = kerning; GlobalKerningWidth = kerning;
} }
@ -507,7 +507,7 @@ s32 CGUIFont::getKerningWidth(const wchar_t* thisLetter, const wchar_t* previous
//! set an Pixel Offset on Drawing ( scale position on height ) //! set an Pixel Offset on Drawing ( scale position on height )
void CGUIFont::setKerningHeight ( s32 kerning ) void CGUIFont::setKerningHeight(s32 kerning)
{ {
GlobalKerningHeight = kerning; GlobalKerningHeight = kerning;
} }
@ -646,3 +646,4 @@ IGUISpriteBank* CGUIFont::getSpriteBank() const
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_

View File

@ -15,11 +15,10 @@ namespace gui
{ {
//! constructor //! constructor
CGUIImage::CGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) CGUIImage::CGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIImage(environment, parent, id, rectangle), Color(255,255,255,255), : IGUIImage(environment, parent, id, rectangle), Texture(0), Color(255,255,255,255),
Texture(0), UseAlphaChannel(false), ScaleImage(false) UseAlphaChannel(false), ScaleImage(false)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CGUIImage"); setDebugName("CGUIImage");
@ -27,7 +26,6 @@ CGUIImage::CGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id,
} }
//! destructor //! destructor
CGUIImage::~CGUIImage() CGUIImage::~CGUIImage()
{ {
@ -36,7 +34,6 @@ CGUIImage::~CGUIImage()
} }
//! sets an image //! sets an image
void CGUIImage::setImage(video::ITexture* image) void CGUIImage::setImage(video::ITexture* image)
{ {
@ -78,15 +75,13 @@ void CGUIImage::draw()
const video::SColor Colors[] = {Color,Color,Color,Color}; const video::SColor Colors[] = {Color,Color,Color,Color};
driver->draw2DImage(Texture, AbsoluteRect, driver->draw2DImage(Texture, AbsoluteRect,
core::rect<s32>(core::position2d<s32>(0,0), core::rect<s32>(core::position2d<s32>(0,0), Texture->getOriginalSize()),
core::dimension2d<s32>(Texture->getOriginalSize())),
&AbsoluteClippingRect, Colors, UseAlphaChannel); &AbsoluteClippingRect, Colors, UseAlphaChannel);
} }
else else
{ {
driver->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner, driver->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner,
core::rect<s32>(core::position2d<s32>(0,0), core::rect<s32>(core::position2d<s32>(0,0), Texture->getOriginalSize()),
core::dimension2d<s32>(Texture->getOriginalSize())),
&AbsoluteClippingRect, Color, UseAlphaChannel); &AbsoluteClippingRect, Color, UseAlphaChannel);
} }
} }
@ -105,12 +100,14 @@ void CGUIImage::setUseAlphaChannel(bool use)
UseAlphaChannel = use; UseAlphaChannel = use;
} }
//! sets if the image should use its alpha channel to draw itself //! sets if the image should use its alpha channel to draw itself
void CGUIImage::setScaleImage(bool scale) void CGUIImage::setScaleImage(bool scale)
{ {
ScaleImage = scale; ScaleImage = scale;
} }
//! Returns true if the image is scaled to fit, false if not //! Returns true if the image is scaled to fit, false if not
bool CGUIImage::isImageScaled() const bool CGUIImage::isImageScaled() const
{ {
@ -138,6 +135,7 @@ void CGUIImage::serializeAttributes(io::IAttributes* out, io::SAttributeReadWrit
} }
//! Reads attributes of the element //! Reads attributes of the element
void CGUIImage::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) void CGUIImage::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{ {
@ -150,10 +148,9 @@ void CGUIImage::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWri
} }
} // end namespace gui } // end namespace gui
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_

View File

@ -52,10 +52,9 @@ namespace gui
//! Reads attributes of the element //! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options); virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
private: private:
video::SColor Color;
video::ITexture* Texture; video::ITexture* Texture;
video::SColor Color;
bool UseAlphaChannel; bool UseAlphaChannel;
bool ScaleImage; bool ScaleImage;

View File

@ -63,7 +63,6 @@ void CGUIInOutFader::draw()
} }
//! Gets the color to fade out to or to fade in from. //! Gets the color to fade out to or to fade in from.
video::SColor CGUIInOutFader::getColor() const video::SColor CGUIInOutFader::getColor() const
{ {
@ -71,7 +70,6 @@ video::SColor CGUIInOutFader::getColor() const
} }
//! Sets the color to fade out to or to fade in from. //! Sets the color to fade out to or to fade in from.
void CGUIInOutFader::setColor(video::SColor color) void CGUIInOutFader::setColor(video::SColor color)
{ {
@ -90,7 +88,7 @@ void CGUIInOutFader::setColor(video::SColor color)
if (Action == EFA_FADE_OUT) if (Action == EFA_FADE_OUT)
{ {
FullColor.setAlpha(0); FullColor.setAlpha(0);
TransColor.setAlpha(255); TransColor.setAlpha(255);
} }
else else
@ -102,6 +100,7 @@ void CGUIInOutFader::setColor(video::SColor color)
*/ */
} }
void CGUIInOutFader::setColor(video::SColor source, video::SColor dest) void CGUIInOutFader::setColor(video::SColor source, video::SColor dest)
{ {
Color[0] = source; Color[0] = source;
@ -123,7 +122,7 @@ void CGUIInOutFader::setColor(video::SColor source, video::SColor dest)
//! Returns if the fade in or out process is done. //! Returns if the fade in or out process is done.
bool CGUIInOutFader::isReady() const bool CGUIInOutFader::isReady() const
{ {
u32 now = os::Timer::getTime(); u32 now = os::Timer::getTime();
bool ret = (now > EndTime); bool ret = (now > EndTime);
@ -132,7 +131,6 @@ bool CGUIInOutFader::isReady() const
} }
//! Starts the fade in process. //! Starts the fade in process.
void CGUIInOutFader::fadeIn(u32 time) void CGUIInOutFader::fadeIn(u32 time)
{ {
@ -152,6 +150,7 @@ void CGUIInOutFader::fadeOut(u32 time)
setColor(Color[0],Color[1]); setColor(Color[0],Color[1]);
} }
//! Writes attributes of the element. //! Writes attributes of the element.
void CGUIInOutFader::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const void CGUIInOutFader::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{ {
@ -162,6 +161,7 @@ void CGUIInOutFader::serializeAttributes(io::IAttributes* out, io::SAttributeRea
} }
//! Reads attributes of the element //! Reads attributes of the element
void CGUIInOutFader::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) void CGUIInOutFader::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{ {
@ -172,7 +172,6 @@ void CGUIInOutFader::deserializeAttributes(io::IAttributes* in, io::SAttributeRe
} }
} // end namespace gui } // end namespace gui
} // end namespace irr } // end namespace irr

View File

@ -59,12 +59,11 @@ namespace gui
u32 StartTime; u32 StartTime;
u32 EndTime; u32 EndTime;
EFadeAction Action; EFadeAction Action;
video::SColor Color[2]; video::SColor Color[2];
video::SColor FullColor; video::SColor FullColor;
video::SColor TransColor; video::SColor TransColor;
}; };
} // end namespace gui } // end namespace gui

View File

@ -25,9 +25,8 @@ CGUIListBox::CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent,
bool drawBack, bool moveOverSelect) bool drawBack, bool moveOverSelect)
: IGUIListBox(environment, parent, id, rectangle), Selected(-1), ItemHeight(0), : IGUIListBox(environment, parent, id, rectangle), Selected(-1), ItemHeight(0),
TotalItemHeight(0), ItemsIconWidth(0), Font(0), IconBank(0), TotalItemHeight(0), ItemsIconWidth(0), Font(0), IconBank(0),
ScrollBar(0), Selecting(false), DrawBack(drawBack), ScrollBar(0), selectTime(0), LastKeyTime(0), Selecting(false), DrawBack(drawBack),
MoveOverSelect(moveOverSelect), selectTime(0), AutoScroll(true), MoveOverSelect(moveOverSelect), AutoScroll(true), HighlightWhenNotFocused(true)
KeyBuffer(), LastKeyTime(0), HighlightWhenNotFocused(true)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CGUIListBox"); setDebugName("CGUIListBox");

View File

@ -23,7 +23,7 @@ namespace gui
{ {
public: public:
//! constructor //! constructor
CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle, bool clip=true, s32 id, core::rect<s32> rectangle, bool clip=true,
bool drawBack=false, bool moveOverSelect=false); bool drawBack=false, bool moveOverSelect=false);
@ -72,7 +72,7 @@ namespace gui
//! An icon is an index within the icon sprite bank. Several default icons are available in the //! An icon is an index within the icon sprite bank. Several default icons are available in the
//! skin through getIcon //! skin through getIcon
virtual void setSpriteBank(IGUISpriteBank* bank); virtual void setSpriteBank(IGUISpriteBank* bank);
//! sets if automatic scrolling is enabled or not. Default is true. //! sets if automatic scrolling is enabled or not. Default is true.
virtual void setAutoScrollEnabled(bool scroll); virtual void setAutoScrollEnabled(bool scroll);
@ -97,22 +97,22 @@ namespace gui
//! clear all item colors at index //! clear all item colors at index
virtual void clearItemOverrideColor(u32 index); virtual void clearItemOverrideColor(u32 index);
//! clear item color at index for given colortype //! clear item color at index for given colortype
virtual void clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType); virtual void clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType);
//! has the item at index its color overwritten? //! has the item at index its color overwritten?
virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const; virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const;
//! return the overwrite color at given item index. //! return the overwrite color at given item index.
virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const; virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const;
//! return the default color which is used for the given colorType //! return the default color which is used for the given colorType
virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const; virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const;
//! set the item at the given index //! set the item at the given index
virtual void setItem(u32 index, const wchar_t* text, s32 icon); virtual void setItem(u32 index, const wchar_t* text, s32 icon);
//! Insert the item at the given index //! Insert the item at the given index
//! Return the index on success or -1 on failure. //! Return the index on success or -1 on failure.
virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon); virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon);
@ -123,7 +123,7 @@ namespace gui
struct ListItem struct ListItem
{ {
ListItem() : icon(-1) ListItem() : icon(-1)
{} {}
core::stringw text; core::stringw text;
@ -157,13 +157,13 @@ namespace gui
gui::IGUIFont* Font; gui::IGUIFont* Font;
gui::IGUISpriteBank* IconBank; gui::IGUISpriteBank* IconBank;
gui::IGUIScrollBar* ScrollBar; gui::IGUIScrollBar* ScrollBar;
u32 selectTime;
u32 LastKeyTime;
core::stringw KeyBuffer;
bool Selecting; bool Selecting;
bool DrawBack; bool DrawBack;
bool MoveOverSelect; bool MoveOverSelect;
u32 selectTime;
bool AutoScroll; bool AutoScroll;
core::stringw KeyBuffer;
u32 LastKeyTime;
bool HighlightWhenNotFocused; bool HighlightWhenNotFocused;
}; };

View File

@ -19,8 +19,8 @@ namespace gui
//! constructor //! constructor
CGUIMenu::CGUIMenu(IGUIEnvironment* environment, IGUIElement* parent, CGUIMenu::CGUIMenu(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle) s32 id, core::rect<s32> rectangle)
: CGUIContextMenu(environment, parent, id, rectangle, false, true) : CGUIContextMenu(environment, parent, id, rectangle, false, true)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CGUIMenu"); setDebugName("CGUIMenu");
@ -42,7 +42,7 @@ void CGUIMenu::draw()
IGUISkin* skin = Environment->getSkin(); IGUISkin* skin = Environment->getSkin();
IGUIFont* font = skin->getFont(EGDF_MENU); IGUIFont* font = skin->getFont(EGDF_MENU);
if (font != LastFont) if (font != LastFont)
{ {
if (LastFont) if (LastFont)
@ -87,7 +87,7 @@ void CGUIMenu::draw()
c = EGDC_GRAY_TEXT; c = EGDC_GRAY_TEXT;
if (font) if (font)
font->draw(Items[i].Text.c_str(), rect, font->draw(Items[i].Text.c_str(), rect,
skin->getColor(c), true, true, &AbsoluteClippingRect); skin->getColor(c), true, true, &AbsoluteClippingRect);
} }
} }
@ -135,7 +135,7 @@ bool CGUIMenu::OnEvent(const SEvent& event)
} }
if (Parent) if (Parent)
Parent->bringToFront(this); Parent->bringToFront(this);
core::position2d<s32> p(event.MouseInput.X, event.MouseInput.Y); core::position2d<s32> p(event.MouseInput.X, event.MouseInput.Y);
bool shouldCloseSubMenu = hasOpenSubMenu(); bool shouldCloseSubMenu = hasOpenSubMenu();
@ -241,12 +241,14 @@ core::rect<s32> CGUIMenu::getHRect(const SItem& i, const core::rect<s32>& absolu
return r; return r;
} }
//! Gets drawing rect of Item //! Gets drawing rect of Item
core::rect<s32> CGUIMenu::getRect(const SItem& i, const core::rect<s32>& absolute) const core::rect<s32> CGUIMenu::getRect(const SItem& i, const core::rect<s32>& absolute) const
{ {
return getHRect(i, absolute); return getHRect(i, absolute);
} }
void CGUIMenu::updateAbsolutePosition() void CGUIMenu::updateAbsolutePosition()
{ {
if (Parent) if (Parent)

View File

@ -49,3 +49,4 @@ namespace gui
#endif // __C_GUI_MENU_H_INCLUDED__ #endif // __C_GUI_MENU_H_INCLUDED__
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_

View File

@ -172,4 +172,3 @@ void CGUIMeshViewer::draw()
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_

View File

@ -397,6 +397,7 @@ bool CGUIMessageBox::OnEvent(const SEvent& event)
return CGUIWindow::OnEvent(event); return CGUIWindow::OnEvent(event);
} }
//! Writes attributes of the element. //! Writes attributes of the element.
void CGUIMessageBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const void CGUIMessageBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{ {
@ -410,6 +411,7 @@ void CGUIMessageBox::serializeAttributes(io::IAttributes* out, io::SAttributeRea
out->addString ("MessageText", MessageText.c_str()); out->addString ("MessageText", MessageText.c_str());
} }
//! Reads attributes of the element //! Reads attributes of the element
void CGUIMessageBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) void CGUIMessageBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{ {
@ -431,6 +433,5 @@ void CGUIMessageBox::deserializeAttributes(io::IAttributes* in, io::SAttributeRe
} // end namespace gui } // end namespace gui
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_

View File

@ -57,4 +57,4 @@ namespace gui
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_
#endif #endif

View File

@ -24,7 +24,7 @@ CGUIModalScreen::CGUIModalScreen(IGUIEnvironment* environment, IGUIElement* pare
setDebugName("CGUIModalScreen"); setDebugName("CGUIModalScreen");
#endif #endif
setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT); setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
// this element is a tab group // this element is a tab group
setTabGroup(true); setTabGroup(true);
} }
@ -69,7 +69,7 @@ bool CGUIModalScreen::OnEvent(const SEvent& event)
default: default:
break; break;
} }
IGUIElement::OnEvent(event); IGUIElement::OnEvent(event);
return true; // absorb everything else return true; // absorb everything else
@ -110,7 +110,6 @@ void CGUIModalScreen::draw()
} }
//! Removes a child. //! Removes a child.
void CGUIModalScreen::removeChild(IGUIElement* child) void CGUIModalScreen::removeChild(IGUIElement* child)
{ {
@ -120,6 +119,7 @@ void CGUIModalScreen::removeChild(IGUIElement* child)
remove(); remove();
} }
//! adds a child //! adds a child
void CGUIModalScreen::addChild(IGUIElement* child) void CGUIModalScreen::addChild(IGUIElement* child)
{ {
@ -144,6 +144,7 @@ void CGUIModalScreen::updateAbsolutePosition()
IGUIElement::updateAbsolutePosition(); IGUIElement::updateAbsolutePosition();
} }
//! Writes attributes of the element. //! Writes attributes of the element.
void CGUIModalScreen::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const void CGUIModalScreen::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{ {
@ -161,3 +162,4 @@ void CGUIModalScreen::deserializeAttributes(io::IAttributes* in, io::SAttributeR
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_

View File

@ -56,3 +56,4 @@ namespace gui
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_
#endif #endif

View File

@ -185,7 +185,7 @@ bool CGUIScrollBar::OnEvent(const SEvent& event)
return true; return true;
} }
} }
if (DraggedBySlider) if (DraggedBySlider)
{ {
setPos(newPos); setPos(newPos);
@ -219,6 +219,7 @@ bool CGUIScrollBar::OnEvent(const SEvent& event)
return IGUIElement::OnEvent(event); return IGUIElement::OnEvent(event);
} }
//! draws the element and its children //! draws the element and its children
void CGUIScrollBar::draw() void CGUIScrollBar::draw()
{ {
@ -239,10 +240,10 @@ void CGUIScrollBar::draw()
if (DesiredPos >= Pos + LargeStep) if (DesiredPos >= Pos + LargeStep)
setPos(Pos + LargeStep); setPos(Pos + LargeStep);
else else
if (DesiredPos <= Pos - LargeStep) if (DesiredPos <= Pos - LargeStep)
setPos(Pos - LargeStep); setPos(Pos - LargeStep);
else else
if (DesiredPos >= Pos - LargeStep && DesiredPos <= Pos + LargeStep) if (DesiredPos >= Pos - LargeStep && DesiredPos <= Pos + LargeStep)
setPos(DesiredPos); setPos(DesiredPos);
@ -283,6 +284,7 @@ void CGUIScrollBar::draw()
IGUIElement::draw(); IGUIElement::draw();
} }
void CGUIScrollBar::updateAbsolutePosition() void CGUIScrollBar::updateAbsolutePosition()
{ {
IGUIElement::updateAbsolutePosition(); IGUIElement::updateAbsolutePosition();
@ -323,7 +325,6 @@ s32 CGUIScrollBar::getPosFromMousePos(s32 x, s32 y) const
} }
//! sets the position of the scrollbar //! sets the position of the scrollbar
void CGUIScrollBar::setPos(s32 pos) void CGUIScrollBar::setPos(s32 pos)
{ {
@ -368,6 +369,7 @@ void CGUIScrollBar::setSmallStep(s32 step)
SmallStep = 10; SmallStep = 10;
} }
//! gets the small step value //! gets the small step value
s32 CGUIScrollBar::getLargeStep() const s32 CGUIScrollBar::getLargeStep() const
{ {
@ -385,7 +387,6 @@ void CGUIScrollBar::setLargeStep(s32 step)
} }
//! gets the maximum value of the scrollbar. //! gets the maximum value of the scrollbar.
s32 CGUIScrollBar::getMax() const s32 CGUIScrollBar::getMax() const
{ {

View File

@ -23,9 +23,7 @@ CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver)
setDebugName("CGUISkin"); setDebugName("CGUISkin");
#endif #endif
if ( (Type == EGST_WINDOWS_CLASSIC) | if ((Type == EGST_WINDOWS_CLASSIC) || (Type == EGST_WINDOWS_METALLIC))
(Type == EGST_WINDOWS_METALLIC)
)
{ {
Colors[EGDC_3D_DARK_SHADOW] = video::SColor(101,50,50,50); Colors[EGDC_3D_DARK_SHADOW] = video::SColor(101,50,50,50);
Colors[EGDC_3D_SHADOW] = video::SColor(101,130,130,130); Colors[EGDC_3D_SHADOW] = video::SColor(101,130,130,130);
@ -57,7 +55,7 @@ CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver)
Sizes[EGDS_MESSAGE_BOX_HEIGHT] = 200; Sizes[EGDS_MESSAGE_BOX_HEIGHT] = 200;
Sizes[EGDS_BUTTON_WIDTH] = 80; Sizes[EGDS_BUTTON_WIDTH] = 80;
Sizes[EGDS_BUTTON_HEIGHT] = 30; Sizes[EGDS_BUTTON_HEIGHT] = 30;
Sizes[EGDS_TEXT_DISTANCE_X] = 2; Sizes[EGDS_TEXT_DISTANCE_X] = 2;
Sizes[EGDS_TEXT_DISTANCE_Y] = 0; Sizes[EGDS_TEXT_DISTANCE_Y] = 0;
} }
@ -68,7 +66,7 @@ CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver)
//Colors[EGDC_3D_FACE] = 0xc0c9ccd4; // tab background //Colors[EGDC_3D_FACE] = 0xc0c9ccd4; // tab background
Colors[EGDC_3D_FACE] = 0xc0cbd2d9; // tab background Colors[EGDC_3D_FACE] = 0xc0cbd2d9; // tab background
Colors[EGDC_3D_SHADOW] = 0x50e4e8f1; // tab background, and left-top highlight Colors[EGDC_3D_SHADOW] = 0x50e4e8f1; // tab background, and left-top highlight
Colors[EGDC_3D_HIGH_LIGHT] = 0x40c7ccdc; Colors[EGDC_3D_HIGH_LIGHT] = 0x40c7ccdc;
Colors[EGDC_3D_LIGHT] = 0x802e313a; Colors[EGDC_3D_LIGHT] = 0x802e313a;
Colors[EGDC_ACTIVE_BORDER] = 0x80404040; // window title Colors[EGDC_ACTIVE_BORDER] = 0x80404040; // window title
Colors[EGDC_ACTIVE_CAPTION] = 0xf0d0d0d0; Colors[EGDC_ACTIVE_CAPTION] = 0xf0d0d0d0;
@ -137,8 +135,7 @@ CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver)
for (u32 i=0; i<EGDF_COUNT; ++i) for (u32 i=0; i<EGDF_COUNT; ++i)
Fonts[i] = 0; Fonts[i] = 0;
UseGradient = (Type == EGST_WINDOWS_METALLIC) || UseGradient = (Type == EGST_WINDOWS_METALLIC) || (Type == EGST_BURNING_SKIN) ;
(Type == EGST_BURNING_SKIN) ;
} }
@ -156,7 +153,6 @@ CGUISkin::~CGUISkin()
} }
//! returns default color //! returns default color
video::SColor CGUISkin::getColor(EGUI_DEFAULT_COLOR color) const video::SColor CGUISkin::getColor(EGUI_DEFAULT_COLOR color) const
{ {
@ -193,7 +189,6 @@ void CGUISkin::setSize(EGUI_DEFAULT_SIZE which, s32 size)
} }
//! returns the default font //! returns the default font
IGUIFont* CGUISkin::getFont(EGUI_DEFAULT_FONT which) const IGUIFont* CGUISkin::getFont(EGUI_DEFAULT_FONT which) const
{ {
@ -203,6 +198,7 @@ IGUIFont* CGUISkin::getFont(EGUI_DEFAULT_FONT which) const
return Fonts[EGDF_DEFAULT]; return Fonts[EGDF_DEFAULT];
} }
//! sets a default font //! sets a default font
void CGUISkin::setFont(IGUIFont* font, EGUI_DEFAULT_FONT which) void CGUISkin::setFont(IGUIFont* font, EGUI_DEFAULT_FONT which)
{ {
@ -248,6 +244,7 @@ u32 CGUISkin::getIcon(EGUI_DEFAULT_ICON icon) const
return 0; return 0;
} }
//! Sets a default icon //! Sets a default icon
void CGUISkin::setIcon(EGUI_DEFAULT_ICON icon, u32 index) void CGUISkin::setIcon(EGUI_DEFAULT_ICON icon, u32 index)
{ {
@ -255,6 +252,7 @@ void CGUISkin::setIcon(EGUI_DEFAULT_ICON icon, u32 index)
Icons[icon] = index; Icons[icon] = index;
} }
//! Returns a default text. For example for Message box button captions: //! Returns a default text. For example for Message box button captions:
//! "OK", "Cancel", "Yes", "No" and so on. //! "OK", "Cancel", "Yes", "No" and so on.
const wchar_t* CGUISkin::getDefaultText(EGUI_DEFAULT_TEXT text) const const wchar_t* CGUISkin::getDefaultText(EGUI_DEFAULT_TEXT text) const
@ -274,6 +272,7 @@ void CGUISkin::setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText)
Texts[which] = newText; Texts[which] = newText;
} }
//! draws a standard 3d button pane //! draws a standard 3d button pane
/** Used for drawing for example buttons in normal state. /** Used for drawing for example buttons in normal state.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
@ -380,7 +379,7 @@ is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param bgcolor: Background color. \param bgcolor: Background color.
\param flat: Specifies if the sunken pane should be flat or displayed as sunken \param flat: Specifies if the sunken pane should be flat or displayed as sunken
deep into the ground. deep into the ground.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area. */
void CGUISkin::draw3DSunkenPane(IGUIElement* element, video::SColor bgcolor, void CGUISkin::draw3DSunkenPane(IGUIElement* element, video::SColor bgcolor,
@ -562,7 +561,7 @@ void CGUISkin::draw3DMenuPane(IGUIElement* element,
core::rect<s32> rect = r; core::rect<s32> rect = r;
if ( Type == EGST_BURNING_SKIN ) if ( Type == EGST_BURNING_SKIN )
{ {
rect.UpperLeftCorner.Y -= 3; rect.UpperLeftCorner.Y -= 3;
draw3DButtonPaneStandard(element, rect, clip); draw3DButtonPaneStandard(element, rect, clip);
return; return;
@ -693,7 +692,7 @@ void CGUISkin::draw3DTabButton(IGUIElement* element, bool active,
tr.LowerRightCorner.Y = tr.UpperLeftCorner.Y + 1; tr.LowerRightCorner.Y = tr.UpperLeftCorner.Y + 1;
tr.UpperLeftCorner.X += 1; tr.UpperLeftCorner.X += 1;
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip); Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip);
// draw left highlight // draw left highlight
tr = frameRect; tr = frameRect;
tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1;
@ -707,17 +706,15 @@ void CGUISkin::draw3DTabButton(IGUIElement* element, bool active,
tr.LowerRightCorner.X -= 2; tr.LowerRightCorner.X -= 2;
Driver->draw2DRectangle(getColor(EGDC_3D_FACE), tr, clip); Driver->draw2DRectangle(getColor(EGDC_3D_FACE), tr, clip);
// draw right middle gray shadow // draw right middle gray shadow
tr.LowerRightCorner.X += 1; tr.LowerRightCorner.X += 1;
tr.UpperLeftCorner.X = tr.LowerRightCorner.X - 1; tr.UpperLeftCorner.X = tr.LowerRightCorner.X - 1;
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip); Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip);
tr.LowerRightCorner.X += 1; tr.LowerRightCorner.X += 1;
tr.UpperLeftCorner.X += 1; tr.UpperLeftCorner.X += 1;
tr.UpperLeftCorner.Y += 1; tr.UpperLeftCorner.Y += 1;
Driver->draw2DRectangle(getColor(EGDC_3D_DARK_SHADOW), tr, clip); Driver->draw2DRectangle(getColor(EGDC_3D_DARK_SHADOW), tr, clip);
} }
else else
{ {
@ -725,7 +722,7 @@ void CGUISkin::draw3DTabButton(IGUIElement* element, bool active,
tr.UpperLeftCorner.Y = tr.LowerRightCorner.Y - 1; tr.UpperLeftCorner.Y = tr.LowerRightCorner.Y - 1;
tr.UpperLeftCorner.X += 1; tr.UpperLeftCorner.X += 1;
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip); Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip);
// draw left highlight // draw left highlight
tr = frameRect; tr = frameRect;
tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1;
@ -739,20 +736,18 @@ void CGUISkin::draw3DTabButton(IGUIElement* element, bool active,
tr.LowerRightCorner.X -= 2; tr.LowerRightCorner.X -= 2;
tr.LowerRightCorner.Y -= 1; tr.LowerRightCorner.Y -= 1;
Driver->draw2DRectangle(getColor(EGDC_3D_FACE), tr, clip); Driver->draw2DRectangle(getColor(EGDC_3D_FACE), tr, clip);
// draw right middle gray shadow // draw right middle gray shadow
tr.LowerRightCorner.X += 1; tr.LowerRightCorner.X += 1;
tr.UpperLeftCorner.X = tr.LowerRightCorner.X - 1; tr.UpperLeftCorner.X = tr.LowerRightCorner.X - 1;
//tr.LowerRightCorner.Y -= 1; //tr.LowerRightCorner.Y -= 1;
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip); Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip);
tr.LowerRightCorner.X += 1; tr.LowerRightCorner.X += 1;
tr.UpperLeftCorner.X += 1; tr.UpperLeftCorner.X += 1;
tr.LowerRightCorner.Y -= 1; tr.LowerRightCorner.Y -= 1;
Driver->draw2DRectangle(getColor(EGDC_3D_DARK_SHADOW), tr, clip); Driver->draw2DRectangle(getColor(EGDC_3D_DARK_SHADOW), tr, clip);
} }
} }
@ -785,7 +780,6 @@ void CGUISkin::draw3DTabBody(IGUIElement* element, bool border, bool background,
tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1;
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip); Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip);
// draw right shadow // draw right shadow
tr.UpperLeftCorner.X = rect.LowerRightCorner.X - 1; tr.UpperLeftCorner.X = rect.LowerRightCorner.X - 1;
tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1;
@ -795,7 +789,6 @@ void CGUISkin::draw3DTabBody(IGUIElement* element, bool border, bool background,
tr = rect; tr = rect;
tr.UpperLeftCorner.Y = tr.LowerRightCorner.Y - 1; tr.UpperLeftCorner.Y = tr.LowerRightCorner.Y - 1;
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip); Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip);
} }
else else
{ {
@ -803,23 +796,21 @@ void CGUISkin::draw3DTabBody(IGUIElement* element, bool border, bool background,
tr.LowerRightCorner.Y -= tabHeight + 2; tr.LowerRightCorner.Y -= tabHeight + 2;
tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1;
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip); Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip);
// draw right shadow // draw right shadow
tr.UpperLeftCorner.X = rect.LowerRightCorner.X - 1; tr.UpperLeftCorner.X = rect.LowerRightCorner.X - 1;
tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1;
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip); Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip);
// draw lower shadow // draw lower shadow
tr = rect; tr = rect;
tr.LowerRightCorner.Y = tr.UpperLeftCorner.Y + 1; tr.LowerRightCorner.Y = tr.UpperLeftCorner.Y + 1;
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip); Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip);
} }
} }
if (background) if (background)
{ {
if ( alignment == EGUIA_UPPERLEFT ) if ( alignment == EGUIA_UPPERLEFT )
{ {
tr = rect; tr = rect;
@ -851,9 +842,9 @@ void CGUISkin::draw3DTabBody(IGUIElement* element, bool border, bool background,
//! draws an icon, usually from the skin's sprite bank //! draws an icon, usually from the skin's sprite bank
/** \param parent: Pointer to the element which wishes to draw this icon. /** \param parent: Pointer to the element which wishes to draw this icon.
This parameter is usually not used by IGUISkin, but can be used for example This parameter is usually not used by IGUISkin, but can be used for example
by more complex implementations to find out how to draw the part exactly. by more complex implementations to find out how to draw the part exactly.
\param icon: Specifies the icon to be drawn. \param icon: Specifies the icon to be drawn.
\param position: The position to draw the icon \param position: The position to draw the icon
\param starttime: The time at the start of the animation \param starttime: The time at the start of the animation
@ -862,13 +853,13 @@ by more complex implementations to find out how to draw the part exactly.
\param clip: Clip area. */ \param clip: Clip area. */
void CGUISkin::drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon, void CGUISkin::drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
const core::position2di position, const core::position2di position,
u32 starttime, u32 currenttime, u32 starttime, u32 currenttime,
bool loop, const core::rect<s32>* clip) bool loop, const core::rect<s32>* clip)
{ {
if (!SpriteBank) if (!SpriteBank)
return; return;
SpriteBank->draw2DSprite(Icons[icon], position, clip, SpriteBank->draw2DSprite(Icons[icon], position, clip,
video::SColor(255,0,0,0), starttime, currenttime, loop, true); video::SColor(255,0,0,0), starttime, currenttime, loop, true);
} }
@ -889,7 +880,7 @@ void CGUISkin::draw2DRectangle(IGUIElement* element,
//! Writes attributes of the object. //! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for //! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes. //! scripting languages, editors, debuggers or xml serialization purposes.
void CGUISkin::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const void CGUISkin::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{ {
@ -909,7 +900,7 @@ void CGUISkin::serializeAttributes(io::IAttributes* out, io::SAttributeReadWrite
//! Reads attributes of the object. //! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for //! Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes. //! scripting languages, editors, debuggers or xml deserialization purposes.
void CGUISkin::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) void CGUISkin::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{ {
@ -933,4 +924,3 @@ void CGUISkin::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWrit
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_

View File

@ -58,56 +58,56 @@ namespace gui
virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const; virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const;
//! Sets a default icon //! Sets a default icon
/** Sets the sprite index used for drawing icons like arrows, /** Sets the sprite index used for drawing icons like arrows,
close buttons and ticks in checkboxes close buttons and ticks in checkboxes
\param icon: Enum specifying which icon to change \param icon: Enum specifying which icon to change
\param index: The sprite index used to draw this icon */ \param index: The sprite index used to draw this icon */
virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index); virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index);
//! Returns a default text. //! Returns a default text.
/** For example for Message box button captions: /** For example for Message box button captions:
"OK", "Cancel", "Yes", "No" and so on. */ "OK", "Cancel", "Yes", "No" and so on. */
virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const; virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const;
//! Sets a default text. //! Sets a default text.
/** For example for Message box button captions: /** For example for Message box button captions:
"OK", "Cancel", "Yes", "No" and so on. */ "OK", "Cancel", "Yes", "No" and so on. */
virtual void setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText); virtual void setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText);
//! draws a standard 3d button pane //! draws a standard 3d button pane
/** Used for drawing for example buttons in normal state. /** Used for drawing for example buttons in normal state.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details. EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. \param clip: Clip area.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. */ implementations to find out how to draw the part exactly. */
virtual void draw3DButtonPaneStandard(IGUIElement* element, virtual void draw3DButtonPaneStandard(IGUIElement* element,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0); const core::rect<s32>* clip=0);
//! draws a pressed 3d button pane //! draws a pressed 3d button pane
/** Used for drawing for example buttons in pressed state. /** Used for drawing for example buttons in pressed state.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details. EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. \param clip: Clip area.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. */ implementations to find out how to draw the part exactly. */
virtual void draw3DButtonPanePressed(IGUIElement* element, virtual void draw3DButtonPanePressed(IGUIElement* element,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0); const core::rect<s32>* clip=0);
//! draws a sunken 3d pane //! draws a sunken 3d pane
/** Used for drawing the background of edit, combo or check boxes. /** Used for drawing the background of edit, combo or check boxes.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param bgcolor: Background color. \param bgcolor: Background color.
\param flat: Specifies if the sunken pane should be flat or displayed as sunken \param flat: Specifies if the sunken pane should be flat or displayed as sunken
deep into the ground. deep into the ground.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area. */
virtual void draw3DSunkenPane(IGUIElement* element, virtual void draw3DSunkenPane(IGUIElement* element,
@ -119,8 +119,8 @@ namespace gui
//! draws a window background //! draws a window background
/** Used for drawing the background of dialogs and windows. /** Used for drawing the background of dialogs and windows.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param titleBarColor: Title color. \param titleBarColor: Title color.
\param drawTitleBar: True to enable title drawing. \param drawTitleBar: True to enable title drawing.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
@ -132,12 +132,12 @@ namespace gui
const core::rect<s32>* clip=0); const core::rect<s32>* clip=0);
//! draws a standard 3d menu pane //! draws a standard 3d menu pane
/** Used for drawing for menus and context menus. /** Used for drawing for menus and context menus.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details. EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area. */
virtual void draw3DMenuPane(IGUIElement* element, virtual void draw3DMenuPane(IGUIElement* element,
@ -145,10 +145,10 @@ namespace gui
const core::rect<s32>* clip=0); const core::rect<s32>* clip=0);
//! draws a standard 3d tool bar //! draws a standard 3d tool bar
/** Used for drawing for toolbars and menus. /** Used for drawing for toolbars and menus.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area. */
virtual void draw3DToolBar(IGUIElement* element, virtual void draw3DToolBar(IGUIElement* element,
@ -156,10 +156,10 @@ namespace gui
const core::rect<s32>* clip=0); const core::rect<s32>* clip=0);
//! draws a tab button //! draws a tab button
/** Used for drawing for tab buttons on top of tabs. /** Used for drawing for tab buttons on top of tabs.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param active: Specifies if the tab is currently active. \param active: Specifies if the tab is currently active.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area. */
@ -167,9 +167,9 @@ namespace gui
const core::rect<s32>& rect, const core::rect<s32>* clip=0, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT); const core::rect<s32>& rect, const core::rect<s32>* clip=0, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT);
//! draws a tab control body //! draws a tab control body
/** \param element: Pointer to the element which wishes to draw this. This parameter /** \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param border: Specifies if the border should be drawn. \param border: Specifies if the border should be drawn.
\param background: Specifies if the background should be drawn. \param background: Specifies if the background should be drawn.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
@ -178,9 +178,9 @@ namespace gui
const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT); const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT);
//! draws an icon, usually from the skin's sprite bank //! draws an icon, usually from the skin's sprite bank
/** \param element: Pointer to the element which wishes to draw this icon. /** \param element: Pointer to the element which wishes to draw this icon.
This parameter is usually not used by IGUISkin, but can be used for example This parameter is usually not used by IGUISkin, but can be used for example
by more complex implementations to find out how to draw the part exactly. by more complex implementations to find out how to draw the part exactly.
\param icon: Specifies the icon to be drawn. \param icon: Specifies the icon to be drawn.
\param position: The position to draw the icon \param position: The position to draw the icon
\param starttime: The time at the start of the animation \param starttime: The time at the start of the animation
@ -189,20 +189,20 @@ namespace gui
\param clip: Clip area. */ \param clip: Clip area. */
virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon, virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
const core::position2di position, const core::position2di position,
u32 starttime=0, u32 currenttime=0, u32 starttime=0, u32 currenttime=0,
bool loop=false, const core::rect<s32>* clip=0); bool loop=false, const core::rect<s32>* clip=0);
//! draws a 2d rectangle. //! draws a 2d rectangle.
/** \param element: Pointer to the element which wishes to draw this icon. /** \param element: Pointer to the element which wishes to draw this icon.
This parameter is usually not used by IGUISkin, but can be used for example This parameter is usually not used by IGUISkin, but can be used for example
by more complex implementations to find out how to draw the part exactly. by more complex implementations to find out how to draw the part exactly.
\param color: Color of the rectangle to draw. The alpha component specifies how \param color: Color of the rectangle to draw. The alpha component specifies how
transparent the rectangle will be. transparent the rectangle will be.
\param pos: Position of the rectangle. \param pos: Position of the rectangle.
\param clip: Pointer to rectangle against which the rectangle will be clipped. \param clip: Pointer to rectangle against which the rectangle will be clipped.
If the pointer is null, no clipping will be performed. */ If the pointer is null, no clipping will be performed. */
virtual void draw2DRectangle(IGUIElement* element, const video::SColor &color, virtual void draw2DRectangle(IGUIElement* element, const video::SColor &color,
const core::rect<s32>& pos, const core::rect<s32>* clip = 0); const core::rect<s32>& pos, const core::rect<s32>* clip = 0);
@ -210,12 +210,12 @@ namespace gui
virtual EGUI_SKIN_TYPE getType() const; virtual EGUI_SKIN_TYPE getType() const;
//! Writes attributes of the object. //! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for //! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes. //! scripting languages, editors, debuggers or xml serialization purposes.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
//! Reads attributes of the object. //! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for //! Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes. //! scripting languages, editors, debuggers or xml deserialization purposes.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0); virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);

View File

@ -255,6 +255,7 @@ void CGUISpinBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWr
out->addInt("DecimalPlaces", DecimalPlaces); out->addInt("DecimalPlaces", DecimalPlaces);
} }
//! Reads attributes of the element //! Reads attributes of the element
void CGUISpinBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) void CGUISpinBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{ {

View File

@ -47,12 +47,11 @@ public:
protected: protected:
core::array<SGUISprite> Sprites; core::array<SGUISprite> Sprites;
core::array< core::rect<s32> > Rectangles; core::array< core::rect<s32> > Rectangles;
core::array<video::ITexture*> Textures; core::array<video::ITexture*> Textures;
IGUIEnvironment* Environment; IGUIEnvironment* Environment;
video::IVideoDriver* Driver; video::IVideoDriver* Driver;
}; };
} // end namespace gui } // end namespace gui
@ -62,4 +61,3 @@ protected:
#endif // __C_GUI_SPRITE_BANK_H_INCLUDED__ #endif // __C_GUI_SPRITE_BANK_H_INCLUDED__

View File

@ -21,9 +21,9 @@ CGUIStaticText::CGUIStaticText(const wchar_t* text, bool border,
IGUIEnvironment* environment, IGUIElement* parent, IGUIEnvironment* environment, IGUIElement* parent,
s32 id, const core::rect<s32>& rectangle, s32 id, const core::rect<s32>& rectangle,
bool background) bool background)
: IGUIStaticText(environment, parent, id, rectangle), Border(border), : IGUIStaticText(environment, parent, id, rectangle),
HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_UPPERLEFT), HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_UPPERLEFT),
OverrideColorEnabled(false), WordWrap(false), Background(background), Border(border), OverrideColorEnabled(false), WordWrap(false), Background(background),
OverrideColor(video::SColor(101,255,255,255)), BGColor(video::SColor(101,210,210,210)), OverrideColor(video::SColor(101,255,255,255)), BGColor(video::SColor(101,210,210,210)),
OverrideFont(0), LastBreakFont(0) OverrideFont(0), LastBreakFont(0)
{ {
@ -88,12 +88,12 @@ void CGUIStaticText::draw()
{ {
if (VAlign == EGUIA_LOWERRIGHT) if (VAlign == EGUIA_LOWERRIGHT)
{ {
frameRect.UpperLeftCorner.Y = frameRect.LowerRightCorner.Y - frameRect.UpperLeftCorner.Y = frameRect.LowerRightCorner.Y -
font->getDimension(L"A").Height - font->getKerningHeight(); font->getDimension(L"A").Height - font->getKerningHeight();
} }
if (HAlign == EGUIA_LOWERRIGHT) if (HAlign == EGUIA_LOWERRIGHT)
{ {
frameRect.UpperLeftCorner.X = frameRect.LowerRightCorner.X - frameRect.UpperLeftCorner.X = frameRect.LowerRightCorner.X -
font->getDimension(Text.c_str()).Width; font->getDimension(Text.c_str()).Width;
} }
@ -122,7 +122,7 @@ void CGUIStaticText::draw()
{ {
if (HAlign == EGUIA_LOWERRIGHT) if (HAlign == EGUIA_LOWERRIGHT)
{ {
r.UpperLeftCorner.X = frameRect.LowerRightCorner.X - r.UpperLeftCorner.X = frameRect.LowerRightCorner.X -
font->getDimension(BrokenText[i].c_str()).Width; font->getDimension(BrokenText[i].c_str()).Width;
} }
@ -349,6 +349,7 @@ void CGUIStaticText::setText(const wchar_t* text)
breakText(); breakText();
} }
void CGUIStaticText::updateAbsolutePosition() void CGUIStaticText::updateAbsolutePosition()
{ {
IGUIElement::updateAbsolutePosition(); IGUIElement::updateAbsolutePosition();

View File

@ -91,8 +91,8 @@ namespace gui
//! Breaks the single text line. //! Breaks the single text line.
void breakText(); void breakText();
bool Border;
EGUI_ALIGNMENT HAlign, VAlign; EGUI_ALIGNMENT HAlign, VAlign;
bool Border;
bool OverrideColorEnabled; bool OverrideColorEnabled;
bool WordWrap; bool WordWrap;
bool Background; bool Background;

View File

@ -24,20 +24,19 @@ namespace gui
//! constructor //! constructor
CGUITab::CGUITab(s32 number, IGUIEnvironment* environment, CGUITab::CGUITab(s32 number, IGUIEnvironment* environment,
IGUIElement* parent, const core::rect<s32>& rectangle, IGUIElement* parent, const core::rect<s32>& rectangle,
s32 id) s32 id)
: IGUITab(environment, parent, id, rectangle), Number(number), : IGUITab(environment, parent, id, rectangle), Number(number),
DrawBackground(false), BackColor(0,0,0,0) BackColor(0,0,0,0), TextColor(255,0,0,0),
DrawBackground(false)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CGUITab"); setDebugName("CGUITab");
#endif #endif
IGUISkin* skin = environment->getSkin(); const IGUISkin* const skin = environment->getSkin();
if (skin) if (skin)
TextColor = skin->getColor(EGDC_BUTTON_TEXT); TextColor = skin->getColor(EGDC_BUTTON_TEXT);
else
TextColor.set(255,0,0,0);
} }
@ -84,17 +83,20 @@ void CGUITab::setBackgroundColor(video::SColor c)
BackColor = c; BackColor = c;
} }
//! sets the color of the text //! sets the color of the text
void CGUITab::setTextColor(video::SColor c) void CGUITab::setTextColor(video::SColor c)
{ {
TextColor = c; TextColor = c;
} }
video::SColor CGUITab::getTextColor() const video::SColor CGUITab::getTextColor() const
{ {
return TextColor; return TextColor;
} }
//! returns true if the tab is drawing its background, false if not //! returns true if the tab is drawing its background, false if not
bool CGUITab::isDrawingBackground() const bool CGUITab::isDrawingBackground() const
{ {
@ -148,7 +150,7 @@ void CGUITab::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWrite
//! constructor //! constructor
CGUITabControl::CGUITabControl(IGUIEnvironment* environment, CGUITabControl::CGUITabControl(IGUIEnvironment* environment,
IGUIElement* parent, const core::rect<s32>& rectangle, IGUIElement* parent, const core::rect<s32>& rectangle,
bool fillbackground, bool border, s32 id) bool fillbackground, bool border, s32 id)
: IGUITabControl(environment, parent, id, rectangle), ActiveTab(-1), : IGUITabControl(environment, parent, id, rectangle), ActiveTab(-1),
Border(border), FillBackground(fillbackground), ScrollControl(false), TabHeight(0), VerticalAlignment(EGUIA_UPPERLEFT), Border(border), FillBackground(fillbackground), ScrollControl(false), TabHeight(0), VerticalAlignment(EGUIA_UPPERLEFT),
@ -156,7 +158,7 @@ CGUITabControl::CGUITabControl(IGUIEnvironment* environment,
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CGUITabControl"); setDebugName("CGUITabControl");
#endif #endif
video::SColor color(255,255,255,255); video::SColor color(255,255,255,255);
IGUISkin* skin = Environment->getSkin(); IGUISkin* skin = Environment->getSkin();
@ -195,7 +197,7 @@ CGUITabControl::CGUITabControl(IGUIEnvironment* environment,
DownButton->setVisible(false); DownButton->setVisible(false);
DownButton->setSubElement(true); DownButton->setSubElement(true);
DownButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); DownButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
DownButton->setOverrideFont(Environment->getBuiltInFont()); DownButton->setOverrideFont(Environment->getBuiltInFont());
DownButton->grab(); DownButton->grab();
} }
@ -370,6 +372,7 @@ bool CGUITabControl::OnEvent(const SEvent& event)
return IGUIElement::OnEvent(event); return IGUIElement::OnEvent(event);
} }
void CGUITabControl::scrollLeft() void CGUITabControl::scrollLeft()
{ {
if ( CurrentScrollTabIndex > 0 ) if ( CurrentScrollTabIndex > 0 )
@ -377,6 +380,7 @@ void CGUITabControl::scrollLeft()
recalculateScrollBar(); recalculateScrollBar();
} }
void CGUITabControl::scrollRight() void CGUITabControl::scrollRight()
{ {
if ( CurrentScrollTabIndex < (s32)(Tabs.size()) - 1 ) if ( CurrentScrollTabIndex < (s32)(Tabs.size()) - 1 )
@ -387,6 +391,7 @@ void CGUITabControl::scrollRight()
recalculateScrollBar(); recalculateScrollBar();
} }
bool CGUITabControl::needScrollControl(s32 startIndex, bool withScrollControl) bool CGUITabControl::needScrollControl(s32 startIndex, bool withScrollControl)
{ {
if ( startIndex >= (s32)Tabs.size() ) if ( startIndex >= (s32)Tabs.size() )
@ -437,6 +442,7 @@ bool CGUITabControl::needScrollControl(s32 startIndex, bool withScrollControl)
return false; return false;
} }
bool CGUITabControl::selectTab(core::position2d<s32> p) bool CGUITabControl::selectTab(core::position2d<s32> p)
{ {
IGUISkin* skin = Environment->getSkin(); IGUISkin* skin = Environment->getSkin();
@ -506,7 +512,7 @@ void CGUITabControl::draw()
if (!font) if (!font)
return; return;
if ( VerticalAlignment == EGUIA_UPPERLEFT ) if ( VerticalAlignment == EGUIA_UPPERLEFT )
{ {
frameRect.UpperLeftCorner.Y += 2; frameRect.UpperLeftCorner.Y += 2;
@ -567,7 +573,7 @@ void CGUITabControl::draw()
// draw active tab // draw active tab
if (left != 0 && right != 0 && activeTab != 0) if (left != 0 && right != 0 && activeTab != 0)
{ {
// draw upper highlight frame // draw upper highlight frame
if ( VerticalAlignment == EGUIA_UPPERLEFT ) if ( VerticalAlignment == EGUIA_UPPERLEFT )
{ {
@ -576,7 +582,7 @@ void CGUITabControl::draw()
frameRect.UpperLeftCorner.Y -= 2; frameRect.UpperLeftCorner.Y -= 2;
skin->draw3DTabButton(this, true, frameRect, &AbsoluteClippingRect, VerticalAlignment); skin->draw3DTabButton(this, true, frameRect, &AbsoluteClippingRect, VerticalAlignment);
// draw text // draw text
font->draw(activeTab->getText(), frameRect, activeTab->getTextColor(), font->draw(activeTab->getText(), frameRect, activeTab->getTextColor(),
true, true, &AbsoluteClippingRect); true, true, &AbsoluteClippingRect);
@ -599,7 +605,7 @@ void CGUITabControl::draw()
frameRect.LowerRightCorner.Y += 2; frameRect.LowerRightCorner.Y += 2;
skin->draw3DTabButton(this, true, frameRect, &AbsoluteClippingRect, VerticalAlignment); skin->draw3DTabButton(this, true, frameRect, &AbsoluteClippingRect, VerticalAlignment);
// draw text // draw text
font->draw(activeTab->getText(), frameRect, activeTab->getTextColor(), font->draw(activeTab->getText(), frameRect, activeTab->getTextColor(),
true, true, &AbsoluteClippingRect); true, true, &AbsoluteClippingRect);
@ -640,6 +646,7 @@ void CGUITabControl::draw()
IGUIElement::draw(); IGUIElement::draw();
} }
//! Set the height of the tabs //! Set the height of the tabs
void CGUITabControl::setTabHeight( s32 height ) void CGUITabControl::setTabHeight( s32 height )
{ {
@ -653,12 +660,14 @@ void CGUITabControl::setTabHeight( s32 height )
recalculateScrollBar(); recalculateScrollBar();
} }
//! Get the height of the tabs //! Get the height of the tabs
s32 CGUITabControl::getTabHeight() const s32 CGUITabControl::getTabHeight() const
{ {
return TabHeight; return TabHeight;
} }
//! Set the extra width added to tabs on each side of the text //! Set the extra width added to tabs on each side of the text
void CGUITabControl::setTabExtraWidth( s32 extraWidth ) void CGUITabControl::setTabExtraWidth( s32 extraWidth )
{ {
@ -670,18 +679,20 @@ void CGUITabControl::setTabExtraWidth( s32 extraWidth )
recalculateScrollBar(); recalculateScrollBar();
} }
//! Get the extra width added to tabs on each side of the text //! Get the extra width added to tabs on each side of the text
s32 CGUITabControl::getTabExtraWidth() const s32 CGUITabControl::getTabExtraWidth() const
{ {
return TabExtraWidth; return TabExtraWidth;
} }
void CGUITabControl::recalculateScrollBar() void CGUITabControl::recalculateScrollBar()
{ {
ScrollControl = needScrollControl() || CurrentScrollTabIndex > 0; ScrollControl = needScrollControl() || CurrentScrollTabIndex > 0;
if (ScrollControl) if (ScrollControl)
{ {
UpButton->setVisible( true ); UpButton->setVisible( true );
DownButton->setVisible( true ); DownButton->setVisible( true );
} }
@ -695,6 +706,7 @@ void CGUITabControl::recalculateScrollBar()
this->bringToFront( DownButton ); this->bringToFront( DownButton );
} }
//! Set the alignment of the tabs //! Set the alignment of the tabs
void CGUITabControl::setTabVerticalAlignment( EGUI_ALIGNMENT alignment ) void CGUITabControl::setTabVerticalAlignment( EGUI_ALIGNMENT alignment )
{ {
@ -725,7 +737,7 @@ void CGUITabControl::setTabVerticalAlignment( EGUI_ALIGNMENT alignment )
UpButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT); UpButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT);
DownButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT); DownButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT);
} }
UpButton->setRelativePosition(core::rect<s32>(ButtonX, ButtonY, ButtonX+ButtonSize, ButtonY+ButtonSize)); UpButton->setRelativePosition(core::rect<s32>(ButtonX, ButtonY, ButtonX+ButtonSize, ButtonY+ButtonSize));
ButtonX += ButtonSize + 1; ButtonX += ButtonSize + 1;
DownButton->setRelativePosition(core::rect<s32>(ButtonX, ButtonY, ButtonX+ButtonSize, ButtonY+ButtonSize)); DownButton->setRelativePosition(core::rect<s32>(ButtonX, ButtonY, ButtonX+ButtonSize, ButtonY+ButtonSize));
@ -733,18 +745,21 @@ void CGUITabControl::setTabVerticalAlignment( EGUI_ALIGNMENT alignment )
recalculateScrollBar(); recalculateScrollBar();
} }
//! Get the alignment of the tabs //! Get the alignment of the tabs
EGUI_ALIGNMENT CGUITabControl::getTabVerticalAlignment() const EGUI_ALIGNMENT CGUITabControl::getTabVerticalAlignment() const
{ {
return VerticalAlignment; return VerticalAlignment;
} }
//! Returns which tab is currently active //! Returns which tab is currently active
s32 CGUITabControl::getActiveTab() const s32 CGUITabControl::getActiveTab() const
{ {
return ActiveTab; return ActiveTab;
} }
//! Brings a tab to front. //! Brings a tab to front.
bool CGUITabControl::setActiveTab(s32 idx) bool CGUITabControl::setActiveTab(s32 idx)
{ {
@ -766,12 +781,13 @@ bool CGUITabControl::setActiveTab(s32 idx)
event.GUIEvent.Caller = this; event.GUIEvent.Caller = this;
event.GUIEvent.Element = 0; event.GUIEvent.Element = 0;
event.GUIEvent.EventType = EGET_TAB_CHANGED; event.GUIEvent.EventType = EGET_TAB_CHANGED;
Parent->OnEvent(event); Parent->OnEvent(event);
} }
return true; return true;
} }
bool CGUITabControl::setActiveTab(IGUIElement *tab) bool CGUITabControl::setActiveTab(IGUIElement *tab)
{ {
for (s32 i=0; i<(s32)Tabs.size(); ++i) for (s32 i=0; i<(s32)Tabs.size(); ++i)
@ -780,6 +796,7 @@ bool CGUITabControl::setActiveTab(IGUIElement *tab)
return false; return false;
} }
//! Removes a child. //! Removes a child.
void CGUITabControl::removeChild(IGUIElement* child) void CGUITabControl::removeChild(IGUIElement* child)
{ {
@ -813,6 +830,7 @@ void CGUITabControl::removeChild(IGUIElement* child)
recalculateScrollBar(); recalculateScrollBar();
} }
//! Update the position of the element, decides scroll button status //! Update the position of the element, decides scroll button status
void CGUITabControl::updateAbsolutePosition() void CGUITabControl::updateAbsolutePosition()
{ {
@ -820,6 +838,7 @@ void CGUITabControl::updateAbsolutePosition()
recalculateScrollBar(); recalculateScrollBar();
} }
//! Writes attributes of the element. //! Writes attributes of the element.
void CGUITabControl::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const void CGUITabControl::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{ {
@ -855,4 +874,3 @@ void CGUITabControl::deserializeAttributes(io::IAttributes* in, io::SAttributeRe
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_

View File

@ -47,7 +47,7 @@ namespace gui
//! sets the color of the background, if it should be drawn. //! sets the color of the background, if it should be drawn.
virtual void setBackgroundColor(video::SColor c); virtual void setBackgroundColor(video::SColor c);
//! sets the color of the text //! sets the color of the text
virtual void setTextColor(video::SColor c); virtual void setTextColor(video::SColor c);
@ -69,14 +69,12 @@ namespace gui
private: private:
s32 Number; s32 Number;
bool DrawBackground;
video::SColor BackColor; video::SColor BackColor;
video::SColor TextColor; video::SColor TextColor;
bool DrawBackground;
}; };
//! A standard tab control //! A standard tab control
class CGUITabControl : public IGUITabControl class CGUITabControl : public IGUITabControl
{ {

View File

@ -109,6 +109,7 @@ void CGUITable::addColumn(const wchar_t* caption, s32 columnIndex)
recalculateWidths(); recalculateWidths();
} }
//! remove a column from the table //! remove a column from the table
void CGUITable::removeColumn(u32 columnIndex) void CGUITable::removeColumn(u32 columnIndex)
{ {
@ -126,16 +127,19 @@ void CGUITable::removeColumn(u32 columnIndex)
recalculateWidths(); recalculateWidths();
} }
s32 CGUITable::getColumnCount() const s32 CGUITable::getColumnCount() const
{ {
return Columns.size(); return Columns.size();
} }
s32 CGUITable::getRowCount() const s32 CGUITable::getRowCount() const
{ {
return Rows.size(); return Rows.size();
} }
bool CGUITable::setActiveColumn(s32 idx, bool doOrder ) bool CGUITable::setActiveColumn(s32 idx, bool doOrder )
{ {
if (idx < 0 || idx >= (s32)Columns.size()) if (idx < 0 || idx >= (s32)Columns.size())
@ -198,16 +202,19 @@ bool CGUITable::setActiveColumn(s32 idx, bool doOrder )
return true; return true;
} }
s32 CGUITable::getActiveColumn() const s32 CGUITable::getActiveColumn() const
{ {
return ActiveTab; return ActiveTab;
} }
EGUI_ORDERING_MODE CGUITable::getActiveColumnOrdering() const EGUI_ORDERING_MODE CGUITable::getActiveColumnOrdering() const
{ {
return CurrentOrdering; return CurrentOrdering;
} }
void CGUITable::setColumnWidth(u32 columnIndex, u32 width) void CGUITable::setColumnWidth(u32 columnIndex, u32 width)
{ {
if ( columnIndex < Columns.size() ) if ( columnIndex < Columns.size() )
@ -260,6 +267,7 @@ void CGUITable::addRow(u32 rowIndex)
recalculateHeights(); recalculateHeights();
} }
void CGUITable::removeRow(u32 rowIndex) void CGUITable::removeRow(u32 rowIndex)
{ {
if ( rowIndex > Rows.size() ) if ( rowIndex > Rows.size() )
@ -273,6 +281,7 @@ void CGUITable::removeRow(u32 rowIndex)
recalculateHeights(); recalculateHeights();
} }
//! adds an list item, returns id of item //! adds an list item, returns id of item
void CGUITable::setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text) void CGUITable::setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text)
{ {
@ -287,6 +296,7 @@ void CGUITable::setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text)
} }
} }
void CGUITable::setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text, video::SColor color) void CGUITable::setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text, video::SColor color)
{ {
if ( rowIndex < Rows.size() && columnIndex < Columns.size() ) if ( rowIndex < Rows.size() && columnIndex < Columns.size() )
@ -297,6 +307,7 @@ void CGUITable::setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text,
} }
} }
void CGUITable::setCellColor(u32 rowIndex, u32 columnIndex, video::SColor color) void CGUITable::setCellColor(u32 rowIndex, u32 columnIndex, video::SColor color)
{ {
if ( rowIndex < Rows.size() && columnIndex < Columns.size() ) if ( rowIndex < Rows.size() && columnIndex < Columns.size() )
@ -305,6 +316,7 @@ void CGUITable::setCellColor(u32 rowIndex, u32 columnIndex, video::SColor color)
} }
} }
void CGUITable::setCellData(u32 rowIndex, u32 columnIndex, void *data) void CGUITable::setCellData(u32 rowIndex, u32 columnIndex, void *data)
{ {
if ( rowIndex < Rows.size() && columnIndex < Columns.size() ) if ( rowIndex < Rows.size() && columnIndex < Columns.size() )
@ -313,6 +325,7 @@ void CGUITable::setCellData(u32 rowIndex, u32 columnIndex, void *data)
} }
} }
const wchar_t* CGUITable::getCellText(u32 rowIndex, u32 columnIndex ) const const wchar_t* CGUITable::getCellText(u32 rowIndex, u32 columnIndex ) const
{ {
if ( rowIndex < Rows.size() && columnIndex < Columns.size() ) if ( rowIndex < Rows.size() && columnIndex < Columns.size() )
@ -323,6 +336,7 @@ const wchar_t* CGUITable::getCellText(u32 rowIndex, u32 columnIndex ) const
return 0; return 0;
} }
void* CGUITable::getCellData(u32 rowIndex, u32 columnIndex ) const void* CGUITable::getCellData(u32 rowIndex, u32 columnIndex ) const
{ {
if ( rowIndex < Rows.size() && columnIndex < Columns.size() ) if ( rowIndex < Rows.size() && columnIndex < Columns.size() )
@ -333,6 +347,7 @@ void* CGUITable::getCellData(u32 rowIndex, u32 columnIndex ) const
return 0; return 0;
} }
//! clears the list //! clears the list
void CGUITable::clear() void CGUITable::clear()
{ {
@ -348,6 +363,7 @@ void CGUITable::clear()
recalculateWidths(); recalculateWidths();
} }
void CGUITable::clearRows() void CGUITable::clearRows()
{ {
Rows.clear(); Rows.clear();
@ -358,11 +374,13 @@ void CGUITable::clearRows()
recalculateHeights(); recalculateHeights();
} }
s32 CGUITable::getSelected() const s32 CGUITable::getSelected() const
{ {
return Selected; return Selected;
} }
void CGUITable::recalculateWidths() void CGUITable::recalculateWidths()
{ {
TotalItemWidth=0; TotalItemWidth=0;
@ -373,6 +391,7 @@ void CGUITable::recalculateWidths()
checkScrollbars(); checkScrollbars();
} }
void CGUITable::recalculateHeights() void CGUITable::recalculateHeights()
{ {
TotalItemHeight = 0; TotalItemHeight = 0;
@ -396,6 +415,7 @@ void CGUITable::recalculateHeights()
checkScrollbars(); checkScrollbars();
} }
// automatic enabled/disabling and resizing of scrollbars // automatic enabled/disabling and resizing of scrollbars
void CGUITable::checkScrollbars() void CGUITable::checkScrollbars()
{ {
@ -484,6 +504,7 @@ void CGUITable::checkScrollbars()
} }
} }
void CGUITable::refreshControls() void CGUITable::refreshControls()
{ {
updateAbsolutePosition(); updateAbsolutePosition();
@ -657,6 +678,7 @@ void CGUITable::swapRows(u32 rowIndexA, u32 rowIndexB)
} }
bool CGUITable::dragColumnStart(s32 xpos, s32 ypos) bool CGUITable::dragColumnStart(s32 xpos, s32 ypos)
{ {
if ( !ResizableColumns ) if ( !ResizableColumns )
@ -691,6 +713,7 @@ bool CGUITable::dragColumnStart(s32 xpos, s32 ypos)
return false; return false;
} }
bool CGUITable::dragColumnUpdate(s32 xpos) bool CGUITable::dragColumnUpdate(s32 xpos)
{ {
if ( !ResizableColumns || CurrentResizedColumn < 0 || CurrentResizedColumn >= s32(Columns.size()) ) if ( !ResizableColumns || CurrentResizedColumn < 0 || CurrentResizedColumn >= s32(Columns.size()) )
@ -708,6 +731,7 @@ bool CGUITable::dragColumnUpdate(s32 xpos)
return false; return false;
} }
bool CGUITable::selectColumnHeader(s32 xpos, s32 ypos) bool CGUITable::selectColumnHeader(s32 xpos, s32 ypos)
{ {
if ( ypos > ( AbsoluteRect.UpperLeftCorner.Y + ItemHeight ) ) if ( ypos > ( AbsoluteRect.UpperLeftCorner.Y + ItemHeight ) )
@ -735,6 +759,7 @@ bool CGUITable::selectColumnHeader(s32 xpos, s32 ypos)
return false; return false;
} }
void CGUITable::orderRows(s32 columnIndex, EGUI_ORDERING_MODE mode) void CGUITable::orderRows(s32 columnIndex, EGUI_ORDERING_MODE mode)
{ {
Row swap; Row swap;

View File

@ -26,7 +26,7 @@ namespace gui
{ {
public: public:
//! constructor //! constructor
CGUITable(IGUIEnvironment* environment, IGUIElement* parent, CGUITable(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle, bool clip=true, s32 id, core::rect<s32> rectangle, bool clip=true,
bool drawBack=false, bool moveOverSelect=true); bool drawBack=false, bool moveOverSelect=true);
@ -45,7 +45,7 @@ namespace gui
//! Makes a column active. This will trigger an ordering process. //! Makes a column active. This will trigger an ordering process.
/** \param idx: The id of the column to make active. /** \param idx: The id of the column to make active.
\return Returns true if successful. */ \return True if successful. */
virtual bool setActiveColumn(s32 columnIndex, bool doOrder=false); virtual bool setActiveColumn(s32 columnIndex, bool doOrder=false);
//! Returns which header is currently active //! Returns which header is currently active
@ -56,18 +56,18 @@ namespace gui
//! set a column width //! set a column width
virtual void setColumnWidth(u32 columnIndex, u32 width); virtual void setColumnWidth(u32 columnIndex, u32 width);
//! columns can be resized by drag 'n drop //! columns can be resized by drag 'n drop
virtual void setResizableColumns(bool resizable); virtual void setResizableColumns(bool resizable);
//! can columns be resized by dran 'n drop? //! can columns be resized by dran 'n drop?
virtual bool hasResizableColumns() const; virtual bool hasResizableColumns() const;
//! This tells the table control which ordering mode should be used when //! This tells the table control which ordering mode should be used when
//! a column header is clicked. //! a column header is clicked.
/** \param columnIndex: The index of the column header. /** \param columnIndex: The index of the column header.
\param state: If true, a EGET_TABLE_HEADER_CHANGED message will be sent and you can order the table data as you whish.*/ \param state: If true, a EGET_TABLE_HEADER_CHANGED message will be sent and you can order the table data as you whish.*/
//! \param mode: One of the modes defined in EGUI_COLUMN_ORDERING //! \param mode: One of the modes defined in EGUI_COLUMN_ORDERING
virtual void setColumnOrdering(u32 columnIndex, EGUI_COLUMN_ORDERING mode); virtual void setColumnOrdering(u32 columnIndex, EGUI_COLUMN_ORDERING mode);
//! Returns which row is currently selected //! Returns which row is currently selected
@ -99,7 +99,7 @@ namespace gui
//! a new row is added or the cells data is changed. This makes //! a new row is added or the cells data is changed. This makes
//! the system more flexible and doesn't make you pay the cost //! the system more flexible and doesn't make you pay the cost
//! of ordering when adding a lot of rows. //! of ordering when adding a lot of rows.
//! \param columnIndex: When set to -1 the active column is used. //! \param columnIndex: When set to -1 the active column is used.
virtual void orderRows(s32 columnIndex=-1, EGUI_ORDERING_MODE mode=EGOM_NONE); virtual void orderRows(s32 columnIndex=-1, EGUI_ORDERING_MODE mode=EGOM_NONE);

View File

@ -31,7 +31,7 @@ CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id
IGUISpriteBank* sprites = 0; IGUISpriteBank* sprites = 0;
video::SColor color(255,255,255,255); video::SColor color(255,255,255,255);
s32 buttonw = 15; s32 buttonw = 15;
if (skin) if (skin)
{ {
@ -41,7 +41,7 @@ CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id
} }
s32 posx = RelativeRect.getWidth() - buttonw - 4; s32 posx = RelativeRect.getWidth() - buttonw - 4;
CloseButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1, CloseButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1,
L"", skin ? skin->getDefaultText(EGDT_WINDOW_CLOSE) : L"Close" ); L"", skin ? skin->getDefaultText(EGDT_WINDOW_CLOSE) : L"Close" );
CloseButton->setSubElement(true); CloseButton->setSubElement(true);
CloseButton->setTabStop(false); CloseButton->setTabStop(false);
@ -54,7 +54,7 @@ CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id
} }
posx -= buttonw + 2; posx -= buttonw + 2;
RestoreButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1, RestoreButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1,
L"", skin ? skin->getDefaultText(EGDT_WINDOW_RESTORE) : L"Restore" ); L"", skin ? skin->getDefaultText(EGDT_WINDOW_RESTORE) : L"Restore" );
RestoreButton->setVisible(false); RestoreButton->setVisible(false);
RestoreButton->setSubElement(true); RestoreButton->setSubElement(true);
@ -68,7 +68,7 @@ CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id
} }
posx -= buttonw + 2; posx -= buttonw + 2;
MinButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1, MinButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1,
L"", skin ? skin->getDefaultText(EGDT_WINDOW_MINIMIZE) : L"Minimize" ); L"", skin ? skin->getDefaultText(EGDT_WINDOW_MINIMIZE) : L"Minimize" );
MinButton->setVisible(false); MinButton->setVisible(false);
MinButton->setSubElement(true); MinButton->setSubElement(true);
@ -171,14 +171,12 @@ bool CGUIWindow::OnEvent(const SEvent& event)
if (Dragging) if (Dragging)
{ {
// gui window should not be dragged outside its parent // gui window should not be dragged outside its parent
if (Parent) if (Parent &&
if (event.MouseInput.X < Parent->getAbsolutePosition().UpperLeftCorner.X +1 || (event.MouseInput.X < Parent->getAbsolutePosition().UpperLeftCorner.X +1 ||
event.MouseInput.Y < Parent->getAbsolutePosition().UpperLeftCorner.Y +1 || event.MouseInput.Y < Parent->getAbsolutePosition().UpperLeftCorner.Y +1 ||
event.MouseInput.X > Parent->getAbsolutePosition().LowerRightCorner.X -1 || event.MouseInput.X > Parent->getAbsolutePosition().LowerRightCorner.X -1 ||
event.MouseInput.Y > Parent->getAbsolutePosition().LowerRightCorner.Y -1) event.MouseInput.Y > Parent->getAbsolutePosition().LowerRightCorner.Y -1))
return true;
return true;
move(core::position2d<s32>(event.MouseInput.X - DragStart.X, event.MouseInput.Y - DragStart.Y)); move(core::position2d<s32>(event.MouseInput.X - DragStart.X, event.MouseInput.Y - DragStart.Y));
DragStart.X = event.MouseInput.X; DragStart.X = event.MouseInput.X;

View File

@ -46,12 +46,12 @@ namespace gui
protected: protected:
core::position2d<s32> DragStart;
bool Dragging;
IGUIButton* CloseButton; IGUIButton* CloseButton;
IGUIButton* MinButton; IGUIButton* MinButton;
IGUIButton* RestoreButton; IGUIButton* RestoreButton;
core::position2d<s32> DragStart;
bool Dragging;
}; };
} // end namespace gui } // end namespace gui
@ -59,5 +59,5 @@ namespace gui
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_
#endif #endif

View File

@ -16,7 +16,6 @@
#include <assert.h> #include <assert.h>
#include <vector> #include <vector>
//! Defines a test
typedef struct _STestDefinition typedef struct _STestDefinition
{ {
//! The test entry point function //! The test entry point function
@ -154,7 +153,6 @@ int main(int argumentCount, char * arguments[])
} }
} }
closeTestLog(); closeTestLog();
(void)system("tests.log"); (void)system("tests.log");
} }