GUI constification done, other parts still missing.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@961 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2007-09-16 00:18:13 +00:00
parent 966b8bedc7
commit 08e359784b
91 changed files with 715 additions and 667 deletions

View File

@ -1,5 +1,7 @@
Changes in version 1.4 (... 2007)
- Major API rewriting for proper const usage. Now, most getter methods are const and so are the larger parameters and return values. Moreover, mayn methods taking only unsigned numbers now use u32 instead of s32 to get his limitation from the method's signature.
- Added IMeshManipulator::createMeshWelded which creates a copy of the mesh with similar vertices welded together.
- Irrlicht now has its own file format for static meshes. It is based on xml and has the

View File

@ -298,7 +298,7 @@ public:
// load the model file, selected in the file open dialog
IGUIFileOpenDialog* dialog =
(IGUIFileOpenDialog*)event.GUIEvent.Caller;
loadModel(core::stringc(dialog->getFilename()).c_str());
loadModel(core::stringc(dialog->getFileName()).c_str());
}
case EGET_SCROLL_BAR_CHANGED:

View File

@ -26,7 +26,7 @@ namespace gui
//! Returns if the cursor is currently visible.
/** \return Returns true if the cursor is visible, false if not. */
virtual bool isVisible() = 0;
virtual bool isVisible() const = 0;
/** Sets the new position of the cursor. The position must be
between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is

View File

@ -61,7 +61,7 @@ namespace gui
: IGUIElement(EGUIET_BUTTON, environment, parent, id, rectangle) {}
//! destructor
~IGUIButton() {};
virtual ~IGUIButton() {}
//! Sets another skin independent font.
/** If this is set to zero, the button uses the font of the skin.
@ -110,22 +110,22 @@ namespace gui
virtual void setPressed(bool pressed) = 0;
//! Returns if the button is currently pressed
virtual bool isPressed() = 0;
virtual bool isPressed() const = 0;
//! Sets if the alpha channel should be used for drawing background images on the button (default is false)
virtual void setUseAlphaChannel(bool useAlphaChannel) = 0;
//! Returns if the alpha channel should be used for drawing background images on the button
virtual bool isAlphaChannelUsed() = 0;
virtual bool isAlphaChannelUsed() const = 0;
//! Returns whether the button is a push button
virtual bool isPushButton() = 0;
virtual bool isPushButton() const = 0;
//! Sets if the button should use the skin to draw its border and button face (default is true)
virtual void setDrawBorder(bool border) = 0;
//! Returns if the border and button face are being drawn using the skin
virtual bool isDrawingBorder() = 0;
virtual bool isDrawingBorder() const = 0;
};

View File

@ -22,13 +22,13 @@ namespace gui
: IGUIElement(EGUIET_CHECK_BOX, environment, parent, id, rectangle) {}
//! destructor
~IGUICheckBox() {};
virtual ~IGUICheckBox() {}
//! Set if box is checked.
virtual void setChecked(bool checked) = 0;
//! Returns true if box is checked.
virtual bool isChecked() = 0;
virtual bool isChecked() const = 0;
};
} // end namespace gui

View File

@ -22,9 +22,7 @@ namespace gui
: IGUIElement(EGUIET_COLOR_SELECT_DIALOG, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIColorSelectDialog() {};
virtual ~IGUIColorSelectDialog() {}
};

View File

@ -21,30 +21,29 @@ namespace gui
: IGUIElement(EGUIET_COMBO_BOX, environment, parent, id, rectangle) {}
//! destructor
~IGUIComboBox() {};
virtual ~IGUIComboBox() {}
//! Returns amount of items in box
virtual s32 getItemCount() = 0;
virtual u32 getItemCount() const = 0;
//! Returns string of an item. the idx may be a value from 0 to itemCount-1
virtual const wchar_t* getItem(s32 idx) const = 0;
virtual const wchar_t* getItem(u32 idx) const = 0;
//! Adds an item and returns the index of it
virtual s32 addItem(const wchar_t* text) = 0;
virtual u32 addItem(const wchar_t* text) = 0;
//! Removes an item from the combo box.
/** Warning. This will change the IDs of all following items */
virtual void removeItem(s32 id) = 0;
virtual void removeItem(u32 id) = 0;
//! Deletes all items in the combo box
virtual void clear() = 0;
//! Returns id of selected item. returns -1 if no item is selected.
virtual s32 getSelected() = 0;
virtual s32 getSelected() const = 0;
//! Sets the selected item. Set this to -1 if no item should be selected
virtual void setSelected(s32 id) = 0;
};

View File

@ -22,10 +22,10 @@ namespace gui
: IGUIElement(EGUIET_CONTEXT_MENU, environment, parent, id, rectangle) {}
//! destructor
~IGUIContextMenu() {};
virtual ~IGUIContextMenu() {};
//! Get amount of menu items
virtual s32 getItemCount() const = 0;
virtual u32 getItemCount() const = 0;
//! Adds a menu item.
/** \param text: Text of menu item. Set this to 0 to create
@ -38,7 +38,7 @@ namespace gui
at this item. You can acess this submenu via getSubMenu().
\param checked: Specifies if the menu item should be initially checked.
\return Returns the index of the new item */
virtual s32 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 checked=false
) = 0;
@ -48,57 +48,57 @@ namespace gui
//! Get text of the menu item.
/** \param idx: Zero based index of the menu item */
virtual const wchar_t* getItemText(s32 idx) = 0;
virtual const wchar_t* getItemText(u32 idx) const = 0;
//! Sets text of the menu item.
/** \param idx: Zero based index of the menu item
\param text: New text of the item. */
virtual void setItemText(s32 idx, const wchar_t* text) = 0;
virtual void setItemText(u32 idx, const wchar_t* text) = 0;
//! Check if a menu item is enabled
/** \param idx: Zero based index of the menu item */
virtual bool isItemEnabled(s32 idx) = 0;
virtual bool isItemEnabled(u32 idx) const = 0;
//! Sets if the menu item should be enabled.
/** \param idx: Zero based index of the menu item
\param enabled: True if it is enabled, otherwise false. */
virtual void setItemEnabled(s32 idx, bool enabled) = 0;
virtual void setItemEnabled(u32 idx, bool enabled) = 0;
//! Sets if the menu item should be checked.
/** \param idx: Zero based index of the menu item
\param enabled: True if it is enabled, otherwise false. */
virtual void setItemChecked(s32 idx, bool enabled) = 0;
virtual void setItemChecked(u32 idx, bool enabled) = 0;
//! Check if a menu item is checked
/** \param idx: Zero based index of the menu item */
virtual bool isItemChecked(s32 idx) = 0;
virtual bool isItemChecked(u32 idx) const = 0;
//! Removes a menu item
/** \param idx: Zero based index of the menu item */
virtual void removeItem(s32 idx) = 0;
virtual void removeItem(u32 idx) = 0;
//! Removes all menu items
virtual void removeAllItems() = 0;
//! Get the selected item in the menu
/** \return Index of the selected item, -1 if none selected. */
virtual s32 getSelectedItem() = 0;
virtual s32 getSelectedItem() const = 0;
//! Get the command id of a menu item
/** \param idx: Zero based index of the menu item */
virtual s32 getItemCommandId(s32 idx) = 0;
virtual s32 getItemCommandId(u32 idx) const = 0;
//! Sets the command id of a menu item
/** \param idx: Zero based index of the menu item
\param id: Command id of menu item, a simple id you may
set to whatever you want. */
virtual void setItemCommandId(s32 idx, s32 id) = 0;
virtual void setItemCommandId(u32 idx, s32 id) = 0;
//! Get a pointer to the submenu of an item.
/** 0 is returned if there is no submenu
\param idx: Zero based index of the menu item
\return Returns a pointer to the submenu of an item. */
virtual IGUIContextMenu* getSubMenu(s32 idx) = 0;
virtual IGUIContextMenu* getSubMenu(u32 idx) const = 0;
};
} // end namespace gui

View File

@ -24,7 +24,7 @@ namespace gui
: IGUIElement(EGUIET_EDIT_BOX, environment, parent, id, rectangle) {}
//! destructor
~IGUIEditBox() {};
virtual ~IGUIEditBox() {};
//! Sets another skin independent font.
/** If this is set to zero, the button uses the font of the skin.
@ -65,7 +65,7 @@ namespace gui
//! Checks if word wrap is enabled
//! \return true if word wrap is enabled, false otherwise
virtual bool isWordWrapEnabled() = 0;
virtual bool isWordWrapEnabled() const = 0;
//! Enables or disables newlines.
/** \param enable: If set to true, the EGET_EDITBOX_ENTER event will not be fired,
@ -74,7 +74,7 @@ namespace gui
//! Checks if multi line editing is enabled
//! \return true if mult-line is enabled, false otherwise
virtual bool isMultiLineEnabled() = 0;
virtual bool isMultiLineEnabled() const = 0;
//! Enables or disables automatic scrolling with cursor position
//! \param enable: If set to true, the text will move around with the cursor position
@ -82,7 +82,7 @@ namespace gui
//! Checks to see if automatic scrolling is enabled
//! \return true if automatic scrolling is enabled, false if not
virtual bool isAutoScrollEnabled() = 0;
virtual bool isAutoScrollEnabled() const = 0;
//! Sets whether the edit box is a password box. Setting this to true will
/** disable MultiLine, WordWrap and the ability to copy with ctrl+c or ctrl+x
@ -91,7 +91,7 @@ namespace gui
virtual void setPasswordBox(bool passwordBox, wchar_t passwordChar = L'*') = 0;
//! Returns true if the edit box is currently a password box.
virtual bool isPasswordBox() = 0;
virtual bool isPasswordBox() const = 0;
//! Gets the size area of the text in the edit box
//! \return Returns the size in pixels of the text
@ -100,10 +100,10 @@ namespace gui
//! Sets the maximum amount of characters which may be entered in the box.
/** \param max: Maximum amount of characters. If 0, the character amount is
infinity. */
virtual void setMax(s32 max) = 0;
virtual void setMax(u32 max) = 0;
//! Returns maximum amount of characters, previously set by setMax();
virtual s32 getMax() = 0;
virtual u32 getMax() const = 0;
};

View File

@ -86,7 +86,7 @@ public:
(*it)->Parent = 0;
(*it)->drop();
}
};
}
//! Returns parent of this element.
@ -126,6 +126,7 @@ public:
updateAbsolutePosition();
}
//! Sets the relative rectangle of this element.
void setRelativePosition(const core::rect<f32>& r)
{
@ -135,10 +136,10 @@ public:
const core::dimension2di& d = Parent->getAbsolutePosition().getSize();
DesiredRect = core::rect<s32>(
(s32)((f32)d.Width * r.UpperLeftCorner.X),
(s32)((f32)d.Height * r.UpperLeftCorner.Y),
(s32)((f32)d.Width * r.LowerRightCorner.X),
(s32)((f32)d.Height * r.LowerRightCorner.Y));
core::floor32((f32)d.Width * r.UpperLeftCorner.X),
core::floor32((f32)d.Height * r.UpperLeftCorner.Y),
core::floor32((f32)d.Width * r.LowerRightCorner.X),
core::floor32((f32)d.Height * r.LowerRightCorner.Y));
ScaleRect = r;
@ -152,24 +153,28 @@ public:
return AbsoluteRect;
}
//! Returns the visible area of the element.
core::rect<s32> getAbsoluteClippingRect() const
{
return AbsoluteClippingRect;
}
//! Sets whether the element will ignore its parent's clipping rectangle
void setNotClipped(bool noClip)
{
NoClip = noClip;
}
//! Gets whether the element will ignore its parent's clipping rectangle
bool isNotClipped()
bool isNotClipped() const
{
return NoClip;
}
//! Sets the maximum size allowed for this element
/** If set to 0,0, there is no maximum size */
void setMaxSize(core::dimension2di size)
@ -178,6 +183,7 @@ public:
updateAbsolutePosition();
}
//! Sets the minimum size allowed for this element
void setMinSize(core::dimension2di size)
{
@ -189,6 +195,7 @@ public:
updateAbsolutePosition();
}
void setAlignment(EGUI_ALIGNMENT left, EGUI_ALIGNMENT right, EGUI_ALIGNMENT top, EGUI_ALIGNMENT bottom)
{
AlignLeft = left;
@ -213,6 +220,7 @@ public:
}
}
//! Updates the absolute position.
virtual void updateAbsolutePosition()
{
@ -372,6 +380,7 @@ public:
return target;
}
//! Returns true if a point is within this element.
//! Elements with a shape other than a rectangle will override this method
virtual bool isPointInside(const core::position2d<s32>& point) const
@ -428,6 +437,7 @@ public:
(*it)->draw();
}
//! animate the element and its children.
virtual void OnPostRender(u32 timeMs)
{
@ -448,7 +458,7 @@ public:
//! Returns true if element is visible.
virtual bool isVisible()
virtual bool isVisible() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsVisible;
@ -463,12 +473,13 @@ public:
//! Returns true if this element was created as part of its parent control
virtual bool isSubElement()
virtual bool isSubElement() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsSubElement;
}
//! Sets whether this control was created as part of its parent,
//! for example when a scrollbar is part of a listbox.
//! SubElements are not saved to disk when calling guiEnvironment->saveGUI()
@ -477,6 +488,7 @@ public:
IsSubElement = subElement;
}
//! If set to true, the focus will visit this element when using
//! the tab key to cycle through elements.
//! If this element is a tab group (see isTabGroup/setTabGroup) then
@ -486,13 +498,15 @@ public:
IsTabStop = enable;
}
//! Returns true if this element can be focused by navigating with the tab key
bool isTabStop()
bool isTabStop() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsTabStop;
}
//! Sets the priority of focus when using the tab key to navigate between a group
//! of elements. See setTabGroup, isTabGroup and getTabGroup for information on tab groups.
//! Elements with a lower number are focused first
@ -522,12 +536,14 @@ public:
TabOrder = index;
}
//! Returns the number in the tab order sequence
s32 getTabOrder()
s32 getTabOrder() const
{
return TabOrder;
}
//! Sets whether this element is a container for a group of elements which
//! can be navigated using the tab key. For example, windows are tab groups.
//! Groups can be navigated using ctrl+tab, providing isTabStop is true.
@ -536,13 +552,15 @@ public:
IsTabGroup = isGroup;
}
//! Returns true if this element is a tab group.
bool isTabGroup()
bool isTabGroup() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsTabGroup;
}
//! Returns the container element which holds all elements in this element's
//! tab group.
IGUIElement* getTabGroup()
@ -555,8 +573,9 @@ public:
return ret;
}
//! Returns true if element is enabled.
virtual bool isEnabled()
virtual bool isEnabled() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsEnabled;
@ -583,6 +602,7 @@ public:
return Text.c_str();
}
//! Sets the new caption of this element.
virtual void setToolTipText(const wchar_t* text)
{
@ -591,18 +611,19 @@ public:
//! Returns caption of this element.
virtual core::stringw &getToolTipText()
virtual const core::stringw& getToolTipText() const
{
return ToolTipText;
}
//! Returns id. Can be used to identify the element.
virtual s32 getID()
virtual s32 getID() const
{
return ID;
}
//! Sets the id of this element
virtual void setID(s32 id)
{
@ -636,12 +657,14 @@ public:
return false;
}
//! Returns list with children of this element
virtual const core::list<IGUIElement*>& getChildren() const
{
return Children;
}
//! Finds the first element with the given id.
/** \param id: Id to search for.
\param searchchildren: Set this to true, if also children of this
@ -669,9 +692,10 @@ public:
return e;
}
//! returns true if the given element is a child of this one.
//! \param child: The child element to check
bool isMyChild(IGUIElement* child)
bool isMyChild(IGUIElement* child) const
{
if (!child)
return false;
@ -686,6 +710,7 @@ public:
return child == this;
}
//! searches elements to find the closest next element to tab to
//! \param startOrder: The TabOrder of the current element, -1 if none
//! \param reverse: true if searching for a lower number
@ -695,7 +720,7 @@ public:
//! \param includeInvisible: includes invisible elements in the search (default=false)
//! \return true if successfully found an element, false to continue searching/fail
bool getNextElement(s32 startOrder, bool reverse, bool group,
IGUIElement*& first, IGUIElement*& closest, bool includeInvisible=false)
IGUIElement*& first, IGUIElement*& closest, bool includeInvisible=false) const
{
// we'll stop searching if we find this number
s32 wanted = startOrder + ( reverse ? -1 : 1 );
@ -768,6 +793,7 @@ public:
return false;
}
//! Returns the type of the gui element.
/** This is needed for the .NET wrapper but will be used
later for serializing and deserializing.
@ -778,6 +804,7 @@ public:
return Type;
}
//! Returns the type name of the gui element.
/** This is needed serializing elements. For serializing your own elements, override this function
and return your own type name which is created by your IGUIElementFactory */
@ -786,6 +813,7 @@ public:
return GUIElementTypeNames[Type];
}
//! Writes attributes of the scene node.
//! Implement this to expose the attributes of your scene node for
//! scripting languages, editors, debuggers or xml serialization purposes.
@ -808,6 +836,7 @@ public:
out->addInt("TabOrder", TabOrder);
}
//! Reads attributes of the scene node.
//! Implement this to set the attributes of your scene node for
//! scripting languages, editors, debuggers or xml deserialization purposes.

View File

@ -41,22 +41,22 @@ namespace gui
virtual IGUIElement* addGUIElement(const c8* typeName, IGUIElement* parent=0) = 0;
//! returns amount of GUI element types this factory is able to create
virtual s32 getCreatableGUIElementTypeCount() = 0;
virtual s32 getCreatableGUIElementTypeCount() const = 0;
//! returns type of a createable element type
/** \param idx: Index of the element type in this factory. Must be a value between 0 and
getCreatableGUIElementTypeCount() */
virtual EGUI_ELEMENT_TYPE getCreateableGUIElementType(s32 idx) = 0;
virtual EGUI_ELEMENT_TYPE getCreateableGUIElementType(s32 idx) const = 0;
//! returns type name of a createable GUI element type by index
/** \param idx: Index of the type in this factory. Must be a value between 0 and
getCreatableGUIElementTypeCount() */
virtual const c8* getCreateableGUIElementTypeName(s32 idx) = 0;
virtual const c8* getCreateableGUIElementTypeName(s32 idx) const = 0;
//! returns type name of a createable GUI element
/** \param type: Type of GUI element.
\return: Returns name of the type if this factory can create the type, otherwise 0. */
virtual const c8* getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type) = 0;
virtual const c8* getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type) const = 0;
};
@ -64,3 +64,4 @@ namespace gui
} // end namespace irr
#endif // __I_GUI_ELEMENT_FACTORY_H_INCLUDED__

View File

@ -74,7 +74,7 @@ public:
virtual bool setFocus(IGUIElement* element) = 0;
//! Returns the element with the focus
virtual IGUIElement* getFocus() = 0;
virtual IGUIElement* getFocus() const = 0;
//! Removes the focus from an element.
/** Causes a EGET_ELEMENT_FOCUS_LOST event. If the event is absorbed then the focus
@ -83,16 +83,16 @@ public:
virtual bool removeFocus(IGUIElement* element) = 0;
//! Returns if the element has focus
virtual bool hasFocus(IGUIElement* element) = 0;
virtual bool hasFocus(IGUIElement* element) const = 0;
//! Returns the current video driver.
virtual video::IVideoDriver* getVideoDriver() = 0;
virtual video::IVideoDriver* getVideoDriver() const = 0;
//! Returns the file system.
virtual io::IFileSystem* getFileSystem() = 0;
virtual io::IFileSystem* getFileSystem() const = 0;
//! returns a pointer to the OS operator
virtual IOSOperator* getOSOperator() = 0;
virtual IOSOperator* getOSOperator() const = 0;
//! removes all elements from the environment.
virtual void clear() = 0;
@ -138,7 +138,7 @@ public:
virtual IGUIFont* getFont(const c8* filename) = 0;
//! Returns the default built-in font.
virtual IGUIFont* getBuiltInFont() = 0;
virtual IGUIFont* getBuiltInFont() const = 0;
//! Returns pointer to the sprite bank with the specified file name.
/** Loads the bank if it was not loaded before. Returns 0 if it could not be loaded.
@ -370,7 +370,7 @@ public:
IGUIElement* parent=0, s32 id=-1) = 0;
//! Returns the default element factory which can create all built in elements
virtual IGUIElementFactory* getDefaultGUIElementFactory() = 0;
virtual IGUIElementFactory* getDefaultGUIElementFactory() const = 0;
//! Adds an element factory to the gui environment.
/** Use this to extend the gui environment with new element types which it should be
@ -378,10 +378,10 @@ public:
virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0;
//! Returns amount of registered gui element factories.
virtual s32 getRegisteredGUIElementFactoryCount() = 0;
virtual u32 getRegisteredGUIElementFactoryCount() const = 0;
//! Returns a gui element factory by index
virtual IGUIElementFactory* getGUIElementFactory(s32 index) = 0;
virtual IGUIElementFactory* getGUIElementFactory(u32 index) const = 0;
//! Adds a GUI Element by its name
virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0) = 0;

View File

@ -22,11 +22,10 @@ namespace gui
: IGUIElement(EGUIET_FILE_OPEN_DIALOG, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIFileOpenDialog() {};
virtual ~IGUIFileOpenDialog() {}
//! Returns the filename of the selected file. Returns NULL, if no file was selected.
virtual const wchar_t* getFilename() = 0;
virtual const wchar_t* getFileName() const = 0;
};

View File

@ -40,7 +40,7 @@ class IGUIFont : public virtual IReferenceCounted
public:
//! Destructor
virtual ~IGUIFont() {};
virtual ~IGUIFont() {}
//! Draws an text and clips it to the specified rectangle if wanted.
/** \param text: Text to draw
@ -57,14 +57,14 @@ public:
//! Calculates the dimension of a text.
/** \return Returns width and height of the area covered by the text if it would be
drawn. */
virtual core::dimension2d<s32> getDimension(const wchar_t* text) = 0;
virtual core::dimension2d<s32> getDimension(const wchar_t* text) const = 0;
//! Calculates the index of the character in the text which is on a specific position.
/** \param text: Text string.
\param pixel_x: X pixel position of which the index of the character will be returned.
\return Returns zero based index of the character in the text, and -1 if no no character
is on this position. (=the text is too short). */
virtual s32 getCharacterFromPos(const wchar_t* text, s32 pixel_x) = 0;
virtual s32 getCharacterFromPos(const wchar_t* text, s32 pixel_x) const = 0;
//! Returns the type of this font
virtual EGUI_FONT_TYPE getType() const { return EGFT_CUSTOM; }
@ -82,11 +82,10 @@ public:
kerning value. For example, in a font which supports kerning pairs a string such as 'Wo' may have
the 'o' tucked neatly under the 'W'.
*/
virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) = 0;
virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const = 0;
//! Returns the distance between letters
virtual s32 getKerningHeight() = 0;
virtual s32 getKerningHeight() const = 0;
};
} // end namespace gui

View File

@ -19,16 +19,16 @@ class IGUIFontBitmap : public IGUIFont
public:
//! Destructor
virtual ~IGUIFontBitmap() {};
virtual ~IGUIFontBitmap() {}
//! Returns the type of this font
virtual EGUI_FONT_TYPE getType() const { return EGFT_BITMAP; }
//! returns the parsed Symbol Information
virtual IGUISpriteBank* getSpriteBank() = 0;
virtual IGUISpriteBank* getSpriteBank() const = 0;
//! returns the sprite number from a given character
virtual u32 getSpriteNoFromChar(const wchar_t *c) = 0;
virtual u32 getSpriteNoFromChar(const wchar_t *c) const = 0;
//! Gets kerning values (distance between letters) for the font. If no parameters are provided,
/** the global kerning distance is returned.
@ -39,8 +39,7 @@ public:
kerning value. For example, EGFT_BITMAP will add the right kerning value of previousLetter to the
left side kerning value of thisLetter, then add the global value.
*/
virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) = 0;
virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const = 0;
};
} // end namespace gui

View File

@ -26,7 +26,7 @@ namespace gui
: IGUIElement(EGUIET_IMAGE, environment, parent, id, rectangle) {}
//! destructor
~IGUIImage() {};
virtual ~IGUIImage() {}
//! Sets an image
virtual void setImage(video::ITexture* image) = 0;
@ -45,7 +45,6 @@ namespace gui
//! Returns true if the image is using the alpha channel, false if not
virtual bool isAlphaChannelUsed() const = 0;
};

View File

@ -33,7 +33,7 @@ namespace gui
: IGUIElement(EGUIET_IN_OUT_FADER, environment, parent, id, rectangle) {}
//! destructor
~IGUIInOutFader() {};
virtual ~IGUIInOutFader() {}
//! Gets the color to fade out to or to fade in from.
virtual video::SColor getColor() const = 0;

View File

@ -40,29 +40,29 @@ namespace gui
: IGUIElement(EGUIET_LIST_BOX, environment, parent, id, rectangle) {}
//! destructor
~IGUIListBox() {};
virtual ~IGUIListBox() {}
//! returns amount of list items
virtual s32 getItemCount() = 0;
virtual u32 getItemCount() const = 0;
//! returns string of a list item. the may id be a value from 0 to itemCount-1
virtual const wchar_t* getListItem(s32 id) = 0;
virtual const wchar_t* getListItem(u32 id) const = 0;
//! adds an list item, returns id of item
virtual s32 addItem(const wchar_t* text) = 0;
virtual u32 addItem(const wchar_t* text) = 0;
//! adds an list item with an icon
//! \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
//! \return
//! returns the id of the new created item
virtual s32 addItem(const wchar_t* text, s32 icon) = 0;
virtual u32 addItem(const wchar_t* text, s32 icon) = 0;
//! Removes an item from the list
virtual void removeItem(s32 index) = 0;
virtual void removeItem(u32 index) = 0;
//! Returns the icon of an item
virtual s32 getIcon(s32 id) 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
//! the built-in-font by default. A sprite can be displayed in front of every list item.
@ -74,48 +74,48 @@ namespace gui
virtual void clear() = 0;
//! returns id of selected item. returns -1 if no item is selected.
virtual s32 getSelected() = 0;
virtual s32 getSelected() const = 0;
//! sets the selected item. Set this to -1 if no item should be selected
virtual void setSelected(s32 id) = 0;
virtual void setSelected(s32 index) = 0;
//! set whether the listbox should scroll to show a newly selected item
//! or a new item as it is added to the list.
virtual void setAutoScrollEnabled(bool scroll) = 0;
//! returns true if automatic scrolling is enabled, false if not.
virtual bool isAutoScrollEnabled() = 0;
virtual bool isAutoScrollEnabled() const = 0;
//! set all item colors at given index to color
virtual void setItemOverrideColor(s32 index, const video::SColor &color) = 0;
virtual void setItemOverrideColor(u32 index, const video::SColor &color) = 0;
//! set all item colors of specified type at given index to color
virtual void setItemOverrideColor(s32 index, EGUI_LISTBOX_COLOR colorType, const video::SColor &color) = 0;
virtual void setItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType, const video::SColor &color) = 0;
//! clear all item colors at index
virtual void clearItemOverrideColor(s32 index) = 0;
virtual void clearItemOverrideColor(u32 index) = 0;
//! clear item color at index for given colortype
virtual void clearItemOverrideColor(s32 index, EGUI_LISTBOX_COLOR colorType) = 0;
virtual void clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) = 0;
//! has the item at index it's color overwritten?
virtual bool hasItemOverrideColor(s32 index, EGUI_LISTBOX_COLOR colorType) = 0;
virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0;
//! return the overwrite color at given item index.
virtual video::SColor getItemOverrideColor(s32 index, EGUI_LISTBOX_COLOR colorType) = 0;
virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0;
//! return the default color which is used for the given colorType
virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) = 0;
virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const = 0;
//! set the item at the given index
virtual void setItem(s32 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
//! Return the index on success or -1 on failure.
virtual s32 insertItem(s32 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
virtual void swapItems(s32 index1, s32 index2) = 0;
virtual void swapItems(u32 index1, u32 index2) = 0;
};
@ -123,3 +123,4 @@ namespace gui
} // end namespace irr
#endif

View File

@ -33,7 +33,7 @@ namespace gui
: IGUIElement(EGUIET_MESH_VIEWER, environment, parent, id, rectangle) {}
//! destructor
~IGUIMeshViewer() {};
virtual ~IGUIMeshViewer() {}
//! Sets the mesh to be shown
virtual void setMesh(scene::IAnimatedMesh* mesh) = 0;
@ -45,8 +45,7 @@ namespace gui
virtual void setMaterial(const video::SMaterial& material) = 0;
//! Gets the material
virtual const video::SMaterial& getMaterial() = 0;
virtual const video::SMaterial& getMaterial() const = 0;
};

View File

@ -25,19 +25,19 @@ namespace gui
~IGUIScrollBar() {};
//! gets the maximum value of the scrollbar.
virtual s32 getMax() = 0;
virtual s32 getMax() const = 0;
//! sets the maximum value of the scrollbar.
virtual void setMax(s32 max) = 0;
//! gets the small step value
virtual s32 getSmallStep() = 0;
virtual s32 getSmallStep() const = 0;
//! sets the small step value
virtual void setSmallStep(s32 step) = 0;
//! gets the current position of the scrollbar
virtual s32 getPos() = 0;
virtual s32 getPos() const = 0;
//! sets the current position of the scrollbar
virtual void setPos(s32 pos) = 0;

View File

@ -505,7 +505,6 @@ namespace gui
//! get the type of this skin
virtual EGUI_SKIN_TYPE getType() const { return EGST_UNKNOWN; };
};

View File

@ -10,7 +10,7 @@ namespace irr
{
namespace gui
{
class IGUIEditBox;
class IGUIEditBox;
//! Single line edit box + spin buttons
class IGUISpinBox : public IGUIElement
@ -18,26 +18,27 @@ namespace gui
public:
//! constructor
IGUISpinBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
IGUISpinBox(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_SPIN_BOX, environment, parent, id, rectangle) {}
//! destructor
~IGUISpinBox() {};
virtual ~IGUISpinBox() {}
//! Access the edit box used in the spin control
//! Access the edit box used in the spin control
/** \param enable: If set to true, the override color, which can be set
with IGUIEditBox::setOverrideColor is used, otherwise the
EGDC_BUTTON_TEXT color of the skin. */
virtual IGUIEditBox* getEditBox() = 0;
virtual IGUIEditBox* getEditBox() const = 0;
//! set the current value of the spinbox
//! set the current value of the spinbox
/** \param val: value to be set in the spinbox */
virtual void setValue(f32 val) = 0;
//! Get the current value of the spinbox
virtual f32 getValue() = 0;
//! Get the current value of the spinbox
virtual f32 getValue() const = 0;
//! set the range of values which can be used in the spinbox
//! set the range of values which can be used in the spinbox
/** \param min: minimum value
\param max: maximum value */
virtual void setRange(f32 min, f32 max) = 0;
@ -60,7 +61,10 @@ namespace gui
//! get the current step size
virtual f32 getStepSize() const = 0;
};
} // end namespace gui
} // end namespace irr
#endif // __I_GUI_SPIN_BOX_H_INCLUDED__

View File

@ -38,7 +38,7 @@ class IGUISpriteBank : public virtual IReferenceCounted
public:
//! Destructor
virtual ~IGUISpriteBank() {};
virtual ~IGUISpriteBank() {}
//! Returns the list of rectangles held by the sprite bank
virtual core::array< core::rect<s32> >& getPositions() = 0;
@ -47,10 +47,10 @@ public:
virtual core::array< SGUISprite >& getSprites() = 0;
//! Returns the number of textures held by the sprite bank
virtual u32 getTextureCount() = 0;
virtual u32 getTextureCount() const = 0;
//! Gets the texture with the specified index
virtual video::ITexture* getTexture(u32 index) = 0;
virtual video::ITexture* getTexture(u32 index) const = 0;
//! Adds a texture to the sprite bank
virtual void addTexture(video::ITexture* texture) = 0;
@ -61,13 +61,13 @@ public:
//! Draws a sprite in 2d with position and color
virtual void draw2DSprite(u32 index, const core::position2di& pos, const core::rect<s32>* clip=0,
const video::SColor& color= video::SColor(255,255,255,255),
u32 starttime=0, u32 currenttime=0, bool loop=true, bool center=false) = 0;
u32 starttime=0, u32 currenttime=0, bool loop=true, bool center=false) = 0;
};
} // end namespace gui
} // end namespace irr
#endif // __I_GUI_SPRITE_BANK_H_INCLUDED__

View File

@ -24,7 +24,7 @@ namespace gui
: IGUIElement(EGUIET_STATIC_TEXT, environment, parent, id, rectangle) {}
//! destructor
~IGUIStaticText() {};
virtual ~IGUIStaticText() {}
//! Sets another skin independent font.
/** If this is set to zero, the button uses the font of the skin.
@ -33,7 +33,7 @@ namespace gui
//! Gets the override font (if any)
//! \return The override font (may be 0)
virtual IGUIFont * getOverrideFont(void) = 0;
virtual IGUIFont* getOverrideFont(void) const = 0;
//! Sets another color for the text.
/** If set, the static text does not use the EGDC_BUTTON_TEXT color defined
@ -47,7 +47,7 @@ namespace gui
//! Gets the override color
//! \return: The override color
virtual video::SColor const & getOverrideColor(void) = 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.
/** \param enable: If set to true, the override color, which can be set
@ -57,7 +57,7 @@ namespace gui
//! Checks if an override color is enabled
//! \return true if the override color is enabled, false otherwise
virtual bool isOverrideColorEnabled(void) = 0;
virtual bool isOverrideColorEnabled(void) const = 0;
//! Sets another color for the background.
virtual void setBackgroundColor(video::SColor color) = 0;
@ -82,19 +82,18 @@ namespace gui
//! Checks if word wrap is enabled
//! \return true if word wrap is enabled, false otherwise
virtual bool isWordWrapEnabled(void) = 0;
virtual bool isWordWrapEnabled(void) const = 0;
//! Returns the height of the text in pixels when it is drawn.
/** This is useful for adjusting the layout of gui elements based on the height
of the multiline text in this element.
\return Returns height of text in pixels. */
virtual s32 getTextHeight() = 0;
virtual s32 getTextHeight() const = 0;
//! Returns the width of the current text, in the current font
/** If the text is broken, this returns the width of the widest line
\return The width of the text, or the widest broken line. */
virtual s32 getTextWidth(void) = 0;
virtual s32 getTextWidth(void) const = 0;
};
@ -103,4 +102,3 @@ namespace gui
#endif

View File

@ -22,11 +22,11 @@ namespace gui
: IGUIElement(EGUIET_TAB, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUITab() {};
virtual ~IGUITab() {}
//! Returns number of tab if in tabcontrol.
/** Can be accessed later IGUITabControl::getTab() by this number. */
virtual s32 getNumber() = 0;
virtual s32 getNumber() const = 0;
//! sets if the tab should draw its background
virtual void setDrawBackground(bool draw=true) = 0;
@ -39,7 +39,6 @@ namespace gui
//! returns the color of the background
virtual video::SColor getBackgroundColor() const = 0;
};
//! A standard tab control
@ -52,19 +51,19 @@ namespace gui
: IGUIElement(EGUIET_TAB_CONTROL, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUITabControl() {};
virtual ~IGUITabControl() {}
//! Adds a tab
virtual IGUITab* addTab(const wchar_t* caption, s32 id=-1) = 0;
//! Returns amount of tabs in the tabcontrol
virtual s32 getTabcount() = 0;
virtual s32 getTabCount() const = 0;
//! Returns a tab based on zero based index
/** \param idx: zero based index of tab. Is a value betwenn 0 and getTabcount()-1;
\return Returns pointer to the Tab. Returns 0 if no tab
is corresponding to this tab. */
virtual IGUITab* getTab(s32 idx) = 0;
virtual IGUITab* getTab(s32 idx) const = 0;
//! Brings a tab to front.
/** \param idx: number of the tab.
@ -77,7 +76,7 @@ namespace gui
virtual bool setActiveTab(IGUIElement *tab) = 0;
//! Returns which tab is currently active
virtual s32 getActiveTab() = 0;
virtual s32 getActiveTab() const = 0;
};

View File

@ -27,7 +27,7 @@ namespace gui
: IGUIElement(EGUIET_TOOL_BAR, environment, parent, id, rectangle) {}
//! destructor
~IGUIToolBar() {};
virtual ~IGUIToolBar() {}
//! Adds a button to the tool bar
virtual IGUIButton* addButton(s32 id=-1, const wchar_t* text=0,const wchar_t* tooltiptext=0,

View File

@ -24,16 +24,16 @@ namespace gui
: IGUIElement(EGUIET_WINDOW, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIWindow() {};
virtual ~IGUIWindow() {}
//! Returns pointer to the close button
virtual IGUIButton* getCloseButton() = 0;
virtual IGUIButton* getCloseButton() const = 0;
//! Returns pointer to the minimize button
virtual IGUIButton* getMinimizeButton() = 0;
virtual IGUIButton* getMinimizeButton() const = 0;
//! Returns pointer to the maximize button
virtual IGUIButton* getMaximizeButton() = 0;
virtual IGUIButton* getMaximizeButton() const = 0;
};

View File

@ -105,7 +105,7 @@ public:
}
//! destructor
virtual ~ITexture() {};
virtual ~ITexture() {}
//! Lock function.
/** Locks the Texture and returns a pointer to access the
@ -128,11 +128,11 @@ public:
of the original texture. Use ITexture::getSize() if you want to know
the real size it has now stored in the system.
\return Returns the original size of the texture. */
virtual const core::dimension2d<s32>& getOriginalSize() = 0;
virtual const core::dimension2d<s32>& getOriginalSize() const = 0;
//! Returns dimension (=size) of the texture.
/** \return Returns the size of the texture. */
virtual const core::dimension2d<s32>& getSize() = 0;
virtual const core::dimension2d<s32>& getSize() const = 0;
//! Returns driver type of texture.
/** This is the driver, which created the texture.
@ -140,7 +140,7 @@ public:
use a texture because textures may be incompatible between different
devices.
\return Returns driver type of texture. */
virtual E_DRIVER_TYPE getDriverType() = 0;
virtual E_DRIVER_TYPE getDriverType() const = 0;
//! Returns the color format of texture.
/** \return Returns the color format of texture. */
@ -161,7 +161,7 @@ public:
virtual void regenerateMipMapLevels() = 0;
//! Returns name of texture (in most cases this is the filename)
const core::stringc& getName() { return Name; }
const core::stringc& getName() const { return Name; }
protected:

View File

@ -388,7 +388,7 @@ namespace video
//! Draws a 2d image without any special effects
/** \param texture: Pointer to texture to use.
\param destPos: upper left 2d destination position where the image will be drawn. */
virtual void draw2DImage(video::ITexture* texture,
virtual void draw2DImage(const video::ITexture* texture,
const core::position2d<s32>& destPos) = 0;
//! Draws a 2d image using a color
@ -404,7 +404,7 @@ namespace video
is used: If alpha is other than 255, the image will be transparent.
\param useAlphaChannelOfTexture: If true, the alpha channel of the texture is
used to draw the image.*/
virtual void draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos,
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false) = 0;
@ -425,7 +425,7 @@ namespace video
Note that the alpha component is used: If alpha is other than 255, the image will be transparent.
\param useAlphaChannelOfTexture: If true, the alpha channel of the texture is
used to draw the image. */
virtual void draw2DImage(video::ITexture* texture,
virtual void draw2DImage(const video::ITexture* texture,
const core::position2d<s32>& pos,
const core::array<core::rect<s32> >& sourceRects,
const core::array<s32>& indices,
@ -442,7 +442,7 @@ namespace video
\param clipRect: clips the destination rectangle (may be 0)
\param colors: array of 4 colors denoting the color values of the corners of the destRect
\param useAlphaChannelOfTexture: true if alpha channel will be blended. */
virtual void draw2DImage(video::ITexture* texture, const core::rect<s32>& destRect,
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
video::SColor* colors=0, bool useAlphaChannelOfTexture=false) = 0;
@ -743,7 +743,7 @@ namespace video
virtual const SExposedVideoData& getExposedVideoData() = 0;
//! Returns type of video driver
virtual E_DRIVER_TYPE getDriverType() = 0;
virtual E_DRIVER_TYPE getDriverType() const = 0;
//! Returns pointer to the IGPUProgrammingServices interface.
/** Returns 0 if the

View File

@ -879,7 +879,7 @@ void CD3D8Driver::drawVertexPrimitiveList(const void* vertices, u32 vertexCount,
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
void CD3D8Driver::draw2DImage(video::ITexture* texture, const core::position2d<s32>& pos,
void CD3D8Driver::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& pos,
const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, SColor color,
bool useAlphaChannelOfTexture)
@ -1007,7 +1007,7 @@ void CD3D8Driver::draw2DImage(video::ITexture* texture, const core::position2d<s
void CD3D8Driver::draw2DImage(video::ITexture* texture, const core::rect<s32>& destRect,
void CD3D8Driver::draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
video::SColor* colors, bool useAlphaChannelOfTexture)
{
@ -1907,7 +1907,7 @@ void CD3D8Driver::OnResize(const core::dimension2d<s32>& size)
}
//! Returns type of video driver
E_DRIVER_TYPE CD3D8Driver::getDriverType()
E_DRIVER_TYPE CD3D8Driver::getDriverType() const
{
return EDT_DIRECT3D8;
}

View File

@ -69,12 +69,12 @@ namespace video
void drawVertexPrimitiveList(const void* vertices, u32 vertexCount, const u16* indexList, u32 primitiveCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType);
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
virtual void draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos,
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false);
//! Draws a part of the texture into the rectangle.
virtual void draw2DImage(video::ITexture* texture, const core::rect<s32>& destRect,
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
video::SColor* colors=0, bool useAlphaChannelOfTexture=false);
@ -146,7 +146,7 @@ namespace video
virtual void OnResize(const core::dimension2d<s32>& size);
//! Returns type of video driver
virtual E_DRIVER_TYPE getDriverType();
virtual E_DRIVER_TYPE getDriverType() const;
//! Returns the transformation set by setTransform
virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state);

View File

@ -295,21 +295,21 @@ void CD3D8Texture::unlock()
//! Returns original size of the texture.
const core::dimension2d<s32>& CD3D8Texture::getOriginalSize()
const core::dimension2d<s32>& CD3D8Texture::getOriginalSize() const
{
return ImageSize;
}
//! Returns (=size) of the texture.
const core::dimension2d<s32>& CD3D8Texture::getSize()
const core::dimension2d<s32>& CD3D8Texture::getSize() const
{
return TextureSize;
}
//! returns the size of a texture which would be the optimize size for rendering it
inline s32 CD3D8Texture::getTextureSizeFromImageSize(s32 size)
inline s32 CD3D8Texture::getTextureSizeFromImageSize(s32 size) const
{
s32 ts = 0x01;
@ -320,9 +320,8 @@ inline s32 CD3D8Texture::getTextureSizeFromImageSize(s32 size)
}
//! returns driver type of texture (=the driver, who created the texture)
E_DRIVER_TYPE CD3D8Texture::getDriverType()
E_DRIVER_TYPE CD3D8Texture::getDriverType() const
{
return EDT_DIRECT3D8;
}
@ -479,7 +478,7 @@ ECOLOR_FORMAT CD3D8Texture::getColorFormatFromD3DFormat(D3DFORMAT format)
void CD3D8Texture::copy16BitMipMap(char* src, char* tgt,
s32 width, s32 height,
s32 pitchsrc, s32 pitchtgt)
s32 pitchsrc, s32 pitchtgt) const
{
u16 c;
@ -519,7 +518,7 @@ void CD3D8Texture::copy16BitMipMap(char* src, char* tgt,
void CD3D8Texture::copy32BitMipMap(char* src, char* tgt,
s32 width, s32 height,
s32 pitchsrc, s32 pitchtgt)
s32 pitchsrc, s32 pitchtgt) const
{
SColor c;
@ -618,7 +617,7 @@ void CD3D8Texture::regenerateMipMapLevels()
//! returns if it is a render target
bool CD3D8Texture::isRenderTarget()
bool CD3D8Texture::isRenderTarget() const
{
return IsRenderTarget;
}
@ -640,9 +639,8 @@ IDirect3DSurface8* CD3D8Texture::getRenderTargetSurface()
}
} // end namespace video
} // end namespace irr
#endif // _IRR_COMPILE_WITH_DIRECT3D_8_

View File

@ -43,13 +43,13 @@ public:
virtual void unlock();
//! Returns original size of the texture.
virtual const core::dimension2d<s32>& getOriginalSize();
virtual const core::dimension2d<s32>& getOriginalSize() const;
//! Returns (=size) of the texture.
virtual const core::dimension2d<s32>& getSize();
virtual const core::dimension2d<s32>& getSize() const;
//! returns driver type of texture (=the driver, who created the texture)
virtual E_DRIVER_TYPE getDriverType();
virtual E_DRIVER_TYPE getDriverType() const;
//! returns color format of texture
virtual ECOLOR_FORMAT getColorFormat() const;
@ -68,7 +68,7 @@ public:
virtual void regenerateMipMapLevels();
//! returns if it is a render target
bool isRenderTarget();
bool isRenderTarget() const;
//! Returns pointer to the render target surface
IDirect3DSurface8* getRenderTargetSurface();
@ -78,7 +78,7 @@ private:
void createRenderTarget();
//! returns the size of a texture which would be the optimize size for rendering it
inline s32 getTextureSizeFromImageSize(s32 size);
inline s32 getTextureSizeFromImageSize(s32 size) const;
//! creates the hardware texture
bool createTexture(u32 flags);
@ -92,10 +92,10 @@ private:
bool createMipMaps(u32 level=1);
void copy16BitMipMap(char* src, char* tgt,
s32 width, s32 height, s32 pitchsrc, s32 pitchtgt);
s32 width, s32 height, s32 pitchsrc, s32 pitchtgt) const;
void copy32BitMipMap(char* src, char* tgt,
s32 width, s32 height, s32 pitchsrc, s32 pitchtgt);
s32 width, s32 height, s32 pitchsrc, s32 pitchtgt) const;
IImage* Image;
IDirect3DDevice8* Device;

View File

@ -878,7 +878,7 @@ void CD3D9Driver::drawVertexPrimitiveList(const void* vertices, u32 vertexCount,
void CD3D9Driver::draw2DImage(video::ITexture* texture, const core::rect<s32>& destRect,
void CD3D9Driver::draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
video::SColor* colors, bool useAlphaChannelOfTexture)
{
@ -934,7 +934,7 @@ void CD3D9Driver::draw2DImage(video::ITexture* texture, const core::rect<s32>& d
//! draws a 2d image, using a color and the alpha channel of the texture if
//! desired. The image is drawn at pos and clipped against clipRect (if != 0).
void CD3D9Driver::draw2DImage(video::ITexture* texture,
void CD3D9Driver::draw2DImage(const video::ITexture* texture,
const core::position2d<s32>& pos,
const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, SColor color,
@ -1952,7 +1952,7 @@ void CD3D9Driver::OnResize(const core::dimension2d<s32>& size)
//! Returns type of video driver
E_DRIVER_TYPE CD3D9Driver::getDriverType()
E_DRIVER_TYPE CD3D9Driver::getDriverType() const
{
return EDT_DIRECT3D9;
}

View File

@ -63,12 +63,12 @@ namespace video
virtual void drawVertexPrimitiveList(const void* vertices, u32 vertexCount, const u16* indexList, u32 primitiveCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType);
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
virtual void draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos,
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false);
//! Draws a part of the texture into the rectangle.
virtual void draw2DImage(video::ITexture* texture, const core::rect<s32>& destRect,
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
video::SColor* colors=0, bool useAlphaChannelOfTexture=false);
@ -144,7 +144,7 @@ namespace video
bool resetAllRenderstates);
//! Returns type of video driver
virtual E_DRIVER_TYPE getDriverType();
virtual E_DRIVER_TYPE getDriverType() const;
//! Returns the transformation set by setTransform
virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state);

View File

@ -501,21 +501,21 @@ void CD3D9Texture::unlock()
//! Returns original size of the texture.
const core::dimension2d<s32>& CD3D9Texture::getOriginalSize()
const core::dimension2d<s32>& CD3D9Texture::getOriginalSize() const
{
return ImageSize;
}
//! Returns (=size) of the texture.
const core::dimension2d<s32>& CD3D9Texture::getSize()
const core::dimension2d<s32>& CD3D9Texture::getSize() const
{
return TextureSize;
}
//! returns the size of a texture which would be the optimize size for rendering it
inline s32 CD3D9Texture::getTextureSizeFromImageSize(s32 size)
inline s32 CD3D9Texture::getTextureSizeFromImageSize(s32 size) const
{
s32 ts = 0x01;
@ -528,7 +528,7 @@ inline s32 CD3D9Texture::getTextureSizeFromImageSize(s32 size)
//! returns driver type of texture (=the driver, who created the texture)
E_DRIVER_TYPE CD3D9Texture::getDriverType()
E_DRIVER_TYPE CD3D9Texture::getDriverType() const
{
return EDT_DIRECT3D9;
}
@ -567,7 +567,7 @@ bool CD3D9Texture::hasMipMaps() const
void CD3D9Texture::copy16BitMipMap(char* src, char* tgt,
s32 width, s32 height,
s32 pitchsrc, s32 pitchtgt)
s32 pitchsrc, s32 pitchtgt) const
{
for (s32 y=0; y<height; ++y)
{
@ -613,7 +613,7 @@ void CD3D9Texture::copy16BitMipMap(char* src, char* tgt,
void CD3D9Texture::copy32BitMipMap(char* src, char* tgt,
s32 width, s32 height,
s32 pitchsrc, s32 pitchtgt)
s32 pitchsrc, s32 pitchtgt) const
{
for (s32 y=0; y<height; ++y)
{
@ -660,7 +660,7 @@ void CD3D9Texture::regenerateMipMapLevels()
//! returns if it is a render target
bool CD3D9Texture::isRenderTarget()
bool CD3D9Texture::isRenderTarget() const
{
return IsRenderTarget;
}
@ -682,8 +682,8 @@ IDirect3DSurface9* CD3D9Texture::getRenderTargetSurface()
}
} // end namespace video
} // end namespace irr
#endif // _IRR_COMPILE_WITH_DIRECT3D_9_

View File

@ -42,13 +42,13 @@ public:
virtual void unlock();
//! Returns original size of the texture.
virtual const core::dimension2d<s32>& getOriginalSize();
virtual const core::dimension2d<s32>& getOriginalSize() const;
//! Returns (=size) of the texture.
virtual const core::dimension2d<s32>& getSize();
virtual const core::dimension2d<s32>& getSize() const;
//! returns driver type of texture (=the driver, who created the texture)
virtual E_DRIVER_TYPE getDriverType();
virtual E_DRIVER_TYPE getDriverType() const;
//! returns color format of texture
virtual ECOLOR_FORMAT getColorFormat() const;
@ -67,7 +67,7 @@ public:
virtual void regenerateMipMapLevels();
//! returns if it is a render target
bool isRenderTarget();
bool isRenderTarget() const;
//! Returns pointer to the render target surface
IDirect3DSurface9* getRenderTargetSurface();
@ -77,7 +77,7 @@ private:
void createRenderTarget();
//! returns the size of a texture which would be the optimize size for rendering it
inline s32 getTextureSizeFromImageSize(s32 size);
inline s32 getTextureSizeFromImageSize(s32 size) const;
//! creates the hardware texture
bool createTexture(u32 flags);
@ -96,11 +96,11 @@ private:
//! Helper function for mipmap generation.
void copy16BitMipMap(char* src, char* tgt,
s32 width, s32 height, s32 pitchsrc, s32 pitchtgt);
s32 width, s32 height, s32 pitchsrc, s32 pitchtgt) const;
//! Helper function for mipmap generation.
void copy32BitMipMap(char* src, char* tgt,
s32 width, s32 height, s32 pitchsrc, s32 pitchtgt);
s32 width, s32 height, s32 pitchsrc, s32 pitchtgt) const;
IImage* Image;
IDirect3DDevice9* Device;

View File

@ -105,14 +105,14 @@ IGUIElement* CDefaultGUIElementFactory::addGUIElement(const c8* typeName, IGUIEl
//! returns amount of element types this factory is able to create
s32 CDefaultGUIElementFactory::getCreatableGUIElementTypeCount()
s32 CDefaultGUIElementFactory::getCreatableGUIElementTypeCount() const
{
return EGUIET_COUNT;
}
//! returns type of a createable element type
EGUI_ELEMENT_TYPE CDefaultGUIElementFactory::getCreateableGUIElementType(s32 idx)
EGUI_ELEMENT_TYPE CDefaultGUIElementFactory::getCreateableGUIElementType(s32 idx) const
{
if (idx>=0 && idx<EGUIET_COUNT)
return (EGUI_ELEMENT_TYPE)idx;
@ -122,7 +122,7 @@ EGUI_ELEMENT_TYPE CDefaultGUIElementFactory::getCreateableGUIElementType(s32 idx
//! returns type name of a createable element type
const c8* CDefaultGUIElementFactory::getCreateableGUIElementTypeName(s32 idx)
const c8* CDefaultGUIElementFactory::getCreateableGUIElementTypeName(s32 idx) const
{
if (idx>=0 && idx<EGUIET_COUNT)
return GUIElementTypeNames[idx];
@ -132,7 +132,7 @@ const c8* CDefaultGUIElementFactory::getCreateableGUIElementTypeName(s32 idx)
//! returns type name of a createable element type
const c8* CDefaultGUIElementFactory::getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type)
const c8* CDefaultGUIElementFactory::getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type) const
{
// for this factory, type == index
@ -142,9 +142,9 @@ const c8* CDefaultGUIElementFactory::getCreateableGUIElementTypeName(EGUI_ELEMEN
return 0;
}
EGUI_ELEMENT_TYPE CDefaultGUIElementFactory::getTypeFromName(const c8* name)
EGUI_ELEMENT_TYPE CDefaultGUIElementFactory::getTypeFromName(const c8* name) const
{
for ( int i=0; GUIElementTypeNames[i]; ++i)
for ( u32 i=0; GUIElementTypeNames[i]; ++i)
if (!strcmp(name, GUIElementTypeNames[i]) )
return (EGUI_ELEMENT_TYPE)i;
@ -156,3 +156,4 @@ EGUI_ELEMENT_TYPE CDefaultGUIElementFactory::getTypeFromName(const c8* name)
} // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_

View File

@ -37,26 +37,26 @@ namespace gui
virtual IGUIElement* addGUIElement(const c8* typeName, IGUIElement* parent=0);
//! returns amount of GUI element types this factory is able to create
virtual s32 getCreatableGUIElementTypeCount();
virtual s32 getCreatableGUIElementTypeCount() const;
//! returns type of a createable element type
/** \param idx: Index of the element type in this factory. Must be a value between 0 and
getCreatableGUIElementTypeCount() */
virtual EGUI_ELEMENT_TYPE getCreateableGUIElementType(s32 idx);
virtual EGUI_ELEMENT_TYPE getCreateableGUIElementType(s32 idx) const;
//! returns type name of a createable GUI element type by index
/** \param idx: Index of the type in this factory. Must be a value between 0 and
getCreatableGUIElementTypeCount() */
virtual const c8* getCreateableGUIElementTypeName(s32 idx);
virtual const c8* getCreateableGUIElementTypeName(s32 idx) const;
//! returns type name of a createable GUI element
/** \param type: Type of GUE element.
\return: Returns name of the type if this factory can create the type, otherwise 0. */
virtual const c8* getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type);
virtual const c8* getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type) const;
private:
EGUI_ELEMENT_TYPE getTypeFromName(const c8* name);
EGUI_ELEMENT_TYPE getTypeFromName(const c8* name) const;
IGUIEnvironment* Environment;
};

View File

@ -372,7 +372,7 @@ void CGUIButton::setIsPushButton(bool isPushButton)
//! Returns if the button is currently pressed
bool CGUIButton::isPressed()
bool CGUIButton::isPressed() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return Pressed;
@ -389,7 +389,7 @@ void CGUIButton::setPressed(bool pressed)
}
//! Returns whether the button is a push button
bool CGUIButton::isPushButton()
bool CGUIButton::isPushButton() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsPushButton;
@ -402,13 +402,13 @@ void CGUIButton::setUseAlphaChannel(bool useAlphaChannel)
}
//! Returns if the alpha channel should be used for drawing images on the button
bool CGUIButton::isAlphaChannelUsed()
bool CGUIButton::isAlphaChannelUsed() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return UseAlphaChannel;
}
bool CGUIButton::isDrawingBorder()
bool CGUIButton::isDrawingBorder() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return Border;

View File

@ -67,7 +67,7 @@ namespace gui
virtual void setIsPushButton(bool isPushButton);
//! Returns if the button is currently pressed
virtual bool isPressed();
virtual bool isPressed() const;
//! Sets the pressed state of the button if this is a pushbutton
virtual void setPressed(bool pressed);
@ -79,13 +79,13 @@ namespace gui
virtual void setUseAlphaChannel(bool useAlphaChannel);
//! Returns if the alpha channel should be used for drawing images on the button
virtual bool isAlphaChannelUsed();
virtual bool isAlphaChannelUsed() const;
//! Returns if the button face and border are being drawn
virtual bool isDrawingBorder();
virtual bool isDrawingBorder() const;
//! Returns whether the button is a push button
virtual bool isPushButton();
virtual bool isPushButton() const;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;

View File

@ -32,13 +32,6 @@ CGUICheckBox::CGUICheckBox(bool checked, IGUIEnvironment* environment, IGUIEleme
//! destructor
CGUICheckBox::~CGUICheckBox()
{
}
//! called if an event happened.
bool CGUICheckBox::OnEvent(SEvent event)
{
@ -177,7 +170,7 @@ void CGUICheckBox::setChecked(bool checked)
//! returns if box is checked
bool CGUICheckBox::isChecked()
bool CGUICheckBox::isChecked() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return Checked;

View File

@ -22,14 +22,11 @@ namespace gui
//! constructor
CGUICheckBox(bool checked, IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle);
//! destructor
~CGUICheckBox();
//! set if box is checked
virtual void setChecked(bool checked);
//! returns if box is checked
virtual bool isChecked();
virtual bool isChecked() const;
//! called if an event happened.
virtual bool OnEvent(SEvent event);

View File

@ -159,7 +159,6 @@ CGUIColorSelectDialog::CGUIColorSelectDialog( const wchar_t* title, IGUIEnvironm
bringToFront(CancelButton);
bringToFront(OKButton);
}
@ -186,7 +185,6 @@ CGUIColorSelectDialog::~CGUIColorSelectDialog()
{
ColorRing.Control->drop ();
}
}
//! renders a antialiased, colored ring

View File

@ -57,38 +57,33 @@ CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent,
// this element can be tabbed to
setTabStop(true);
setTabOrder(-1);
}
//! destructor
CGUIComboBox::~CGUIComboBox()
{
}
//! Returns amount of items in box
s32 CGUIComboBox::getItemCount()
u32 CGUIComboBox::getItemCount() const
{
return Items.size();
}
//! returns string of an item. the idx may be a value from 0 to itemCount-1
const wchar_t* CGUIComboBox::getItem(s32 idx) const
const wchar_t* CGUIComboBox::getItem(u32 idx) const
{
if (idx < 0 || idx >= (s32)Items.size())
if (idx >= Items.size())
return 0;
return Items[idx].c_str();
}
//! Removes an item from the combo box.
void CGUIComboBox::removeItem(s32 idx)
void CGUIComboBox::removeItem(u32 idx)
{
if (idx < 0 || idx >= (s32)Items.size())
if (idx >= Items.size())
return;
if (Selected == idx)
if (Selected == (s32)idx)
Selected = -1;
Items.erase(idx);
@ -102,7 +97,7 @@ const wchar_t* CGUIComboBox::getText() const
//! adds an item and returns the index of it
s32 CGUIComboBox::addItem(const wchar_t* text)
u32 CGUIComboBox::addItem(const wchar_t* text)
{
Items.push_back(core::stringw(text));
@ -124,7 +119,7 @@ void CGUIComboBox::clear()
//! returns id of selected item. returns -1 if no item is selected.
s32 CGUIComboBox::getSelected()
s32 CGUIComboBox::getSelected() const
{
return Selected;
}
@ -134,7 +129,7 @@ s32 CGUIComboBox::getSelected()
//! sets the selected item. Set this to -1 if no item should be selected
void CGUIComboBox::setSelected(s32 id)
{
if (id <0 || id>=(s32)Items.size())
if (id < -1 || id >= (s32)Items.size())
return;
Selected = id;
@ -144,7 +139,7 @@ void CGUIComboBox::updateAbsolutePosition()
{
IGUIElement::updateAbsolutePosition();
s32 width = Environment->getSkin()->getSize(EGDS_WINDOW_BUTTON_WIDTH);
const s32 width = Environment->getSkin()->getSize(EGDS_WINDOW_BUTTON_WIDTH);
ListButton->setRelativePosition(core::rect<s32>(RelativeRect.getWidth() - width - 2, 2,
RelativeRect.getWidth() - 2, RelativeRect.getHeight() - 2));
@ -441,3 +436,4 @@ void CGUIComboBox::deserializeAttributes(io::IAttributes* in, io::SAttributeRead
#endif // _IRR_COMPILE_WITH_GUI_

View File

@ -28,20 +28,17 @@ namespace gui
CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle);
//! destructor
~CGUIComboBox();
//! Returns amount of items in box
virtual s32 getItemCount();
virtual u32 getItemCount() const;
//! returns string of an item. the idx may be a value from 0 to itemCount-1
virtual const wchar_t* getItem(s32 idx) const;
virtual const wchar_t* getItem(u32 idx) const;
//! adds an item and returns the index of it
virtual s32 addItem(const wchar_t* text);
virtual u32 addItem(const wchar_t* text);
//! Removes an item from the combo box.
virtual void removeItem(s32 id);
virtual void removeItem(u32 id);
//! deletes all items in the combo box
virtual void clear();
@ -50,7 +47,7 @@ namespace gui
virtual const wchar_t* getText() const;
//! returns id of selected item. returns -1 if no item is selected.
virtual s32 getSelected();
virtual s32 getSelected() const;
//! sets the selected item. Set this to -1 if no item should be selected
virtual void setSelected(s32 id);

View File

@ -19,7 +19,6 @@ namespace gui
{
//! constructor
CGUIContextMenu::CGUIContextMenu(IGUIEnvironment* environment,
IGUIElement* parent, s32 id,
@ -51,14 +50,14 @@ CGUIContextMenu::~CGUIContextMenu()
//! Returns amount of menu items
s32 CGUIContextMenu::getItemCount() const
u32 CGUIContextMenu::getItemCount() const
{
return (s32)Items.size();
return Items.size();
}
//! Adds a menu item.
s32 CGUIContextMenu::addItem(const wchar_t* text, s32 id, bool enabled, bool hasSubMenu, bool checked)
u32 CGUIContextMenu::addItem(const wchar_t* text, s32 id, bool enabled, bool hasSubMenu, bool checked)
{
SItem s;
s.Enabled = enabled;
@ -82,9 +81,9 @@ s32 CGUIContextMenu::addItem(const wchar_t* text, s32 id, bool enabled, bool has
}
//! Adds a sub menu from an element that already exists.
void CGUIContextMenu::setSubMenu(s32 index, CGUIContextMenu* menu)
void CGUIContextMenu::setSubMenu(u32 index, CGUIContextMenu* menu)
{
if ((u32)index >= Items.size())
if (index >= Items.size())
return;
if (Items[index].SubMenu)
@ -115,9 +114,9 @@ void CGUIContextMenu::addSeparator()
//! Returns text of the menu item.
const wchar_t* CGUIContextMenu::getItemText(s32 idx)
const wchar_t* CGUIContextMenu::getItemText(u32 idx) const
{
if ((u32)idx >= Items.size())
if (idx >= Items.size())
return 0;
return Items[idx].Text.c_str();
@ -125,9 +124,9 @@ const wchar_t* CGUIContextMenu::getItemText(s32 idx)
//! Sets text of the menu item.
void CGUIContextMenu::setItemText(s32 idx, const wchar_t* text)
void CGUIContextMenu::setItemText(u32 idx, const wchar_t* text)
{
if ((u32)idx >= Items.size())
if (idx >= Items.size())
return;
Items[idx].Text = text;
@ -136,9 +135,9 @@ void CGUIContextMenu::setItemText(s32 idx, const wchar_t* text)
//! Returns if a menu item is enabled
bool CGUIContextMenu::isItemEnabled(s32 idx)
bool CGUIContextMenu::isItemEnabled(u32 idx) const
{
if ((u32)idx >= Items.size())
if (idx >= Items.size())
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return false;
@ -148,10 +147,11 @@ bool CGUIContextMenu::isItemEnabled(s32 idx)
return Items[idx].Enabled;
}
//! Returns if a menu item is checked
bool CGUIContextMenu::isItemChecked(s32 idx)
bool CGUIContextMenu::isItemChecked(u32 idx) const
{
if ((u32)idx >= Items.size())
if (idx >= Items.size())
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return false;
@ -163,18 +163,19 @@ bool CGUIContextMenu::isItemChecked(s32 idx)
//! Sets if the menu item should be enabled.
void CGUIContextMenu::setItemEnabled(s32 idx, bool enabled)
void CGUIContextMenu::setItemEnabled(u32 idx, bool enabled)
{
if ((u32)idx >= Items.size())
if (idx >= Items.size())
return;
Items[idx].Enabled = enabled;
}
//! Sets if the menu item should be checked.
void CGUIContextMenu::setItemChecked(s32 idx, bool checked )
void CGUIContextMenu::setItemChecked(u32 idx, bool checked )
{
if ((u32)idx >= Items.size())
if (idx >= Items.size())
return;
Items[idx].Checked = checked;
@ -182,9 +183,9 @@ void CGUIContextMenu::setItemChecked(s32 idx, bool checked )
//! Removes a menu item
void CGUIContextMenu::removeItem(s32 idx)
void CGUIContextMenu::removeItem(u32 idx)
{
if ((u32)idx >= Items.size())
if (idx >= Items.size())
return;
if (Items[idx].SubMenu)
@ -247,7 +248,7 @@ bool CGUIContextMenu::OnEvent(SEvent event)
{
// menu might be removed if it loses focus in sendClick, so grab a reference
grab();
s32 t = sendClick(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y));
const u32 t = sendClick(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y));
if ((t==0 || t==1) && Environment->hasFocus(this))
Environment->removeFocus(this);
drop();
@ -288,9 +289,9 @@ void CGUIContextMenu::setVisible(bool visible)
//! 0 if click went outside of the element,
//! 1 if a valid button was clicked,
//! 2 if a nonclickable element was clicked
s32 CGUIContextMenu::sendClick(core::position2d<s32> p)
u32 CGUIContextMenu::sendClick(core::position2d<s32> p)
{
s32 t = 0;
u32 t = 0;
// get number of open submenu
s32 openmenu = -1;
@ -386,7 +387,7 @@ bool CGUIContextMenu::highlight(core::position2d<s32> p, bool canOpenSubMenu)
//! returns the item highlight-area
core::rect<s32> CGUIContextMenu::getHRect(const SItem& i, const core::rect<s32>& absolute)
core::rect<s32> CGUIContextMenu::getHRect(const SItem& i, const core::rect<s32>& absolute) const
{
core::rect<s32> r = absolute;
r.UpperLeftCorner.Y += i.PosY;
@ -396,7 +397,7 @@ core::rect<s32> CGUIContextMenu::getHRect(const SItem& i, const core::rect<s32>&
//! Gets drawing rect of Item
core::rect<s32> CGUIContextMenu::getRect(const SItem& i, const core::rect<s32>& absolute)
core::rect<s32> CGUIContextMenu::getRect(const SItem& i, const core::rect<s32>& absolute) const
{
core::rect<s32> r = absolute;
r.UpperLeftCorner.Y += i.PosY;
@ -504,7 +505,6 @@ void CGUIContextMenu::draw()
(i == HighLighted) ? os::Timer::getTime() : 0,
(i == HighLighted), true);
}
}
}
@ -524,9 +524,9 @@ void CGUIContextMenu::recalculateSize()
rect.UpperLeftCorner = RelativeRect.UpperLeftCorner;
s32 width = 100;
s32 height = 3;
s32 i;
for (i=0; i<(s32)Items.size(); ++i)
u32 i;
for (i=0; i<Items.size(); ++i)
{
if (Items[i].IsSeparator)
{
@ -557,13 +557,13 @@ void CGUIContextMenu::recalculateSize()
setRelativePosition(rect);
// recalculate submenus
for (i=0; i<(s32)Items.size(); ++i)
for (i=0; i<Items.size(); ++i)
{
if (Items[i].SubMenu)
{
// move submenu
s32 w = Items[i].SubMenu->getAbsolutePosition().getWidth();
s32 h = Items[i].SubMenu->getAbsolutePosition().getHeight();
const s32 w = Items[i].SubMenu->getAbsolutePosition().getWidth();
const s32 h = Items[i].SubMenu->getAbsolutePosition().getHeight();
Items[i].SubMenu->setRelativePosition(
core::rect<s32>(width-5, Items[i].PosY,
@ -574,16 +574,16 @@ void CGUIContextMenu::recalculateSize()
//! Returns the selected item in the menu
s32 CGUIContextMenu::getSelectedItem()
s32 CGUIContextMenu::getSelectedItem() const
{
return HighLighted;
}
//! \return Returns a pointer to the submenu of an item.
IGUIContextMenu* CGUIContextMenu::getSubMenu(s32 idx)
IGUIContextMenu* CGUIContextMenu::getSubMenu(u32 idx) const
{
if ((u32)idx >= Items.size())
if (idx >= Items.size())
return 0;
return Items[idx].SubMenu;
@ -591,18 +591,18 @@ IGUIContextMenu* CGUIContextMenu::getSubMenu(s32 idx)
//! Returns command id of a menu item
s32 CGUIContextMenu::getItemCommandId(s32 idx)
s32 CGUIContextMenu::getItemCommandId(u32 idx) const
{
if ((u32)idx >= Items.size())
if (idx >= Items.size())
return -1;
return Items[idx].CommandId;
}
//! Sets the command id of a menu item
void CGUIContextMenu::setItemCommandId(s32 idx, s32 id)
void CGUIContextMenu::setItemCommandId(u32 idx, s32 id)
{
if ((u32)idx >= Items.size())
if (idx >= Items.size())
return;
Items[idx].CommandId = id;
@ -619,7 +619,8 @@ void CGUIContextMenu::serializeAttributes(io::IAttributes* out, io::SAttributeRe
IGUIContextMenu* ptr = (IGUIContextMenu*)Parent;
// find the position of this item in its parent's list
s32 i;
for (i=0; i<ptr->getItemCount() && ptr->getSubMenu(i) != this; ++i);
for (i=0; i<(s32)ptr->getItemCount() && ptr->getSubMenu(i) != this; ++i)
; // do nothing
out->addInt("ParentItem", i);
}
@ -646,6 +647,7 @@ void CGUIContextMenu::serializeAttributes(io::IAttributes* out, io::SAttributeRe
}
}
//! Reads attributes of the element
void CGUIContextMenu::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
@ -707,7 +709,8 @@ void CGUIContextMenu::setEventParent(IGUIElement *parent)
}
}
bool CGUIContextMenu::hasOpenSubMenu()
bool CGUIContextMenu::hasOpenSubMenu() const
{
for (u32 i=0; i<Items.size(); ++i)
if (Items[i].SubMenu)
@ -716,6 +719,7 @@ bool CGUIContextMenu::hasOpenSubMenu()
return false;
}
void CGUIContextMenu::closeAllSubMenus()
{
for (u32 i=0; i<Items.size(); ++i)
@ -729,6 +733,5 @@ void CGUIContextMenu::closeAllSubMenus()
} // end namespace
} // end namespace
#endif // _IRR_COMPILE_WITH_GUI_

View File

@ -28,39 +28,38 @@ namespace gui
bool getFocus = true, bool allowFocus = true);
//! destructor
~CGUIContextMenu();
virtual ~CGUIContextMenu();
//! Returns amount of menu items
virtual s32 getItemCount() const;
virtual u32 getItemCount() const;
//! Adds a menu item.
virtual s32 addItem(const wchar_t* text, s32 commandid, bool enabled,
bool hasSubMenu,
bool checked);
virtual u32 addItem(const wchar_t* text, s32 commandid,
bool enabled, bool hasSubMenu, bool checked);
//! Adds a separator item to the menu
virtual void addSeparator();
//! Returns text of the menu item.
virtual const wchar_t* getItemText(s32 idx);
virtual const wchar_t* getItemText(u32 idx) const;
//! Sets text of the menu item.
virtual void setItemText(s32 idx, const wchar_t* text);
virtual void setItemText(u32 idx, const wchar_t* text);
//! Returns if a menu item is enabled
virtual bool isItemEnabled(s32 idx);
virtual bool isItemEnabled(u32 idx) const;
//! Sets if the menu item should be enabled.
virtual void setItemEnabled(s32 idx, bool enabled);
virtual void setItemEnabled(u32 idx, bool enabled);
//! Returns if a menu item is checked
virtual bool isItemChecked(s32 idx);
virtual bool isItemChecked(u32 idx) const;
//! Sets if the menu item should be checked.
virtual void setItemChecked(s32 idx, bool enabled);
virtual void setItemChecked(u32 idx, bool enabled);
//! Removes a menu item
virtual void removeItem(s32 idx);
virtual void removeItem(u32 idx);
//! Removes all menu items
virtual void removeAllItems();
@ -72,23 +71,23 @@ namespace gui
virtual void draw();
//! Returns the selected item in the menu
virtual s32 getSelectedItem();
virtual s32 getSelectedItem() const;
//! Returns a pointer to the submenu of an item.
//! \return Pointer to the submenu of an item.
virtual IGUIContextMenu* getSubMenu(s32 idx);
virtual IGUIContextMenu* getSubMenu(u32 idx) const;
//! Sets the visible state of this element.
virtual void setVisible(bool visible);
//! Returns command id of a menu item
virtual s32 getItemCommandId(s32 idx);
virtual s32 getItemCommandId(u32 idx) const;
//! Sets the command id of a menu item
virtual void setItemCommandId(s32 idx, s32 id);
virtual void setItemCommandId(u32 idx, s32 id);
//! Adds a sub menu from an element that already exists.
virtual void setSubMenu(s32 index, CGUIContextMenu* menu);
virtual void setSubMenu(u32 index, CGUIContextMenu* menu);
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
@ -99,7 +98,7 @@ namespace gui
protected:
void closeAllSubMenus();
bool hasOpenSubMenu();
bool hasOpenSubMenu() const;
struct SItem
{
@ -122,13 +121,13 @@ namespace gui
//! 0 if click went outside of the element,
//! 1 if a valid button was clicked,
//! 2 if a nonclickable element was clicked
virtual s32 sendClick(core::position2d<s32> p);
virtual u32 sendClick(core::position2d<s32> p);
//! returns the item highlight-area
virtual core::rect<s32> getHRect(const SItem& i, const core::rect<s32>& absolute);
virtual core::rect<s32> getHRect(const SItem& i, const core::rect<s32>& absolute) const;
//! Gets drawing rect of Item
virtual core::rect<s32> getRect(const SItem& i, const core::rect<s32>& absolute);
virtual core::rect<s32> getRect(const SItem& i, const core::rect<s32>& absolute) const;
void setEventParent(IGUIElement *parent);
@ -140,9 +139,11 @@ namespace gui
bool AllowFocus;
};
} // end namespace gui
} // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_
#endif // __C_GUI_CONTEXT_MENU_H_INCLUDED__

View File

@ -92,6 +92,7 @@ void CGUIEditBox::setOverrideColor(video::SColor color)
OverrideColorEnabled = true;
}
//! Turns the border on or off
void CGUIEditBox::setDrawBorder(bool border)
{
@ -105,6 +106,7 @@ void CGUIEditBox::enableOverrideColor(bool enable)
OverrideColorEnabled = enable;
}
//! Enables or disables word wrap
void CGUIEditBox::setWordWrap(bool enable)
{
@ -112,32 +114,37 @@ void CGUIEditBox::setWordWrap(bool enable)
breakText();
}
void CGUIEditBox::updateAbsolutePosition()
{
IGUIElement::updateAbsolutePosition();
breakText();
}
//! Checks if word wrap is enabled
bool CGUIEditBox::isWordWrapEnabled()
bool CGUIEditBox::isWordWrapEnabled() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return WordWrap;
}
//! Enables or disables newlines.
void CGUIEditBox::setMultiLine(bool enable)
{
MultiLine = enable;
}
//! Checks if multi line editing is enabled
bool CGUIEditBox::isMultiLineEnabled()
bool CGUIEditBox::isMultiLineEnabled() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return MultiLine;
}
void CGUIEditBox::setPasswordBox(bool passwordBox, wchar_t passwordChar)
{
PasswordBox = passwordBox;
@ -150,11 +157,14 @@ void CGUIEditBox::setPasswordBox(bool passwordBox, wchar_t passwordChar)
}
}
bool CGUIEditBox::isPasswordBox()
bool CGUIEditBox::isPasswordBox() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return PasswordBox;
}
//! Sets text justification
void CGUIEditBox::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical)
{
@ -162,6 +172,7 @@ void CGUIEditBox::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT ver
VAlign = vertical;
}
//! called if an event happened.
bool CGUIEditBox::OnEvent(SEvent event)
{
@ -272,7 +283,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
s.append(p);
s.append( Text.subString(CursorPos, Text.size()-CursorPos) );
if (!Max || s.size()<=(u32)Max) // thx to Fish FH for fix
if (!Max || s.size()<=Max) // thx to Fish FH for fix
{
Text = s;
s = p;
@ -287,7 +298,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
s.append(p);
s.append( Text.subString(realmend, Text.size()-realmend) );
if (!Max || s.size()<=(u32)Max) // thx to Fish FH for fix
if (!Max || s.size()<=Max) // thx to Fish FH for fix
{
Text = s;
s = p;
@ -813,10 +824,10 @@ void CGUIEditBox::draw()
OverrideColorEnabled ? OverrideColor : skin->getColor(EGDC_BUTTON_TEXT),
false, true, &localClipRect);
}
}
}
//! Sets the new caption of this element.
void CGUIEditBox::setText(const wchar_t* text)
{
@ -828,6 +839,7 @@ void CGUIEditBox::setText(const wchar_t* text)
breakText();
}
//! Enables or disables automatic scrolling with cursor position
//! \param enable: If set to true, the text will move around with the cursor position
void CGUIEditBox::setAutoScroll(bool enable)
@ -835,9 +847,10 @@ void CGUIEditBox::setAutoScroll(bool enable)
AutoScroll = enable;
}
//! Checks to see if automatic scrolling is enabled
//! \return true if automatic scrolling is enabled, false if not
bool CGUIEditBox::isAutoScrollEnabled()
bool CGUIEditBox::isAutoScrollEnabled() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return AutoScroll;
@ -866,19 +879,17 @@ core::dimension2di CGUIEditBox::getTextDimension()
//! Sets the maximum amount of characters which may be entered in the box.
//! \param max: Maximum amount of characters. If 0, the character amount is
//! infinity.
void CGUIEditBox::setMax(s32 max)
void CGUIEditBox::setMax(u32 max)
{
Max = max;
if (Max < 0)
Max = 0;
if (Text.size() > (u32)Max && Max != 0)
if (Text.size() > Max && Max != 0)
Text = Text.subString(0, Max);
}
//! Returns maximum amount of characters, previously set by setMax();
s32 CGUIEditBox::getMax()
u32 CGUIEditBox::getMax() const
{
return Max;
}
@ -999,6 +1010,7 @@ s32 CGUIEditBox::getCursorPos(s32 x, s32 y)
return txtLine->size() + startPos;
}
//! Breaks the single text line.
void CGUIEditBox::breakText()
{
@ -1112,6 +1124,7 @@ void CGUIEditBox::breakText()
BrokenTextPositions.push_back(lastLineStart);
}
void CGUIEditBox::setTextRect(s32 line)
{
core::dimension2di d;
@ -1182,6 +1195,7 @@ void CGUIEditBox::setTextRect(s32 line)
}
s32 CGUIEditBox::getLineFromPos(s32 pos)
{
if (!WordWrap && !MultiLine)
@ -1197,6 +1211,7 @@ s32 CGUIEditBox::getLineFromPos(s32 pos)
return (s32)BrokenTextPositions.size() - 1;
}
void CGUIEditBox::inputChar(wchar_t c)
{
if (!IsEnabled)
@ -1204,7 +1219,7 @@ void CGUIEditBox::inputChar(wchar_t c)
if (c != 0)
{
if (Text.size() < (u32)Max || Max == 0)
if (Text.size() < Max || Max == 0)
{
core::stringw s;
@ -1289,6 +1304,7 @@ void CGUIEditBox::calculateScrollPos()
// todo: adjust scrollbar
}
//! Writes attributes of the element.
void CGUIEditBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
@ -1311,6 +1327,7 @@ void CGUIEditBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWr
IGUIEditBox::serializeAttributes(out,options);
}
//! Reads attributes of the element
void CGUIEditBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
@ -1340,3 +1357,4 @@ void CGUIEditBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadW
} // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_

View File

@ -25,7 +25,7 @@ namespace gui
IGUIElement* parent, s32 id, const core::rect<s32>& rectangle);
//! destructor
~CGUIEditBox();
virtual ~CGUIEditBox();
//! Sets another skin independent font.
virtual void setOverrideFont(IGUIFont* font=0);
@ -45,7 +45,7 @@ namespace gui
//! Checks if word wrap is enabled
//! \return true if word wrap is enabled, false otherwise
virtual bool isWordWrapEnabled();
virtual bool isWordWrapEnabled() const;
//! Enables or disables newlines.
/** \param enable: If set to true, the EGET_EDITBOX_ENTER event will not be fired,
@ -54,7 +54,7 @@ namespace gui
//! Checks if multi line editing is enabled
//! \return true if mult-line is enabled, false otherwise
virtual bool isMultiLineEnabled();
virtual bool isMultiLineEnabled() const;
//! Enables or disables automatic scrolling with cursor position
//! \param enable: If set to true, the text will move around with the cursor position
@ -62,7 +62,7 @@ namespace gui
//! Checks to see if automatic scrolling is enabled
//! \return true if automatic scrolling is enabled, false if not
virtual bool isAutoScrollEnabled();
virtual bool isAutoScrollEnabled() const;
//! Gets the size area of the text in the edit box
//! \return Returns the size in pixels of the text
@ -83,10 +83,10 @@ namespace gui
//! Sets the maximum amount of characters which may be entered in the box.
//! \param max: Maximum amount of characters. If 0, the character amount is
//! infinity.
virtual void setMax(s32 max);
virtual void setMax(u32 max);
//! Returns maximum amount of characters, previously set by setMax();
virtual s32 getMax();
virtual u32 getMax() const;
//! Sets whether the edit box is a password box. Setting this to true will
/** disable MultiLine, WordWrap and the ability to copy with ctrl+c or ctrl+x
@ -95,7 +95,7 @@ namespace gui
virtual void setPasswordBox(bool passwordBox, wchar_t passwordChar = L'*');
//! Returns true if the edit box is currently a password box.
virtual bool isPasswordBox();
virtual bool isPasswordBox() const;
//! Updates the absolute position, splits text if required
virtual void updateAbsolutePosition();
@ -135,7 +135,7 @@ namespace gui
u32 BlinkStartTime;
s32 CursorPos;
s32 HScrollPos, VScrollPos; // scroll position in characters
s32 Max;
u32 Max;
bool WordWrap, MultiLine, AutoScroll, PasswordBox;
wchar_t PasswordChar;
@ -145,11 +145,12 @@ namespace gui
core::array< s32 > BrokenTextPositions;
core::rect<s32> CurrentTextRect, frameRect; // temporary values
};
} // end namespace gui
} // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_
#endif // __C_GUI_EDIT_BOX_H_INCLUDED__

View File

@ -145,7 +145,6 @@ CGUIEnvironment::~CGUIEnvironment()
// remove all factories
for (i=0; i<GUIElementFactoryList.size(); ++i)
GUIElementFactoryList[i]->drop();
}
@ -172,7 +171,6 @@ void CGUIEnvironment::loadBuiltInFont()
}
//! draws all gui elements
void CGUIEnvironment::drawAll()
{
@ -276,8 +274,9 @@ bool CGUIEnvironment::setFocus(IGUIElement* element)
return true;
}
//! returns the element with the focus
IGUIElement* CGUIEnvironment::getFocus()
IGUIElement* CGUIEnvironment::getFocus() const
{
return Focus;
}
@ -311,28 +310,27 @@ bool CGUIEnvironment::removeFocus(IGUIElement* element)
//! Returns if the element has focus
bool CGUIEnvironment::hasFocus(IGUIElement* element)
bool CGUIEnvironment::hasFocus(IGUIElement* element) const
{
bool ret = (element == Focus);
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return ret;
return (element == Focus);
}
//! returns the current video driver
video::IVideoDriver* CGUIEnvironment::getVideoDriver()
video::IVideoDriver* CGUIEnvironment::getVideoDriver() const
{
return Driver;
}
//! returns the current file system
io::IFileSystem* CGUIEnvironment::getFileSystem()
io::IFileSystem* CGUIEnvironment::getFileSystem() const
{
return FileSystem;
}
//! returns the current file system
IOSOperator* CGUIEnvironment::getOSOperator()
IOSOperator* CGUIEnvironment::getOSOperator() const
{
return Operator;
}
@ -340,7 +338,6 @@ IOSOperator* CGUIEnvironment::getOSOperator()
//! clear all GUI elements
void CGUIEnvironment::clear()
{
// Remove the focus
if (Focus)
{
@ -371,8 +368,8 @@ bool CGUIEnvironment::OnEvent(SEvent event)
return false;
}
/*
*/
//
void CGUIEnvironment::OnPostRender( u32 time )
{
// check tooltip
@ -417,8 +414,8 @@ void CGUIEnvironment::OnPostRender( u32 time )
IGUIElement::OnPostRender ( time );
}
/*
*/
//
void CGUIEnvironment::updateHoveredElement(core::position2d<s32> mousePos)
{
IGUIElement* lastHovered = Hovered;
@ -538,7 +535,6 @@ bool CGUIEnvironment::postEventFromUser(SEvent event)
}
//! returns the current gui skin
IGUISkin* CGUIEnvironment::getSkin() const
{
@ -558,6 +554,7 @@ void CGUIEnvironment::setSkin(IGUISkin* skin)
CurrentSkin->grab();
}
//! Creates a new GUI Skin based on a template.
/** \return Returns a pointer to the created skin.
If you no longer need the skin, you should call IGUISkin::drop().
@ -584,11 +581,12 @@ IGUISkin* CGUIEnvironment::createSkin(EGUI_SKIN_TYPE type)
//! Returns the default element factory which can create all built in elements
IGUIElementFactory* CGUIEnvironment::getDefaultGUIElementFactory()
IGUIElementFactory* CGUIEnvironment::getDefaultGUIElementFactory() const
{
return getGUIElementFactory(0);
}
//! Adds an element factory to the gui environment.
/** Use this to extend the gui environment with new element types which it should be
able to create automaticly, for example when loading data from xml files. */
@ -601,21 +599,24 @@ void CGUIEnvironment::registerGUIElementFactory(IGUIElementFactory* factoryToAdd
}
}
//! Returns amount of registered scene node factories.
s32 CGUIEnvironment::getRegisteredGUIElementFactoryCount()
u32 CGUIEnvironment::getRegisteredGUIElementFactoryCount() const
{
return GUIElementFactoryList.size();
}
//! Returns a scene node factory by index
IGUIElementFactory* CGUIEnvironment::getGUIElementFactory(s32 index)
{
if (index>=0 && index<(int)GUIElementFactoryList.size())
return GUIElementFactoryList[index];
return 0;
//! Returns a scene node factory by index
IGUIElementFactory* CGUIEnvironment::getGUIElementFactory(u32 index) const
{
if (index < GUIElementFactoryList.size())
return GUIElementFactoryList[index];
else
return 0;
}
//! adds a GUI Element using its name
IGUIElement* CGUIEnvironment::addGUIElement(const c8* elementName, IGUIElement* parent)
{
@ -624,7 +625,7 @@ IGUIElement* CGUIEnvironment::addGUIElement(const c8* elementName, IGUIElement*
if (!parent)
parent = this;
for (s32 i=0; i<(int)GUIElementFactoryList.size() && !node; ++i)
for (u32 i=0; i<GUIElementFactoryList.size() && !node; ++i)
node = GUIElementFactoryList[i]->addGUIElement(elementName, parent);
return node;
@ -684,7 +685,6 @@ bool CGUIEnvironment::loadGUI(const c8* filename, IGUIElement* parent)
//! Loads the gui. Note that the current gui is not cleared before.
bool CGUIEnvironment::loadGUI(io::IReadFile* file, IGUIElement* parent)
{
if (!file)
{
os::Printer::log("Unable to open GUI file", ELL_ERROR);
@ -708,11 +708,9 @@ bool CGUIEnvironment::loadGUI(io::IReadFile* file, IGUIElement* parent)
reader->drop();
return true;
}
//! reads an element
void CGUIEnvironment::readGUIElement(io::IXMLReader* reader, IGUIElement* parent)
{
@ -791,7 +789,6 @@ void CGUIEnvironment::readGUIElement(io::IXMLReader* reader, IGUIElement* parent
}
//! writes an element
void CGUIEnvironment::writeGUIElement(io::IXMLWriter* writer, IGUIElement* node)
{
@ -846,7 +843,6 @@ void CGUIEnvironment::writeGUIElement(io::IXMLWriter* writer, IGUIElement* node)
}
attr->drop();
}
@ -862,10 +858,10 @@ void CGUIEnvironment::serializeAttributes(io::IAttributes* out, io::SAttributeRe
}
}
//! Reads attributes of the environment
void CGUIEnvironment::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
if (in->existsAttribute("Skin"))
{
IGUISkin *skin = getSkin();
@ -890,13 +886,10 @@ void CGUIEnvironment::deserializeAttributes(io::IAttributes* in, io::SAttributeR
RelativeRect = AbsoluteRect =
core::rect<s32>(core::position2d<s32>(0,0),
Driver ? Driver->getScreenSize() : core::dimension2d<s32>(0,0));
}
//! adds an button. The returned pointer must not be dropped.
//! adds a button. The returned pointer must not be dropped.
IGUIButton* CGUIEnvironment::addButton(const core::rect<s32>& rectangle, IGUIElement* parent, s32 id, const wchar_t* text, const wchar_t *tooltiptext)
{
IGUIButton* button = new CGUIButton(this, parent ? parent : this, id, rectangle);
@ -930,6 +923,8 @@ IGUIWindow* CGUIEnvironment::addWindow(const core::rect<s32>& rectangle, bool mo
return win;
}
//! adds a modal screen. The returned pointer must not be dropped.
IGUIElement* CGUIEnvironment::addModalScreen(IGUIElement* parent)
{
@ -941,6 +936,7 @@ IGUIElement* CGUIEnvironment::addModalScreen(IGUIElement* parent)
return win;
}
//! Adds a message box.
IGUIWindow* CGUIEnvironment::addMessageBox(const wchar_t* caption, const wchar_t* text,
bool modal, s32 flag, IGUIElement* parent, s32 id)
@ -1053,11 +1049,10 @@ IGUICheckBox* CGUIEnvironment::addCheckBox(bool checked, const core::rect<s32>&
}
//! adds a list box
IGUIListBox* CGUIEnvironment::addListBox(const core::rect<s32>& rectangle,
IGUIElement* parent, s32 id,
bool drawBackground)
IGUIElement* parent, s32 id,
bool drawBackground)
{
IGUIListBox* b = new CGUIListBox(this, parent ? parent : this, id, rectangle,
true, drawBackground, false);
@ -1076,11 +1071,10 @@ IGUIListBox* CGUIEnvironment::addListBox(const core::rect<s32>& rectangle,
}
//! adds a file open dialog. The returned pointer must not be dropped.
IGUIFileOpenDialog* CGUIEnvironment::addFileOpenDialog(const wchar_t* title,
bool modal,
IGUIElement* parent, s32 id)
bool modal,
IGUIElement* parent, s32 id)
{
parent = parent ? parent : this;
@ -1099,8 +1093,8 @@ IGUIFileOpenDialog* CGUIEnvironment::addFileOpenDialog(const wchar_t* title,
//! adds a color select dialog. The returned pointer must not be dropped.
IGUIColorSelectDialog* CGUIEnvironment::addColorSelectDialog(const wchar_t* title,
bool modal,
IGUIElement* parent, s32 id)
bool modal,
IGUIElement* parent, s32 id)
{
parent = parent ? parent : this;
@ -1118,14 +1112,12 @@ IGUIColorSelectDialog* CGUIEnvironment::addColorSelectDialog(const wchar_t* titl
}
//! adds a static text. The returned pointer must not be dropped.
IGUIStaticText* CGUIEnvironment::addStaticText(const wchar_t* text,
const core::rect<s32>& rectangle,
bool border,
bool wordWrap,
IGUIElement* parent, s32 id,
bool background)
const core::rect<s32>& rectangle,
bool border, bool wordWrap,
IGUIElement* parent, s32 id,
bool background)
{
IGUIStaticText* d = new CGUIStaticText(text, border, this,
parent ? parent : this, id, rectangle, background);
@ -1137,12 +1129,11 @@ IGUIStaticText* CGUIEnvironment::addStaticText(const wchar_t* text,
}
//! Adds an edit box. The returned pointer must not be dropped.
IGUIEditBox* CGUIEnvironment::addEditBox(const wchar_t* text,
const core::rect<s32>& rectangle,
bool border, IGUIElement* parent,
s32 id)
const core::rect<s32>& rectangle,
bool border, IGUIElement* parent,
s32 id)
{
IGUIEditBox* d = new CGUIEditBox(text, border, this,
parent ? parent : this, id, rectangle);
@ -1151,10 +1142,11 @@ IGUIEditBox* CGUIEnvironment::addEditBox(const wchar_t* text,
return d;
}
//! Adds a spin box to the environment
IGUISpinBox* CGUIEnvironment::addSpinBox(const wchar_t* text,
const core::rect<s32> &rectangle,
IGUIElement* parent, s32 id)
const core::rect<s32> &rectangle,
IGUIElement* parent, s32 id)
{
IGUISpinBox* d = new CGUISpinBox(text, this, parent ? parent : this, id, rectangle);
@ -1211,6 +1203,7 @@ IGUIContextMenu* CGUIEnvironment::addMenu(IGUIElement* parent, s32 id)
return c;
}
//! Adds a toolbar to the environment. It is like a menu is always placed on top
//! in its parent, and contains buttons.
IGUIToolBar* CGUIEnvironment::addToolBar(IGUIElement* parent, s32 id)
@ -1224,7 +1217,6 @@ IGUIToolBar* CGUIEnvironment::addToolBar(IGUIElement* parent, s32 id)
}
//! Adds an element for fading in or out.
IGUIInOutFader* CGUIEnvironment::addInOutFader(const core::rect<s32>* rectangle, IGUIElement* parent, s32 id)
{
@ -1253,11 +1245,9 @@ IGUIComboBox* CGUIEnvironment::addComboBox(const core::rect<s32>& rectangle,
id, rectangle);
t->drop();
return t;
}
//! returns the font
IGUIFont* CGUIEnvironment::getFont(const c8* filename)
{
@ -1365,6 +1355,7 @@ IGUIFont* CGUIEnvironment::getFont(const c8* filename)
return ifont;
}
IGUISpriteBank* CGUIEnvironment::getSpriteBank(const c8* filename)
{
// search for the file name
@ -1392,9 +1383,9 @@ IGUISpriteBank* CGUIEnvironment::getSpriteBank(const c8* filename)
// todo: load it!
return 0;
}
IGUISpriteBank* CGUIEnvironment::addEmptySpriteBank(const c8 *name)
{
// no duplicate names allowed
@ -1417,11 +1408,11 @@ IGUISpriteBank* CGUIEnvironment::addEmptySpriteBank(const c8 *name)
Banks.push_back(b);
return b.Bank;
}
//! returns default font
IGUIFont* CGUIEnvironment::getBuiltInFont()
IGUIFont* CGUIEnvironment::getBuiltInFont() const
{
if (Fonts.empty())
return 0;
@ -1437,6 +1428,7 @@ IGUIElement* CGUIEnvironment::getRootGUIElement()
return this;
}
//! Returns the next element in the tab group starting at the focused element
IGUIElement* CGUIEnvironment::getNextElement(bool reverse, bool group)
{
@ -1475,23 +1467,21 @@ IGUIElement* CGUIEnvironment::getNextElement(bool reverse, bool group)
IGUIElement *first = 0;
startPos->getNextElement(startOrder, reverse, group, first, closest);
IGUIElement *ret = 0;
if (closest)
ret = closest; // we found an element
return closest; // we found an element
else if (first)
ret = first; // go to the end or the start
return first; // go to the end or the start
else if (group)
ret = this; // no group found? root group
return ret;
return this; // no group found? root group
else
return 0;
}
//! creates an GUI Environment
IGUIEnvironment* createGUIEnvironment(io::IFileSystem* fs, video::IVideoDriver* Driver,
IOSOperator* op)
IGUIEnvironment* createGUIEnvironment(io::IFileSystem* fs,
video::IVideoDriver* Driver,
IOSOperator* op)
{
return new CGUIEnvironment(fs, Driver, op);
}
@ -1501,3 +1491,4 @@ IGUIEnvironment* createGUIEnvironment(io::IFileSystem* fs, video::IVideoDriver*
} // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_

View File

@ -37,13 +37,13 @@ public:
virtual void drawAll();
//! returns the current video driver
virtual video::IVideoDriver* getVideoDriver();
virtual video::IVideoDriver* getVideoDriver() const;
//! returns pointer to the filesystem
virtual io::IFileSystem* getFileSystem();
virtual io::IFileSystem* getFileSystem() const;
//! returns a pointer to the OS operator
virtual IOSOperator* getOSOperator();
virtual IOSOperator* getOSOperator() const;
//! posts an input event to the environment
virtual bool postEventFromUser(SEvent event);
@ -116,6 +116,8 @@ public:
//! Adds a file open dialog.
virtual IGUIFileOpenDialog* addFileOpenDialog(const wchar_t* title = 0, bool modal=true, IGUIElement* parent=0, s32 id=-1);
//! Adds a color select dialog.
virtual IGUIColorSelectDialog* addColorSelectDialog(const wchar_t* title = 0, bool modal=true, IGUIElement* parent=0, s32 id=-1);
//! adds a static text. The returned pointer must not be dropped.
@ -160,13 +162,13 @@ public:
virtual bool removeFocus(IGUIElement* element);
//! Returns if the element has focus
virtual bool hasFocus(IGUIElement* element);
virtual bool hasFocus(IGUIElement* element) const;
//! Returns the element with the focus
virtual IGUIElement* getFocus();
virtual IGUIElement* getFocus() const;
//! returns default font
virtual IGUIFont* getBuiltInFont();
virtual IGUIFont* getBuiltInFont() const;
//! Adds an element for fading in or out.
virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1);
@ -177,7 +179,7 @@ public:
virtual void OnPostRender( u32 time );
//! Returns the default element factory which can create all built in elements
virtual IGUIElementFactory* getDefaultGUIElementFactory();
virtual IGUIElementFactory* getDefaultGUIElementFactory() const;
//! Adds an element factory to the gui environment.
/** Use this to extend the gui environment with new element types which it should be
@ -185,10 +187,10 @@ public:
virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd);
//! Returns amount of registered scene node factories.
virtual s32 getRegisteredGUIElementFactoryCount();
virtual u32 getRegisteredGUIElementFactoryCount() const;
//! Returns a scene node factory by index
virtual IGUIElementFactory* getGUIElementFactory(s32 index);
virtual IGUIElementFactory* getGUIElementFactory(u32 index) const;
//! Adds a GUI Element by its name
virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0);
@ -234,6 +236,10 @@ private:
IGUIElement* getNextElement(bool reverse=false, bool group=false);
void updateHoveredElement(core::position2d<s32> mousePos);
void loadBuiltInFont();
struct SFont
{
core::stringc Filename;
@ -262,10 +268,8 @@ private:
u32 LaunchTime;
IGUIStaticText* Element;
};
SToolTip ToolTip;
void updateHoveredElement(core::position2d<s32> mousePos);
void loadBuiltInFont();
SToolTip ToolTip;
core::array<IGUIElementFactory*> GUIElementFactoryList;

View File

@ -127,7 +127,7 @@ CGUIFileOpenDialog::~CGUIFileOpenDialog()
//! returns the filename of the selected file. Returns NULL, if no file was selected.
const wchar_t* CGUIFileOpenDialog::getFilename()
const wchar_t* CGUIFileOpenDialog::getFileName() const
{
return FileName.c_str();
}

View File

@ -29,7 +29,7 @@ namespace gui
virtual ~CGUIFileOpenDialog();
//! returns the filename of the selected file. Returns NULL, if no file was selected.
virtual const wchar_t* getFilename();
virtual const wchar_t* getFileName() const;
//! called if an event happened.
virtual bool OnEvent(SEvent event);
@ -69,3 +69,4 @@ namespace gui
#endif // _IRR_COMPILE_WITH_GUI_
#endif // __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__

View File

@ -40,7 +40,6 @@ CGUIFont::CGUIFont(IGUIEnvironment *env, const c8* filename)
}
//! destructor
CGUIFont::~CGUIFont()
{
@ -52,6 +51,7 @@ CGUIFont::~CGUIFont()
}
//! loads a font file from xml
bool CGUIFont::load(io::IXMLReader* xml)
{
@ -175,7 +175,6 @@ bool CGUIFont::load(io::IXMLReader* xml)
Areas.push_back(a);
}
}
}
// set bad character
@ -186,6 +185,7 @@ bool CGUIFont::load(io::IXMLReader* xml)
return true;
}
void CGUIFont::setMaxHeight()
{
MaxHeight = 0;
@ -213,6 +213,7 @@ bool CGUIFont::load(io::IReadFile* file)
file->getFileName());
}
//! loads a font file, native file needed, for texture parsing
bool CGUIFont::load(const c8* filename)
{
@ -222,6 +223,7 @@ bool CGUIFont::load(const c8* filename)
filename);
}
//! load & prepare font from ITexture
bool CGUIFont::loadTexture(video::IImage* image, const c8* name)
{
@ -274,7 +276,6 @@ bool CGUIFont::loadTexture(video::IImage* image, const c8* name)
}
void CGUIFont::readPositions32bit(video::IImage* image, s32& lowerRightPositions)
{
const core::dimension2d<s32>& size = image->getDimension();
@ -356,8 +357,6 @@ void CGUIFont::readPositions32bit(video::IImage* image, s32& lowerRightPositions
}
void CGUIFont::readPositions16bit(video::IImage* image, s32& lowerRightPositions)
{
core::dimension2d<s32> size = image->getDimension();
@ -439,7 +438,7 @@ void CGUIFont::readPositions16bit(video::IImage* image, s32& lowerRightPositions
//! returns the dimension of text
core::dimension2d<s32> CGUIFont::getDimension(const wchar_t* text)
core::dimension2d<s32> CGUIFont::getDimension(const wchar_t* text) const
{
core::dimension2d<s32> dim(0, 0);
core::dimension2d<s32> thisLine(0, MaxHeight);
@ -466,11 +465,10 @@ core::dimension2d<s32> CGUIFont::getDimension(const wchar_t* text)
continue;
}
SFontArea &area = Areas[getAreaFromCharacter(*p)];
const SFontArea &area = Areas[getAreaFromCharacter(*p)];
thisLine.Width += area.underhang;
thisLine.Width += area.width + area.overhang + GlobalKerningWidth;
}
dim.Height += thisLine.Height;
@ -480,14 +478,16 @@ core::dimension2d<s32> CGUIFont::getDimension(const wchar_t* text)
return dim;
}
//! set an Pixel Offset on Drawing ( scale position on width )
void CGUIFont::setKerningWidth ( s32 kerning )
{
GlobalKerningWidth = kerning;
}
//! set an Pixel Offset on Drawing ( scale position on width )
s32 CGUIFont::getKerningWidth(const wchar_t* thisLetter, const wchar_t* previousLetter)
s32 CGUIFont::getKerningWidth(const wchar_t* thisLetter, const wchar_t* previousLetter) const
{
s32 ret = GlobalKerningWidth;
@ -504,26 +504,29 @@ s32 CGUIFont::getKerningWidth(const wchar_t* thisLetter, const wchar_t* previous
return ret;
}
//! set an Pixel Offset on Drawing ( scale position on height )
void CGUIFont::setKerningHeight ( s32 kerning )
{
GlobalKerningHeight = kerning;
}
//! set an Pixel Offset on Drawing ( scale position on height )
s32 CGUIFont::getKerningHeight ()
s32 CGUIFont::getKerningHeight () const
{
return GlobalKerningHeight;
}
//! returns the sprite number from a given character
u32 CGUIFont::getSpriteNoFromChar(const wchar_t *c)
u32 CGUIFont::getSpriteNoFromChar(const wchar_t *c) const
{
return Areas[getAreaFromCharacter(*c)].spriteno;
}
s32 CGUIFont::getAreaFromCharacter(const wchar_t c)
s32 CGUIFont::getAreaFromCharacter(const wchar_t c) const
{
core::map<wchar_t, s32>::Node* n = CharacterMap.find(c);
if (n)
@ -532,6 +535,7 @@ s32 CGUIFont::getAreaFromCharacter(const wchar_t c)
return WrongCharacter;
}
/*
//! draws an text and clips it to the specified rectangle if wanted
void CGUIFont::draw(const wchar_t* text, const core::rect<s32>& position, video::SColor color, bool hcenter, bool vcenter, const core::rect<s32>* clip)
@ -610,15 +614,16 @@ void CGUIFont::draw(const wchar_t* text, const core::rect<s32>& position, video:
}
}
//! Calculates the index of the character in the text which is on a specific position.
s32 CGUIFont::getCharacterFromPos(const wchar_t* text, s32 pixel_x)
s32 CGUIFont::getCharacterFromPos(const wchar_t* text, s32 pixel_x) const
{
s32 x = 0;
s32 idx = 0;
while (text[idx])
{
SFontArea &a = Areas[getAreaFromCharacter(text[idx])];
const SFontArea& a = Areas[getAreaFromCharacter(text[idx])];
x += a.width + a.overhang + a.underhang;
@ -631,7 +636,8 @@ s32 CGUIFont::getCharacterFromPos(const wchar_t* text, s32 pixel_x)
return -1;
}
IGUISpriteBank* CGUIFont::getSpriteBank()
IGUISpriteBank* CGUIFont::getSpriteBank() const
{
return SpriteBank;
}

View File

@ -52,10 +52,10 @@ public:
virtual void draw(const wchar_t* text, const core::rect<s32>& position, video::SColor color, bool hcenter=false, bool vcenter=false, const core::rect<s32>* clip=0);
//! returns the dimension of a text
virtual core::dimension2d<s32> getDimension(const wchar_t* text);
virtual core::dimension2d<s32> getDimension(const wchar_t* text) const;
//! Calculates the index of the character in the text which is on a specific position.
virtual s32 getCharacterFromPos(const wchar_t* text, s32 pixel_x);
virtual s32 getCharacterFromPos(const wchar_t* text, s32 pixel_x) const;
//! Returns the type of this font
virtual EGUI_FONT_TYPE getType() const { return EGFT_BITMAP; }
@ -65,14 +65,14 @@ public:
virtual void setKerningHeight (s32 kerning);
//! set an Pixel Offset on Drawing ( scale position on width )
virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0);
virtual s32 getKerningHeight();
virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const;
virtual s32 getKerningHeight() const;
//! gets the sprite bank
virtual IGUISpriteBank* getSpriteBank();
virtual IGUISpriteBank* getSpriteBank() const;
//! returns the sprite number from a given character
virtual u32 getSpriteNoFromChar(const wchar_t *c);
virtual u32 getSpriteNoFromChar(const wchar_t *c) const;
private:
@ -91,7 +91,7 @@ private:
void readPositions16bit(video::IImage* texture, s32& lowerRightPositions);
void readPositions32bit(video::IImage* texture, s32& lowerRightPositions);
s32 getAreaFromCharacter (const wchar_t c);
s32 getAreaFromCharacter (const wchar_t c) const;
void setMaxHeight();
core::array<SFontArea> Areas;

View File

@ -73,16 +73,16 @@ CGUIListBox::~CGUIListBox()
//! returns amount of list items
s32 CGUIListBox::getItemCount()
u32 CGUIListBox::getItemCount() const
{
return Items.size();
}
//! returns string of a list item. the may be a value from 0 to itemCount-1
const wchar_t* CGUIListBox::getListItem(s32 id)
const wchar_t* CGUIListBox::getListItem(u32 id) const
{
if ((u32)id>=Items.size())
if (id>=Items.size())
return 0;
return Items[id].text.c_str();
@ -90,9 +90,9 @@ const wchar_t* CGUIListBox::getListItem(s32 id)
//! Returns the icon of an item
s32 CGUIListBox::getIcon(s32 id) const
s32 CGUIListBox::getIcon(u32 id) const
{
if ((u32)id>=Items.size())
if (id>=Items.size())
return -1;
return Items[id].icon;
@ -100,23 +100,23 @@ s32 CGUIListBox::getIcon(s32 id) const
//! adds a list item, returns id of item
s32 CGUIListBox::addItem(const wchar_t* text)
u32 CGUIListBox::addItem(const wchar_t* text)
{
return addItem(text, -1);
}
//! adds a list item, returns id of item
void CGUIListBox::removeItem(s32 id)
void CGUIListBox::removeItem(u32 id)
{
if ((u32)id >= Items.size())
if (id >= Items.size())
return;
if (Selected==id)
if ((u32)Selected==id)
{
Selected = -1;
}
else if (Selected > id)
else if ((u32)Selected > id)
{
Selected -= 1;
selectTime = os::Timer::getTime();
@ -172,7 +172,7 @@ void CGUIListBox::recalculateItemHeight()
//! returns id of selected item. returns -1 if no item is selected.
s32 CGUIListBox::getSelected()
s32 CGUIListBox::getSelected() const
{
return Selected;
}
@ -552,7 +552,7 @@ void CGUIListBox::draw()
//! adds an list item with an icon
s32 CGUIListBox::addItem(const wchar_t* text, s32 icon)
u32 CGUIListBox::addItem(const wchar_t* text, s32 icon)
{
ListItem i;
i.text = text;
@ -602,7 +602,7 @@ void CGUIListBox::setAutoScrollEnabled(bool scroll)
}
bool CGUIListBox::isAutoScrollEnabled()
bool CGUIListBox::isAutoScrollEnabled() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return AutoScroll;
@ -730,9 +730,9 @@ void CGUIListBox::recalculateItemWidth(s32 icon)
}
void CGUIListBox::setItem(s32 index, const wchar_t* text, s32 icon)
void CGUIListBox::setItem(u32 index, const wchar_t* text, s32 icon)
{
if ( (u32)index >= Items.size() )
if ( index >= Items.size() )
return;
Items[index].text = text;
@ -745,10 +745,8 @@ void CGUIListBox::setItem(s32 index, const wchar_t* text, s32 icon)
//! Insert the item at the given index
//! Return the index on success or -1 on failure.
s32 CGUIListBox::insertItem(s32 index, const wchar_t* text, s32 icon)
s32 CGUIListBox::insertItem(u32 index, const wchar_t* text, s32 icon)
{
if ( index < 0 )
return -1;
ListItem i;
i.text = text;
i.icon = icon;
@ -761,9 +759,9 @@ s32 CGUIListBox::insertItem(s32 index, const wchar_t* text, s32 icon)
}
void CGUIListBox::swapItems(s32 index1, s32 index2)
void CGUIListBox::swapItems(u32 index1, u32 index2)
{
if ( (u32)index1 >= Items.size() || (u32)index2 >= Items.size() )
if ( index1 >= Items.size() || index2 >= Items.size() )
return;
ListItem dummmy = Items[index1];
@ -772,7 +770,7 @@ void CGUIListBox::swapItems(s32 index1, s32 index2)
}
void CGUIListBox::setItemOverrideColor(s32 index, const video::SColor &color)
void CGUIListBox::setItemOverrideColor(u32 index, const video::SColor &color)
{
for ( u32 c=0; c < EGUI_LBC_COUNT; ++c )
{
@ -782,9 +780,9 @@ void CGUIListBox::setItemOverrideColor(s32 index, const video::SColor &color)
}
void CGUIListBox::setItemOverrideColor(s32 index, EGUI_LISTBOX_COLOR colorType, const video::SColor &color)
void CGUIListBox::setItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType, const video::SColor &color)
{
if ( (u32)index >= Items.size() || colorType < 0 || colorType >= EGUI_LBC_COUNT )
if ( index >= Items.size() || colorType < 0 || colorType >= EGUI_LBC_COUNT )
return;
Items[index].OverrideColors[colorType].Use = true;
@ -792,7 +790,7 @@ void CGUIListBox::setItemOverrideColor(s32 index, EGUI_LISTBOX_COLOR colorType,
}
void CGUIListBox::clearItemOverrideColor(s32 index)
void CGUIListBox::clearItemOverrideColor(u32 index)
{
for (u32 c=0; c < (u32)EGUI_LBC_COUNT; ++c )
{
@ -801,25 +799,25 @@ void CGUIListBox::clearItemOverrideColor(s32 index)
}
void CGUIListBox::clearItemOverrideColor(s32 index, EGUI_LISTBOX_COLOR colorType)
void CGUIListBox::clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType)
{
if ( (u32)index >= Items.size() || colorType < 0 || colorType >= EGUI_LBC_COUNT )
if ( index >= Items.size() || colorType < 0 || colorType >= EGUI_LBC_COUNT )
return;
Items[index].OverrideColors[colorType].Use = false;
}
bool CGUIListBox::hasItemOverrideColor(s32 index, EGUI_LISTBOX_COLOR colorType)
bool CGUIListBox::hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const
{
if ( (u32)index >= Items.size() || colorType < 0 || colorType >= EGUI_LBC_COUNT )
if ( index >= Items.size() || colorType < 0 || colorType >= EGUI_LBC_COUNT )
return false;
return Items[index].OverrideColors[colorType].Use;
}
video::SColor CGUIListBox::getItemOverrideColor(s32 index, EGUI_LISTBOX_COLOR colorType)
video::SColor CGUIListBox::getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const
{
if ( (u32)index >= Items.size() || colorType < 0 || colorType >= EGUI_LBC_COUNT )
return video::SColor();
@ -828,7 +826,7 @@ video::SColor CGUIListBox::getItemOverrideColor(s32 index, EGUI_LISTBOX_COLOR co
}
video::SColor CGUIListBox::getItemDefaultColor(EGUI_LISTBOX_COLOR colorType)
video::SColor CGUIListBox::getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const
{
IGUISkin* skin = Environment->getSkin();
if ( !skin )

View File

@ -31,19 +31,19 @@ namespace gui
~CGUIListBox();
//! returns amount of list items
virtual s32 getItemCount();
virtual u32 getItemCount() const;
//! returns string of a list item. the id may be a value from 0 to itemCount-1
virtual const wchar_t* getListItem(s32 id);
virtual const wchar_t* getListItem(u32 id) const;
//! adds an list item, returns id of item
virtual s32 addItem(const wchar_t* text);
virtual u32 addItem(const wchar_t* text);
//! clears the list
virtual void clear();
//! returns id of selected item. returns -1 if no item is selected.
virtual s32 getSelected();
virtual s32 getSelected() const;
//! sets the selected item. Set this to -1 if no item should be selected
virtual void setSelected(s32 id);
@ -59,13 +59,13 @@ namespace gui
//! \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon
//! \return
//! returns the id of the new created item
virtual s32 addItem(const wchar_t* text, s32 icon);
virtual u32 addItem(const wchar_t* text, s32 icon);
//! Returns the icon of an item
virtual s32 getIcon(s32 id) const;
virtual s32 getIcon(u32 id) const;
//! removes an item from the list
virtual void removeItem(s32 id);
virtual void removeItem(u32 id);
//! Sets the sprite bank which should be used to draw list icons. This font is set to the sprite bank of
//! the built-in-font by default. A sprite can be displayed in front of every list item.
@ -77,7 +77,7 @@ namespace gui
virtual void setAutoScrollEnabled(bool scroll);
//! returns true if automatic scrolling is enabled, false if not.
virtual bool isAutoScrollEnabled();
virtual bool isAutoScrollEnabled() const;
//! Update the position and size of the listbox, and update the scrollbar
virtual void updateAbsolutePosition();
@ -89,35 +89,35 @@ namespace gui
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
//! set all item colors at given index to color
virtual void setItemOverrideColor(s32 index, const video::SColor &color);
virtual void setItemOverrideColor(u32 index, const video::SColor &color);
//! set all item colors of specified type at given index to color
virtual void setItemOverrideColor(s32 index, EGUI_LISTBOX_COLOR colorType, const video::SColor &color);
virtual void setItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType, const video::SColor &color);
//! clear all item colors at index
virtual void clearItemOverrideColor(s32 index);
virtual void clearItemOverrideColor(u32 index);
//! clear item color at index for given colortype
virtual void clearItemOverrideColor(s32 index, EGUI_LISTBOX_COLOR colorType);
virtual void clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType);
//! has the item at index it's color overwritten?
virtual bool hasItemOverrideColor(s32 index, EGUI_LISTBOX_COLOR colorType);
virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const;
//! return the overwrite color at given item index.
virtual video::SColor getItemOverrideColor(s32 index, EGUI_LISTBOX_COLOR colorType);
virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const;
//! return the default color which is used for the given colorType
virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType);
virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const;
//! set the item at the given index
virtual void setItem(s32 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
//! Return the index on success or -1 on failure.
virtual s32 insertItem(s32 index, const wchar_t* text, s32 icon);
virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon);
//! Swap the items at the given indices
virtual void swapItems(s32 index1, s32 index2);
virtual void swapItems(u32 index1, u32 index2);
private:

View File

@ -30,7 +30,6 @@ CGUIMeshViewer::CGUIMeshViewer(IGUIEnvironment* environment, IGUIElement* parent
}
//! destructor
CGUIMeshViewer::~CGUIMeshViewer()
{
@ -39,7 +38,6 @@ CGUIMeshViewer::~CGUIMeshViewer()
}
//! sets the mesh to be shown
void CGUIMeshViewer::setMesh(scene::IAnimatedMesh* mesh)
{
@ -63,12 +61,14 @@ void CGUIMeshViewer::setMesh(scene::IAnimatedMesh* mesh)
Mesh->grab();
}
//! Gets the displayed mesh
scene::IAnimatedMesh* CGUIMeshViewer::getMesh() const
{
return Mesh;
}
//! sets the material
void CGUIMeshViewer::setMaterial(const video::SMaterial& material)
{
@ -76,15 +76,13 @@ void CGUIMeshViewer::setMaterial(const video::SMaterial& material)
}
//! gets the material
const video::SMaterial& CGUIMeshViewer::getMaterial()
const video::SMaterial& CGUIMeshViewer::getMaterial() const
{
return Material;
}
//! called if an event happened.
bool CGUIMeshViewer::OnEvent(SEvent event)
{
@ -92,7 +90,6 @@ bool CGUIMeshViewer::OnEvent(SEvent event)
}
//! draws the element and its children
void CGUIMeshViewer::draw()
{

View File

@ -26,7 +26,7 @@ namespace gui
CGUIMeshViewer(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle);
//! destructor
~CGUIMeshViewer();
virtual ~CGUIMeshViewer();
//! sets the mesh to be shown
virtual void setMesh(scene::IAnimatedMesh* mesh);
@ -38,7 +38,7 @@ namespace gui
virtual void setMaterial(const video::SMaterial& material);
//! gets the material
virtual const video::SMaterial& getMaterial();
virtual const video::SMaterial& getMaterial() const;
//! called if an event happened.
virtual bool OnEvent(SEvent event);
@ -46,7 +46,6 @@ namespace gui
//! draws the element and its children
virtual void draw();
private:
video::SMaterial Material;
@ -60,3 +59,4 @@ namespace gui
#endif // _IRR_COMPILE_WITH_GUI_
#endif // __C_GUI_MESH_VIEWER_H_INCLUDED__

View File

@ -290,7 +290,7 @@ void CGUIScrollBar::setPos(s32 pos)
//! gets the small step value
s32 CGUIScrollBar::getSmallStep()
s32 CGUIScrollBar::getSmallStep() const
{
return SmallStep;
}
@ -308,7 +308,7 @@ void CGUIScrollBar::setSmallStep(s32 step)
//! gets the maximum value of the scrollbar.
s32 CGUIScrollBar::getMax()
s32 CGUIScrollBar::getMax() const
{
return Max;
}
@ -330,7 +330,7 @@ void CGUIScrollBar::setMax(s32 max)
//! gets the current position of the scrollbar
s32 CGUIScrollBar::getPos()
s32 CGUIScrollBar::getPos() const
{
return Pos;
}
@ -416,6 +416,7 @@ void CGUIScrollBar::refreshControls()
}
}
//! Writes attributes of the element.
void CGUIScrollBar::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
@ -427,6 +428,7 @@ void CGUIScrollBar::serializeAttributes(io::IAttributes* out, io::SAttributeRead
out->addInt ("SmallStep", SmallStep);
}
//! Reads attributes of the element
void CGUIScrollBar::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{

View File

@ -35,19 +35,19 @@ namespace gui
virtual void draw();
//! gets the maximum value of the scrollbar.
virtual s32 getMax();
virtual s32 getMax() const;
//! sets the maximum value of the scrollbar.
virtual void setMax(s32 max);
//! gets the small step value
virtual s32 getSmallStep();
virtual s32 getSmallStep() const;
//! sets the small step value
virtual void setSmallStep(s32 step);
//! gets the current position of the scrollbar
virtual s32 getPos();
virtual s32 getPos() const;
//! sets the position of the scrollbar
virtual void setPos(s32 pos);
@ -61,7 +61,6 @@ namespace gui
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
private:
void refreshControls();

View File

@ -65,13 +65,14 @@ CGUISpinBox::CGUISpinBox(const wchar_t* text, IGUIEnvironment* environment,
ButtonSpinUp->setText(L"+");
}
core::rect<s32> rectEdit(0, 0, rectangle.getWidth() - ButtonWidth - 1, rectangle.getHeight());
const core::rect<s32> rectEdit(0, 0, rectangle.getWidth() - ButtonWidth - 1, rectangle.getHeight());
EditBox = Environment->addEditBox(text, rectEdit, true, this, -1);
EditBox->grab();
EditBox->setSubElement(true);
EditBox->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
}
//! destructor
CGUISpinBox::~CGUISpinBox()
{
@ -83,11 +84,13 @@ CGUISpinBox::~CGUISpinBox()
EditBox->drop();
}
IGUIEditBox* CGUISpinBox::getEditBox()
IGUIEditBox* CGUISpinBox::getEditBox() const
{
return EditBox;
}
void CGUISpinBox::setValue(f32 val)
{
wchar_t str[100];
@ -97,7 +100,8 @@ void CGUISpinBox::setValue(f32 val)
verifyValueRange();
}
f32 CGUISpinBox::getValue()
f32 CGUISpinBox::getValue() const
{
const wchar_t* val = EditBox->getText();
if ( !val )
@ -106,6 +110,7 @@ f32 CGUISpinBox::getValue()
return core::fast_atof(tmp.c_str());
}
void CGUISpinBox::setRange(f32 min, f32 max)
{
RangeMin = min;
@ -113,26 +118,31 @@ void CGUISpinBox::setRange(f32 min, f32 max)
verifyValueRange();
}
f32 CGUISpinBox::getMin() const
{
return RangeMin;
}
f32 CGUISpinBox::getMax() const
{
return RangeMax;
}
f32 CGUISpinBox::getStepSize() const
{
return StepSize;
}
void CGUISpinBox::setStepSize(f32 step)
{
StepSize = step;
}
//! Sets the number of decimal places to display.
void CGUISpinBox::setDecimalPlaces(s32 places)
{
@ -148,6 +158,7 @@ void CGUISpinBox::setDecimalPlaces(s32 places)
setValue(getValue());
}
bool CGUISpinBox::OnEvent(SEvent event)
{
bool changeEvent = false;
@ -200,6 +211,7 @@ bool CGUISpinBox::OnEvent(SEvent event)
return IGUIElement::OnEvent(event);
}
void CGUISpinBox::verifyValueRange()
{
f32 val = getValue();
@ -213,6 +225,7 @@ void CGUISpinBox::verifyValueRange()
setValue(val);
}
//! Sets the new caption of the element
void CGUISpinBox::setText(const wchar_t* text)
{
@ -221,12 +234,14 @@ void CGUISpinBox::setText(const wchar_t* text)
verifyValueRange();
}
//! Returns caption of this element.
const wchar_t* CGUISpinBox::getText() const
{
return EditBox->getText();
}
//! Writes attributes of the element.
void CGUISpinBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
@ -246,7 +261,9 @@ void CGUISpinBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadW
setDecimalPlaces(in->getAttributeAsInt("DecimalPlaces"));
}
} // end namespace gui
} // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_

View File

@ -25,20 +25,20 @@ namespace gui
IGUIElement* parent, s32 id, const core::rect<s32>& rectangle);
//! destructor
~CGUISpinBox();
virtual ~CGUISpinBox();
//! Access the edit box used in the spin control
/** \param enable: If set to true, the override color, which can be set
with IGUIEditBox::setOverrideColor is used, otherwise the
EGDC_BUTTON_TEXT color of the skin. */
virtual IGUIEditBox* getEditBox();
virtual IGUIEditBox* getEditBox() const;
//! set the current value of the spinbox
/** \param val: value to be set in the spinbox */
virtual void setValue(f32 val);
//! Get the current value of the spinbox
virtual f32 getValue();
virtual f32 getValue() const;
//! set the range of values which can be used in the spinbox
/** \param min: minimum value
@ -90,6 +90,8 @@ namespace gui
core::stringw FormatString;
s32 DecimalPlaces;
};
} // end namespace gui
} // end namespace irr

View File

@ -22,6 +22,7 @@ CGUISpriteBank::CGUISpriteBank(IGUIEnvironment* env) :
}
}
CGUISpriteBank::~CGUISpriteBank()
{
// drop textures
@ -34,22 +35,26 @@ CGUISpriteBank::~CGUISpriteBank()
Driver->drop();
}
core::array< core::rect<s32> >& CGUISpriteBank::getPositions()
{
return Rectangles;
}
core::array< SGUISprite >& CGUISpriteBank::getSprites()
{
return Sprites;
}
u32 CGUISpriteBank::getTextureCount()
u32 CGUISpriteBank::getTextureCount() const
{
return Textures.size();
}
video::ITexture* CGUISpriteBank::getTexture(u32 index)
video::ITexture* CGUISpriteBank::getTexture(u32 index) const
{
if (index < Textures.size())
return Textures[index];
@ -57,6 +62,7 @@ video::ITexture* CGUISpriteBank::getTexture(u32 index)
return 0;
}
void CGUISpriteBank::addTexture(video::ITexture* texture)
{
if (texture)
@ -65,6 +71,7 @@ void CGUISpriteBank::addTexture(video::ITexture* texture)
Textures.push_back(texture);
}
void CGUISpriteBank::setTexture(u32 index, video::ITexture* texture)
{
while (index > Textures.size())
@ -85,7 +92,7 @@ void CGUISpriteBank::draw2DSprite(u32 index, const core::position2di& pos,
const core::rect<s32>* clip, const video::SColor& color,
u32 starttime, u32 currenttime, bool loop, bool center)
{
if (index >= Sprites.size() || Sprites[index].Frames.empty())
if (Sprites[index].Frames.empty() || index >= Sprites.size())
return;
// work out frame number
@ -99,14 +106,15 @@ void CGUISpriteBank::draw2DSprite(u32 index, const core::position2di& pos,
frame = (f >= Sprites[index].Frames.size()) ? Sprites[index].Frames.size() : f;
}
video::ITexture* tex = Textures[Sprites[index].Frames[frame].textureNumber];
const video::ITexture* tex = Textures[Sprites[index].Frames[frame].textureNumber];
if (!tex)
return;
u32 rn = Sprites[index].Frames[frame].rectNumber;
const u32 rn = Sprites[index].Frames[frame].rectNumber;
if (rn >= Rectangles.size())
return;
core::rect<s32> &r = Rectangles[rn];
const core::rect<s32>& r = Rectangles[rn];
if (center)
{
@ -118,11 +126,11 @@ void CGUISpriteBank::draw2DSprite(u32 index, const core::position2di& pos,
{
Driver->draw2DImage(tex, pos, r, clip, color, true);
}
}
} // namespace gui
} // namespace irr
#endif // _IRR_COMPILE_WITH_GUI_

View File

@ -32,8 +32,8 @@ public:
virtual core::array< core::rect<s32> >& getPositions();
virtual core::array< SGUISprite >& getSprites();
virtual u32 getTextureCount();
virtual video::ITexture* getTexture(u32 index);
virtual u32 getTextureCount() const;
virtual video::ITexture* getTexture(u32 index) const;
virtual void addTexture(video::ITexture* texture);
virtual void setTexture(u32 index, video::ITexture* texture);

View File

@ -16,7 +16,6 @@ namespace irr
namespace gui
{
//! constructor
CGUIStaticText::CGUIStaticText(const wchar_t* text, bool border,
IGUIEnvironment* environment, IGUIElement* parent,
@ -31,6 +30,7 @@ CGUIStaticText::CGUIStaticText(const wchar_t* text, bool border,
#ifdef _DEBUG
setDebugName("CGUIStaticText");
#endif
Text = text;
if (environment && environment->getSkin())
{
@ -141,7 +141,6 @@ void CGUIStaticText::draw()
}
//! Sets another skin independent font.
void CGUIStaticText::setOverrideFont(IGUIFont* font)
{
@ -156,7 +155,8 @@ void CGUIStaticText::setOverrideFont(IGUIFont* font)
breakText();
}
IGUIFont * CGUIStaticText::getOverrideFont()
IGUIFont * CGUIStaticText::getOverrideFont() const
{
return OverrideFont;
}
@ -169,6 +169,7 @@ void CGUIStaticText::setOverrideColor(video::SColor color)
OverrideColorEnabled = true;
}
//! Sets another color for the text.
void CGUIStaticText::setBackgroundColor(video::SColor color)
{
@ -176,18 +177,21 @@ void CGUIStaticText::setBackgroundColor(video::SColor color)
Background = true;
}
//! Sets whether to draw the background
void CGUIStaticText::setDrawBackground(bool draw)
{
Background = draw;
}
//! Sets whether to draw the border
void CGUIStaticText::setDrawBorder(bool draw)
{
Border = draw;
}
void CGUIStaticText::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical)
{
HAlign = horizontal;
@ -195,7 +199,7 @@ void CGUIStaticText::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT
}
video::SColor const & CGUIStaticText::getOverrideColor()
video::SColor const& CGUIStaticText::getOverrideColor() const
{
return OverrideColor;
}
@ -208,7 +212,8 @@ void CGUIStaticText::enableOverrideColor(bool enable)
OverrideColorEnabled = enable;
}
bool CGUIStaticText::isOverrideColorEnabled()
bool CGUIStaticText::isOverrideColorEnabled() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return OverrideColorEnabled;
@ -223,7 +228,8 @@ void CGUIStaticText::setWordWrap(bool enable)
breakText();
}
bool CGUIStaticText::isWordWrapEnabled()
bool CGUIStaticText::isWordWrapEnabled() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return WordWrap;
@ -348,7 +354,7 @@ void CGUIStaticText::updateAbsolutePosition()
//! Returns the height of the text in pixels when it is drawn.
s32 CGUIStaticText::getTextHeight()
s32 CGUIStaticText::getTextHeight() const
{
IGUISkin* skin = Environment->getSkin();
@ -371,7 +377,7 @@ s32 CGUIStaticText::getTextHeight()
}
s32 CGUIStaticText::getTextWidth()
s32 CGUIStaticText::getTextWidth() const
{
IGUIFont * font = OverrideFont;
@ -406,7 +412,6 @@ s32 CGUIStaticText::getTextWidth()
}
//! Writes attributes of the element.
//! Implement this to expose the attributes of your element for
//! scripting languages, editors, debuggers or xml serialization purposes.
@ -425,6 +430,7 @@ void CGUIStaticText::serializeAttributes(io::IAttributes* out, io::SAttributeRea
// out->addFont ("OverrideFont", OverrideFont);
}
//! Reads attributes of the element
void CGUIStaticText::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{

View File

@ -25,7 +25,7 @@ namespace gui
bool background = false);
//! destructor
~CGUIStaticText();
virtual ~CGUIStaticText();
//! draws the element and its children
virtual void draw();
@ -34,7 +34,7 @@ namespace gui
virtual void setOverrideFont(IGUIFont* font=0);
//! Gets the override font (if any)
virtual IGUIFont * getOverrideFont();
virtual IGUIFont * getOverrideFont() const;
//! Sets another color for the text.
virtual void setOverrideColor(video::SColor color);
@ -52,30 +52,30 @@ namespace gui
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical);
//! Gets the override color
virtual video::SColor const & getOverrideColor();
virtual video::SColor const & getOverrideColor() const;
//! Sets if the static text should use the overide color or the
//! color in the gui skin.
virtual void enableOverrideColor(bool enable);
//! Checks if an override color is enabled
virtual bool isOverrideColorEnabled();
virtual bool isOverrideColorEnabled() const;
//! Enables or disables word wrap for using the static text as
//! multiline text control.
virtual void setWordWrap(bool enable);
//! Checks if word wrap is enabled
virtual bool isWordWrapEnabled();
virtual bool isWordWrapEnabled() const;
//! Sets the new caption of this element.
virtual void setText(const wchar_t* text);
//! Returns the height of the text in pixels when it is drawn.
virtual s32 getTextHeight();
virtual s32 getTextHeight() const;
//! Returns the width of the current text, in the current font
virtual s32 getTextWidth();
virtual s32 getTextWidth() const;
//! Updates the absolute position, splits text if word wrap is enabled
virtual void updateAbsolutePosition();
@ -110,3 +110,4 @@ namespace gui
#endif // _IRR_COMPILE_WITH_GUI_
#endif

View File

@ -34,17 +34,9 @@ CGUITab::CGUITab(s32 number, IGUIEnvironment* environment,
}
//! destructor
CGUITab::~CGUITab()
{
}
//! Returns number of tab in tabcontrol. Can be accessed
//! later IGUITabControl::getTab() by this number.
s32 CGUITab::getNumber()
s32 CGUITab::getNumber() const
{
return Number;
}
@ -71,18 +63,21 @@ void CGUITab::draw()
IGUIElement::draw();
}
//! sets if the tab should draw its background
void CGUITab::setDrawBackground(bool draw)
{
DrawBackground = draw;
}
//! sets the color of the background, if it should be drawn.
void CGUITab::setBackgroundColor(video::SColor c)
{
BackColor = c;
}
//! returns true if the tab is drawing its background, false if not
bool CGUITab::isDrawingBackground() const
{
@ -90,12 +85,14 @@ bool CGUITab::isDrawingBackground() const
return DrawBackground;
}
//! returns the color of the background
video::SColor CGUITab::getBackgroundColor() const
{
return BackColor;
}
//! Writes attributes of the element.
void CGUITab::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
@ -107,6 +104,7 @@ void CGUITab::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteO
}
//! Reads attributes of the element
void CGUITab::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
@ -122,7 +120,6 @@ void CGUITab::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWrite
if (isVisible())
((CGUITabControl*)Parent)->setActiveTab(this);
}
}
@ -143,7 +140,6 @@ CGUITabControl::CGUITabControl(IGUIEnvironment* environment,
}
//! destructor
CGUITabControl::~CGUITabControl()
{
@ -182,6 +178,7 @@ IGUITab* CGUITabControl::addTab(const wchar_t* caption, s32 id)
return tab;
}
//! adds a tab which has been created elsewhere
void CGUITabControl::addTab(CGUITab* tab)
{
@ -218,16 +215,16 @@ void CGUITabControl::addTab(CGUITab* tab)
}
}
//! Returns amount of tabs in the tabcontrol
s32 CGUITabControl::getTabcount()
s32 CGUITabControl::getTabCount() const
{
return Tabs.size();
}
//! Returns a tab based on zero based index
IGUITab* CGUITabControl::getTab(s32 idx)
IGUITab* CGUITabControl::getTab(s32 idx) const
{
if (idx < 0 || idx >= (s32)Tabs.size())
return 0;
@ -236,7 +233,6 @@ IGUITab* CGUITabControl::getTab(s32 idx)
}
//! called if an event happened.
bool CGUITabControl::OnEvent(SEvent event)
{
@ -266,6 +262,7 @@ bool CGUITabControl::OnEvent(SEvent event)
return Parent ? Parent->OnEvent(event) : false;
}
void CGUITabControl::selectTab(core::position2d<s32> p)
{
IGUISkin* skin = Environment->getSkin();
@ -278,7 +275,7 @@ void CGUITabControl::selectTab(core::position2d<s32> p)
frameRect.LowerRightCorner.Y = frameRect.UpperLeftCorner.Y + tabheight;
s32 pos = frameRect.UpperLeftCorner.X + 2;
for (s32 i=0; i<(s32)Tabs.size(); ++i)
for (u32 i=0; i<Tabs.size(); ++i)
{
// get Text
const wchar_t* text = 0;
@ -396,7 +393,7 @@ void CGUITabControl::draw()
//! Returns which tab is currently active
s32 CGUITabControl::getActiveTab()
s32 CGUITabControl::getActiveTab() const
{
return ActiveTab;
}
@ -410,10 +407,11 @@ bool CGUITabControl::setActiveTab(IGUIElement *tab)
return false;
}
//! Brings a tab to front.
bool CGUITabControl::setActiveTab(s32 idx)
{
if (idx < 0 || idx >= (s32)Tabs.size())
if ((u32)idx >= Tabs.size())
return false;
bool changed = (ActiveTab != idx);
@ -442,10 +440,11 @@ bool CGUITabControl::setActiveTab(s32 idx)
void CGUITabControl::removeChild(IGUIElement* child)
{
bool isTab = false;
s32 i=0;
u32 i=0;
// check if it is a tab
for (i=0; i<(s32)Tabs.size(); )
while (i<Tabs.size())
{
if (Tabs[i] == child)
{
Tabs[i]->drop();
@ -454,12 +453,15 @@ void CGUITabControl::removeChild(IGUIElement* child)
}
else
++i;
}
// reassign numbers
if (isTab)
{
for (i=0; i<(s32)Tabs.size(); ++i)
if (Tabs[i])
Tabs[i]->setNumber(i);
}
// remove real element
IGUIElement::removeChild(child);
@ -476,6 +478,7 @@ void CGUITabControl::serializeAttributes(io::IAttributes* out, io::SAttributeRea
out->addBool("FillBackground", FillBackground);
}
//! Reads attributes of the element
void CGUITabControl::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{

View File

@ -25,12 +25,9 @@ namespace gui
IGUIElement* parent, const core::rect<s32>& rectangle,
s32 id);
//! destructor
virtual ~CGUITab();
//! Returns number of this tab in tabcontrol. Can be accessed
//! later IGUITabControl::getTab() by this number.
virtual s32 getNumber();
virtual s32 getNumber() const;
//! Sets the number
virtual void setNumber(s32 n);
@ -86,10 +83,10 @@ namespace gui
virtual void addTab(CGUITab* tab);
//! Returns amount of tabs in the tabcontrol
virtual s32 getTabcount();
virtual s32 getTabCount() const;
//! Returns a tab based on zero based index
virtual IGUITab* getTab(s32 idx);
virtual IGUITab* getTab(s32 idx) const;
//! Brings a tab to front.
virtual bool setActiveTab(s32 idx);
@ -98,7 +95,7 @@ namespace gui
virtual bool setActiveTab(IGUIElement *tab);
//! Returns which tab is currently active
virtual s32 getActiveTab();
virtual s32 getActiveTab() const;
//! called if an event happened.
virtual bool OnEvent(SEvent event);

View File

@ -64,12 +64,6 @@ CGUIToolBar::CGUIToolBar(IGUIEnvironment* environment, IGUIElement* parent, s32
}
//! destructor
CGUIToolBar::~CGUIToolBar()
{
}
//! called if an event happened.
bool CGUIToolBar::OnEvent(SEvent event)
{
@ -83,6 +77,7 @@ bool CGUIToolBar::OnEvent(SEvent event)
return Parent ? Parent->OnEvent(event) : false;
}
//! draws the element and its children
void CGUIToolBar::draw()
{
@ -161,3 +156,4 @@ IGUIButton* CGUIToolBar::addButton(s32 id, const wchar_t* text,const wchar_t* to
} // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_

View File

@ -23,9 +23,6 @@ namespace gui
//! constructor
CGUIToolBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle);
//! destructor
~CGUIToolBar();
//! called if an event happened.
virtual bool OnEvent(SEvent event);
@ -36,7 +33,7 @@ namespace gui
virtual void updateAbsolutePosition();
//! Adds a button to the tool bar
virtual IGUIButton* addButton(s32 id=-1, const wchar_t* text=0,const wchar_t* tooltiptext=0,
virtual IGUIButton* addButton(s32 id=-1, const wchar_t* text=0,const wchar_t* tooltiptext=0,
video::ITexture* img=0, video::ITexture* pressed=0,
bool isPushButton=false, bool useAlphaChannel=false);
@ -52,3 +49,4 @@ namespace gui
#endif // _IRR_COMPILE_WITH_GUI_
#endif

View File

@ -92,7 +92,6 @@ CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id
}
//! destructor
CGUIWindow::~CGUIWindow()
{
@ -107,7 +106,6 @@ CGUIWindow::~CGUIWindow()
}
//! called if an event happened.
bool CGUIWindow::OnEvent(SEvent event)
{
@ -202,6 +200,7 @@ bool CGUIWindow::OnEvent(SEvent event)
return IGUIElement::OnEvent(event);
}
//! Updates the absolute position.
void CGUIWindow::updateAbsolutePosition()
{
@ -209,7 +208,6 @@ void CGUIWindow::updateAbsolutePosition()
}
//! draws the element and its children
void CGUIWindow::draw()
{
@ -240,25 +238,22 @@ void CGUIWindow::draw()
}
//! Returns pointer to the close button
IGUIButton* CGUIWindow::getCloseButton()
IGUIButton* CGUIWindow::getCloseButton() const
{
return CloseButton;
}
//! Returns pointer to the minimize button
IGUIButton* CGUIWindow::getMinimizeButton()
IGUIButton* CGUIWindow::getMinimizeButton() const
{
return MinButton;
}
//! Returns pointer to the maximize button
IGUIButton* CGUIWindow::getMaximizeButton()
IGUIButton* CGUIWindow::getMaximizeButton() const
{
return RestoreButton;
}
@ -268,3 +263,4 @@ IGUIButton* CGUIWindow::getMaximizeButton()
} // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_

View File

@ -24,7 +24,7 @@ namespace gui
CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle);
//! destructor
~CGUIWindow();
virtual ~CGUIWindow();
//! called if an event happened.
virtual bool OnEvent(SEvent event);
@ -36,13 +36,13 @@ namespace gui
virtual void draw();
//! Returns pointer to the close button
virtual IGUIButton* getCloseButton();
virtual IGUIButton* getCloseButton() const;
//! Returns pointer to the minimize button
virtual IGUIButton* getMinimizeButton();
virtual IGUIButton* getMinimizeButton() const;
//! Returns pointer to the maximize button
virtual IGUIButton* getMaximizeButton();
virtual IGUIButton* getMaximizeButton() const;
protected:
@ -60,3 +60,4 @@ namespace gui
#endif // _IRR_COMPILE_WITH_GUI_
#endif

View File

@ -150,7 +150,7 @@ namespace irr
}
//! Returns if the cursor is currently visible.
virtual bool isVisible()
virtual bool isVisible() const
{
return IsVisible;
}

View File

@ -83,7 +83,7 @@ namespace irr
}
//! Returns if the cursor is currently visible.
virtual bool isVisible()
virtual bool isVisible() const
{
return IsVisible;
}

View File

@ -94,7 +94,7 @@ namespace irr
}
//! Returns if the cursor is currently visible.
virtual bool isVisible()
virtual bool isVisible() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsVisible;

View File

@ -566,7 +566,7 @@ void CNullDriver::draw3DBox(const core::aabbox3d<f32>& box, SColor color)
//! draws an 2d image
void CNullDriver::draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos)
void CNullDriver::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos)
{
if (!texture)
return;
@ -581,7 +581,7 @@ void CNullDriver::draw2DImage(video::ITexture* texture, const core::position2d<s
//! in one line. All drawings are clipped against clipRect (if != 0).
//! The subtextures are defined by the array of sourceRects and are chosen
//! by the indices given.
void CNullDriver::draw2DImage(video::ITexture* texture,
void CNullDriver::draw2DImage(const video::ITexture* texture,
const core::position2d<s32>& pos,
const core::array<core::rect<s32> >& sourceRects,
const core::array<s32>& indices,
@ -603,7 +603,7 @@ void CNullDriver::draw2DImage(video::ITexture* texture,
//! Draws a part of the texture into the rectangle.
void CNullDriver::draw2DImage(video::ITexture* texture, const core::rect<s32>& destRect,
void CNullDriver::draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
video::SColor* colors, bool useAlphaChannelOfTexture)
{
@ -612,7 +612,7 @@ void CNullDriver::draw2DImage(video::ITexture* texture, const core::rect<s32>& d
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
void CNullDriver::draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos,
void CNullDriver::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, SColor color,
bool useAlphaChannelOfTexture)
@ -1391,7 +1391,7 @@ const SExposedVideoData& CNullDriver::getExposedVideoData()
//! Returns type of video driver
E_DRIVER_TYPE CNullDriver::getDriverType()
E_DRIVER_TYPE CNullDriver::getDriverType() const
{
return EDT_NULL;
}

View File

@ -119,7 +119,7 @@ namespace video
SColor color = SColor(255,255,255,255));
//! draws an 2d image
virtual void draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos);
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos);
//! draws a set of 2d images, using a color and the alpha
/** channel of the texture if desired. The images are drawn
@ -138,7 +138,7 @@ namespace video
Note that the alpha component is used: If alpha is other than 255, the image will be transparent.
\param useAlphaChannelOfTexture: If true, the alpha channel of the texture is
used to draw the image. */
virtual void draw2DImage(video::ITexture* texture,
virtual void draw2DImage(const video::ITexture* texture,
const core::position2d<s32>& pos,
const core::array<core::rect<s32> >& sourceRects,
const core::array<s32>& indices,
@ -148,12 +148,12 @@ namespace video
bool useAlphaChannelOfTexture=false);
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
virtual void draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos,
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false);
//! Draws a part of the texture into the rectangle.
virtual void draw2DImage(video::ITexture* texture, const core::rect<s32>& destRect,
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
video::SColor* colors=0, bool useAlphaChannelOfTexture=false);
@ -300,7 +300,7 @@ namespace video
virtual const SExposedVideoData& getExposedVideoData();
//! Returns type of video driver
virtual E_DRIVER_TYPE getDriverType();
virtual E_DRIVER_TYPE getDriverType() const;
//! Returns the transformation set by setTransform
virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state);
@ -483,9 +483,9 @@ namespace video
virtual void* lock() { return 0; };
virtual void unlock(){}
virtual const core::dimension2d<s32>& getOriginalSize() { return size; }
virtual const core::dimension2d<s32>& getSize() { return size; }
virtual E_DRIVER_TYPE getDriverType() { return video::EDT_NULL; }
virtual const core::dimension2d<s32>& getOriginalSize() const { return size; }
virtual const core::dimension2d<s32>& getSize() const { return size; }
virtual E_DRIVER_TYPE getDriverType() const { return video::EDT_NULL; }
virtual ECOLOR_FORMAT getColorFormat() const { return video::ECF_A1R5G5B5; };
virtual u32 getPitch() const { return 0; }
virtual void regenerateMipMapLevels() {};

View File

@ -699,7 +699,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
//! draws a 2d image, using a color and the alpha channel of the texture if
//! desired. The image is drawn at pos, clipped against clipRect (if != 0).
//! Only the subtexture defined by sourceRect is used.
void COpenGLDriver::draw2DImage(video::ITexture* texture,
void COpenGLDriver::draw2DImage(const video::ITexture* texture,
const core::position2d<s32>& pos,
const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, SColor color,
@ -831,7 +831,7 @@ void COpenGLDriver::draw2DImage(video::ITexture* texture,
//! in one line. All drawings are clipped against clipRect (if != 0).
//! The subtextures are defined by the array of sourceRects and are chosen
//! by the indices given.
void COpenGLDriver::draw2DImage(video::ITexture* texture,
void COpenGLDriver::draw2DImage(const video::ITexture* texture,
const core::position2d<s32>& pos,
const core::array<core::rect<s32> >& sourceRects,
const core::array<s32>& indices,
@ -903,7 +903,7 @@ void COpenGLDriver::draw2DImage(video::ITexture* texture,
void COpenGLDriver::draw2DImage(video::ITexture* texture, const core::rect<s32>& destRect,
void COpenGLDriver::draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
video::SColor* colors, bool useAlphaChannelOfTexture)
{
@ -1050,7 +1050,7 @@ void COpenGLDriver::draw2DLine(const core::position2d<s32>& start,
bool COpenGLDriver::setTexture(u32 stage, video::ITexture* texture)
bool COpenGLDriver::setTexture(u32 stage, const video::ITexture* texture)
{
if (stage >= MaxTextureUnits)
return false;
@ -1079,7 +1079,7 @@ bool COpenGLDriver::setTexture(u32 stage, video::ITexture* texture)
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,
static_cast<COpenGLTexture*>(texture)->getOpenGLTextureName());
static_cast<const COpenGLTexture*>(texture)->getOpenGLTextureName());
}
return true;
}
@ -2055,7 +2055,7 @@ void COpenGLDriver::OnResize(const core::dimension2d<s32>& size)
//! Returns type of video driver
E_DRIVER_TYPE COpenGLDriver::getDriverType()
E_DRIVER_TYPE COpenGLDriver::getDriverType() const
{
return EDT_OPENGL;
}

View File

@ -121,7 +121,7 @@ namespace video
virtual void setMaterial(const SMaterial& material);
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
virtual void draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos,
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false);
@ -141,7 +141,7 @@ namespace video
Note that the alpha component is used: If alpha is other than 255, the image will be transparent.
\param useAlphaChannelOfTexture: If true, the alpha channel of the texture is
used to draw the image. */
virtual void draw2DImage(video::ITexture* texture,
virtual void draw2DImage(const video::ITexture* texture,
const core::position2d<s32>& pos,
const core::array<core::rect<s32> >& sourceRects,
const core::array<s32>& indices,
@ -150,7 +150,7 @@ namespace video
bool useAlphaChannelOfTexture=false);
//! Draws a part of the texture into the rectangle.
virtual void draw2DImage(video::ITexture* texture, const core::rect<s32>& destRect,
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
video::SColor* colors=0, bool useAlphaChannelOfTexture=false);
@ -217,7 +217,7 @@ namespace video
virtual void OnResize(const core::dimension2d<s32>& size);
//! Returns type of video driver
virtual E_DRIVER_TYPE getDriverType();
virtual E_DRIVER_TYPE getDriverType() const;
//! Returns the transformation set by setTransform
virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state);
@ -240,7 +240,7 @@ namespace video
//! sets the current Texture
//! Returns whether setting was a success or not.
bool setTexture(u32 stage, video::ITexture* texture);
bool setTexture(u32 stage, const video::ITexture* texture);
//! disables all textures beginning with the optional fromStage parameter. Otherwise all texture stages are disabled.
//! Returns whether disabling was successful or not.
@ -341,7 +341,7 @@ namespace video
SMaterial Material, LastMaterial;
COpenGLTexture* RenderTargetTexture;
ITexture* CurrentTexture[MATERIAL_MAX_TEXTURES];
const ITexture* CurrentTexture[MATERIAL_MAX_TEXTURES];
s32 LastSetLight;
core::array<core::plane3df> UserClipPlane;
core::array<bool> UserClipPlaneEnabled;

View File

@ -328,7 +328,7 @@ void COpenGLTexture::copyTexture(bool newTexture)
//! returns the size of a texture which would be the optimal size for rendering it
inline s32 COpenGLTexture::getTextureSizeFromSurfaceSize(s32 size)
inline s32 COpenGLTexture::getTextureSizeFromSurfaceSize(s32 size) const
{
s32 ts = 0x01;
while(ts < size)
@ -366,7 +366,7 @@ void COpenGLTexture::unlock()
//! Returns size of the original image.
const core::dimension2d<s32>& COpenGLTexture::getOriginalSize()
const core::dimension2d<s32>& COpenGLTexture::getOriginalSize() const
{
return ImageSize;
}
@ -374,7 +374,7 @@ const core::dimension2d<s32>& COpenGLTexture::getOriginalSize()
//! Returns of the texture.
const core::dimension2d<s32>& COpenGLTexture::getSize()
const core::dimension2d<s32>& COpenGLTexture::getSize() const
{
if (Image)
return Image->getDimension();
@ -385,7 +385,7 @@ const core::dimension2d<s32>& COpenGLTexture::getSize()
//! returns driver type of texture (=the driver, who created the texture)
E_DRIVER_TYPE COpenGLTexture::getDriverType()
E_DRIVER_TYPE COpenGLTexture::getDriverType() const
{
return EDT_OPENGL;
}
@ -415,13 +415,12 @@ u32 COpenGLTexture::getPitch() const
//! return open gl texture name
GLuint COpenGLTexture::getOpenGLTextureName()
GLuint COpenGLTexture::getOpenGLTextureName() const
{
return TextureName;
}
//! Returns whether this texture has mipmaps
//! return true if texture has mipmaps
bool COpenGLTexture::hasMipMaps() const
@ -430,7 +429,6 @@ bool COpenGLTexture::hasMipMaps() const
}
//! Regenerates the mip map levels of the texture. Useful after locking and
//! modifying the texture
void COpenGLTexture::regenerateMipMapLevels()
@ -461,11 +459,13 @@ void COpenGLTexture::regenerateMipMapLevels()
Image->unlock();
}
bool COpenGLTexture::isFrameBufferObject()
bool COpenGLTexture::isFrameBufferObject() const
{
return ColorFrameBuffer != 0;
}
//! Bind ColorFrameBuffer (valid only if isFrameBufferObject() returns true).
void COpenGLTexture::bindFrameBufferObject()
{
@ -475,6 +475,7 @@ void COpenGLTexture::bindFrameBufferObject()
#endif
}
//! Unbind ColorFrameBuffer (valid only if isFrameBufferObject() returns true).
void COpenGLTexture::unbindFrameBufferObject()
{

View File

@ -62,13 +62,13 @@ public:
virtual void unlock();
//! Returns original size of the texture.
virtual const core::dimension2d<s32>& getOriginalSize();
virtual const core::dimension2d<s32>& getOriginalSize() const;
//! Returns size of the texture.
virtual const core::dimension2d<s32>& getSize();
virtual const core::dimension2d<s32>& getSize() const;
//! returns driver type of texture (=the driver, who created the texture)
virtual E_DRIVER_TYPE getDriverType();
virtual E_DRIVER_TYPE getDriverType() const;
//! returns color format of texture
virtual ECOLOR_FORMAT getColorFormat() const;
@ -77,7 +77,7 @@ public:
virtual u32 getPitch() const;
//! return open gl texture name
GLuint getOpenGLTextureName();
GLuint getOpenGLTextureName() const;
//! return whether this texture has mipmaps
virtual bool hasMipMaps() const;
@ -87,7 +87,7 @@ public:
virtual void regenerateMipMapLevels();
//! Is it a FrameBufferObject?
bool isFrameBufferObject();
bool isFrameBufferObject() const;
//! Bind FrameBufferObject (valid only if isFrameBufferObject() returns true).
void bindFrameBufferObject();
@ -108,7 +108,7 @@ private:
void copyTexture(bool newTexture=true);
//! returns the size of a texture which would be the optimize size for rendering it
inline s32 getTextureSizeFromSurfaceSize(s32 size);
inline s32 getTextureSizeFromSurfaceSize(s32 size) const;
core::dimension2d<s32> ImageSize;
COpenGLDriver* Driver;

View File

@ -769,7 +769,7 @@ core::dimension2d<s32> CSoftwareDriver::getCurrentRenderTargetSize()
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
void CSoftwareDriver::draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos,
void CSoftwareDriver::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, SColor color,
bool useAlphaChannelOfTexture)
@ -845,12 +845,14 @@ const wchar_t* CSoftwareDriver::getName()
return L"Irrlicht Software Device 1.0";
}
//! Returns type of video driver
E_DRIVER_TYPE CSoftwareDriver::getDriverType()
E_DRIVER_TYPE CSoftwareDriver::getDriverType() const
{
return EDT_SOFTWARE;
}
//! Returns the transformation set by setTransform
const core::matrix4& CSoftwareDriver::getTransform(E_TRANSFORMATION_STATE state)
{

View File

@ -60,7 +60,7 @@ namespace video
const core::vector3df& end, SColor color = SColor(255,255,255,255));
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
virtual void draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos,
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false);
@ -83,7 +83,7 @@ namespace video
virtual const wchar_t* getName();
//! Returns type of video driver
virtual E_DRIVER_TYPE getDriverType();
virtual E_DRIVER_TYPE getDriverType() const;
//! Returns the transformation set by setTransform
virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state);

View File

@ -1564,7 +1564,7 @@ void CSoftwareDriver2::lightVertex ( s4DVertex *dest, const S3DVertex *source )
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
void CSoftwareDriver2::draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos,
void CSoftwareDriver2::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, SColor color,
bool useAlphaChannelOfTexture)
@ -1840,7 +1840,7 @@ const wchar_t* CSoftwareDriver2::getName()
}
//! Returns type of video driver
E_DRIVER_TYPE CSoftwareDriver2::getDriverType()
E_DRIVER_TYPE CSoftwareDriver2::getDriverType() const
{
return EDT_BURNINGSVIDEO;
}

View File

@ -72,7 +72,7 @@ namespace video
void drawVertexPrimitiveList(const void* vertices, u32 vertexCount, const u16* indexList, u32 primitiveCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType);
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
virtual void draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos,
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false);
@ -99,7 +99,7 @@ namespace video
virtual const wchar_t* getName();
//! Returns type of video driver
virtual E_DRIVER_TYPE getDriverType();
virtual E_DRIVER_TYPE getDriverType() const;
//! Returns the transformation set by setTransform
virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state);

View File

@ -80,14 +80,14 @@ void CSoftwareTexture::unlock()
//! Returns original size of the texture.
const core::dimension2d<s32>& CSoftwareTexture::getOriginalSize()
const core::dimension2d<s32>& CSoftwareTexture::getOriginalSize() const
{
return OrigSize;
}
//! Returns (=size) of the texture.
const core::dimension2d<s32>& CSoftwareTexture::getSize()
const core::dimension2d<s32>& CSoftwareTexture::getSize() const
{
return Image->getDimension();
}
@ -110,7 +110,7 @@ CImage* CSoftwareTexture::getTexture()
//! returns the size of a texture which would be the optimize size for rendering it
inline s32 CSoftwareTexture::getTextureSizeFromSurfaceSize(s32 size)
inline s32 CSoftwareTexture::getTextureSizeFromSurfaceSize(s32 size) const
{
s32 ts = 0x01;
while(ts < size)
@ -122,7 +122,7 @@ inline s32 CSoftwareTexture::getTextureSizeFromSurfaceSize(s32 size)
//! returns driver type of texture (=the driver, who created the texture)
E_DRIVER_TYPE CSoftwareTexture::getDriverType()
E_DRIVER_TYPE CSoftwareTexture::getDriverType() const
{
return EDT_SOFTWARE;
}
@ -152,7 +152,6 @@ void CSoftwareTexture::regenerateMipMapLevels()
}
} // end namespace video
} // end namespace irr

View File

@ -33,10 +33,10 @@ public:
virtual void unlock();
//! Returns original size of the texture.
virtual const core::dimension2d<s32>& getOriginalSize();
virtual const core::dimension2d<s32>& getOriginalSize() const;
//! Returns (=size) of the texture.
virtual const core::dimension2d<s32>& getSize();
virtual const core::dimension2d<s32>& getSize() const;
//! returns unoptimized surface
virtual CImage* getImage();
@ -45,7 +45,7 @@ public:
virtual CImage* getTexture();
//! returns driver type of texture (=the driver, who created the texture)
virtual E_DRIVER_TYPE getDriverType();
virtual E_DRIVER_TYPE getDriverType() const;
//! returns color format of texture
virtual ECOLOR_FORMAT getColorFormat() const;
@ -60,12 +60,11 @@ public:
private:
//! returns the size of a texture which would be the optimize size for rendering it
inline s32 getTextureSizeFromSurfaceSize(s32 size);
inline s32 getTextureSizeFromSurfaceSize(s32 size) const;
CImage* Image;
CImage* Texture;
core::dimension2d<s32> OrigSize;
};

View File

@ -48,8 +48,6 @@ CSoftwareTexture2::CSoftwareTexture2(IImage* image, const char* name, bool gener
temp->copyToScaling(MipMap[0]);
temp->drop ();
}
}
regenerateMipMapLevels ();
@ -57,7 +55,6 @@ CSoftwareTexture2::CSoftwareTexture2(IImage* image, const char* name, bool gener
}
//! destructor
CSoftwareTexture2::~CSoftwareTexture2()
{
@ -70,7 +67,7 @@ CSoftwareTexture2::~CSoftwareTexture2()
//! returns the size of a texture which would be the optimize size for rendering it
inline s32 CSoftwareTexture2::getTextureSizeFromSurfaceSize(s32 size)
inline s32 CSoftwareTexture2::getTextureSizeFromSurfaceSize(s32 size) const
{
s32 ts = 0x01;
while(ts < size)
@ -84,7 +81,6 @@ inline s32 CSoftwareTexture2::getTextureSizeFromSurfaceSize(s32 size)
}
//! Regenerates the mip map levels of the texture. Useful after locking and
//! modifying the texture
void CSoftwareTexture2::regenerateMipMapLevels()
@ -124,3 +120,4 @@ void CSoftwareTexture2::regenerateMipMapLevels()
} // end namespace irr
#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_

View File

@ -41,20 +41,20 @@ public:
}
//! Returns original size of the texture.
virtual const core::dimension2d<s32>& getOriginalSize()
virtual const core::dimension2d<s32>& getOriginalSize() const
{
//return MipMap[0]->getDimension();
return OrigSize;
}
//! Returns the size of the largest mipmap.
const core::dimension2d<s32>& getMaxSize()
const core::dimension2d<s32>& getMaxSize() const
{
return MipMap[0]->getDimension();
}
//! Returns (=size) of the texture.
virtual const core::dimension2d<s32>& getSize()
virtual const core::dimension2d<s32>& getSize() const
{
return MipMap[MipMapLOD]->getDimension();
}
@ -73,7 +73,7 @@ public:
//! returns driver type of texture (=the driver, who created the texture)
virtual E_DRIVER_TYPE getDriverType()
virtual E_DRIVER_TYPE getDriverType() const
{
return EDT_BURNINGSVIDEO;
}
@ -110,7 +110,7 @@ public:
private:
//! returns the size of a texture which would be the optimize size for rendering it
inline s32 getTextureSizeFromSurfaceSize(s32 size);
inline s32 getTextureSizeFromSurfaceSize(s32 size) const;
core::dimension2d<s32> OrigSize;
@ -118,7 +118,6 @@ private:
s32 MipMapLOD;
bool HasMipMaps;
};