completion of most getters/setters for GUI

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@653 dfc29bdd-3216-0410-991c-e03cc46cb475
master
bitplane 2007-05-26 20:44:25 +00:00
parent a10b998a04
commit 7cf5252eb9
20 changed files with 131 additions and 17 deletions

View File

@ -26,19 +26,23 @@ namespace gui
//! Returns amount of items in box
virtual s32 getItemCount() = 0;
//! returns string of an item. the idx may be a value from 0 to itemCount-1
//! Returns string of an item. the idx may be a value from 0 to itemCount-1
virtual const wchar_t* getItem(s32 idx) = 0;
//! adds an item and returns the index of it
//! Adds an item and returns the index of it
virtual s32 addItem(const wchar_t* text) = 0;
//! deletes all items in the combo box
//! Removes an item from the combo box.
/** Warning. This will change the IDs of all following items */
virtual void removeItem(s32 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.
//! Returns id of selected item. returns -1 if no item is selected.
virtual s32 getSelected() = 0;
//! sets the selected item. Set this to -1 if no item should be selected
//! Sets the selected item. Set this to -1 if no item should be selected
virtual void setSelected(s32 id) = 0;
};

View File

@ -69,6 +69,9 @@ namespace gui
\param enabled: True if it is enabled, otherwise false. */
virtual void setItemChecked(s32 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;
//! Removes a menu item
/** \param idx: Zero based index of the menu item */

View File

@ -28,17 +28,24 @@ namespace gui
//! destructor
~IGUIImage() {};
//! sets an image
//! Sets an image
virtual void setImage(video::ITexture* image) = 0;
//! sets the colour of the image
//! Sets the colour of the image
virtual void setColor(video::SColor color) = 0;
//! sets if the image should scale to fit the element
//! Sets if the image should scale to fit the element
virtual void setScaleImage(bool scale) = 0;
//! sets if the image should use its alpha channel to draw itself
//! Sets if the image should use its alpha channel to draw itself
virtual void setUseAlphaChannel(bool use) = 0;
//! Returns true if the image is scaled to fit, false if not
virtual bool isImageScaled() const = 0;
//! Returns true if the image is using the alpha channel, false if not
virtual bool isAlphaChannelUsed() const = 0;
};

View File

@ -45,6 +45,9 @@ namespace gui
//! Removes an item from the list
virtual void removeItem(s32 index) = 0;
//! Returns the icon of an item
virtual s32 getIcon(s32 id) 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.
//! An icon is an index within the icon sprite bank. Several default icons are available in the

View File

@ -35,13 +35,16 @@ namespace gui
//! destructor
~IGUIMeshViewer() {};
//! sets the mesh to be shown
//! Sets the mesh to be shown
virtual void setMesh(scene::IAnimatedMesh* mesh) = 0;
//! sets the material
//! Gets the displayed mesh
virtual scene::IAnimatedMesh* getMesh() const = 0;
//! Sets the material
virtual void setMaterial(const video::SMaterial& material) = 0;
//! gets the material
//! Gets the material
virtual const video::SMaterial& getMaterial() = 0;
};

View File

@ -33,6 +33,13 @@ namespace gui
//! sets the color of the background, if it should be drawn.
virtual void setBackgroundColor(video::SColor c) = 0;
//! returns true if the tab is drawing its background, false if not
virtual bool isDrawingBackground() const = 0;
//! returns the color of the background
virtual video::SColor getBackgroundColor() const = 0;
};
//! A standard tab control

View File

@ -74,6 +74,18 @@ const wchar_t* CGUIComboBox::getItem(s32 idx)
return Items[idx].c_str();
}
//! Removes an item from the combo box.
void CGUIComboBox::removeItem(s32 idx)
{
if (idx < 0 || idx >= (s32)Items.size())
return;
if (Selected == idx)
Selected = -1;
Items.erase(idx);
}
//! Returns caption of this element.
const wchar_t* CGUIComboBox::getText()
{

View File

@ -34,6 +34,9 @@ namespace gui
//! adds an item and returns the index of it
virtual s32 addItem(const wchar_t* text);
//! Removes an item from the combo box.
virtual void removeItem(s32 id);
//! deletes all items in the combo box
virtual void clear();

View File

@ -49,7 +49,7 @@ CGUIContextMenu::~CGUIContextMenu()
//! Returns amount of menu items
s32 CGUIContextMenu::getItemCount() const
{
return Items.size();
return (s32)Items.size();
}
@ -137,6 +137,19 @@ bool CGUIContextMenu::isItemEnabled(s32 idx)
return Items[idx].Enabled;
}
//! Returns if a menu item is checked
bool CGUIContextMenu::isItemChecked(s32 idx)
{
if (idx < 0 || idx >= (s32)Items.size())
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return false;
}
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return Items[idx].Checked;
}
//! Sets if the menu item should be enabled.
void CGUIContextMenu::setItemEnabled(s32 idx, bool enabled)

View File

@ -50,6 +50,9 @@ namespace gui
//! Sets if the menu item should be enabled.
virtual void setItemEnabled(s32 idx, bool enabled);
//! Returns if a menu item is checked
virtual bool isItemChecked(s32 idx);
//! Sets if the menu item should be checked.
virtual void setItemChecked(s32 idx, bool enabled);

View File

@ -108,6 +108,20 @@ void CGUIImage::setScaleImage(bool scale)
ScaleImage = scale;
}
//! Returns true if the image is scaled to fit, false if not
bool CGUIImage::isImageScaled() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return ScaleImage;
}
//! Returns true if the image is using the alpha channel, false if not
bool CGUIImage::isAlphaChannelUsed() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return UseAlphaChannel;
}
//! Writes attributes of the element.
void CGUIImage::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0)

View File

@ -37,6 +37,12 @@ namespace gui
//! sets if the image should use its alpha channel to draw itself
virtual void setUseAlphaChannel(bool use);
//! Returns true if the image is scaled to fit, false if not
virtual bool isImageScaled() const;
//! Returns true if the image is using the alpha channel, false if not
virtual bool isAlphaChannelUsed() const;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options);

View File

@ -80,6 +80,14 @@ const wchar_t* CGUIListBox::getListItem(s32 id)
return Items[id].text.c_str();
}
//! Returns the icon of an item
s32 CGUIListBox::getIcon(s32 id) const
{
if (id<0 || id>((s32)Items.size())-1)
return -1;
return Items[id].icon;
}
//! adds an list item, returns id of item

View File

@ -31,7 +31,7 @@ namespace gui
//! returns amount of list items
virtual s32 getItemCount();
//! returns string of a list item. the may be a value from 0 to itemCount-1
//! returns string of a list item. the id may be a value from 0 to itemCount-1
virtual const wchar_t* getListItem(s32 id);
//! adds an list item, returns id of item
@ -59,6 +59,9 @@ namespace gui
//! returns the id of the new created item
virtual s32 addItem(const wchar_t* text, s32 icon);
//! Returns the icon of an item
virtual s32 getIcon(s32 id) const;
//! removes an item from the list
virtual void removeItem(s32 id);

View File

@ -61,7 +61,11 @@ 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)

View File

@ -28,6 +28,9 @@ namespace gui
//! sets the mesh to be shown
virtual void setMesh(scene::IAnimatedMesh* mesh);
//! Gets the displayed mesh
virtual scene::IAnimatedMesh* getMesh() const;
//! sets the material
virtual void setMaterial(const video::SMaterial& material);

View File

@ -81,6 +81,18 @@ void CGUITab::setBackgroundColor(video::SColor c)
BackColor = c;
}
//! returns true if the tab is drawing its background, false if not
bool CGUITab::isDrawingBackground() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
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)

View File

@ -41,6 +41,12 @@ namespace gui
//! sets the color of the background, if it should be drawn.
virtual void setBackgroundColor(video::SColor c);
//! returns true if the tab is drawing its background, false if not
virtual bool isDrawingBackground() const;
//! returns the color of the background
virtual video::SColor getBackgroundColor() const;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options);