Loading...
Searching...
No Matches
ICursorControl.h
Go to the documentation of this file.
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_CURSOR_CONTROL_H_INCLUDED__
#define __I_CURSOR_CONTROL_H_INCLUDED__
#include "IReferenceCounted.h"
#include "position2d.h"
#include "rect.h"
namespace irr
{
namespace gui
{
class IGUISpriteBank;
enum ECURSOR_ICON
{
// Following cursors might be system specific, or might use an Irrlicht icon-set. No guarantees so far.
ECI_NORMAL, // arrow
ECI_CROSS, // Crosshair
ECI_HAND, // Hand
ECI_HELP, // Arrow and question mark
ECI_IBEAM, // typical text-selection cursor
ECI_NO, // should not click icon
ECI_WAIT, // hourclass
ECI_SIZEALL, // arrow in all directions
ECI_SIZENESW, // resizes in direction north-east or south-west
ECI_SIZENWSE, // resizes in direction north-west or south-east
ECI_SIZENS, // resizes in direction north or south
ECI_SIZEWE, // resizes in direction west or east
ECI_UP, // up-arrow
// Implementer note: Should we add system specific cursors, which use guaranteed the system icons,
// then I would recommend using a naming scheme like ECI_W32_CROSS, ECI_X11_CROSSHAIR and adding those
// additionally.
ECI_COUNT // maximal of defined cursors. Note that higher values can be created at runtime
};
const c8* const GUICursorIconNames[ECI_COUNT+1] =
{
"normal",
"cross",
"hand",
"help",
"ibeam",
"no",
"wait",
"sizeall",
"sizenesw",
"sizenwse",
"sizens",
"sizewe",
"sizeup",
0
};
struct SCursorSprite
{
SCursorSprite()
: SpriteBank(0), SpriteId(-1)
{
}
SCursorSprite( gui::IGUISpriteBank * spriteBank, s32 spriteId, const core::position2d<s32> &hotspot=(core::position2d<s32>(0,0)) )
: SpriteBank(spriteBank), SpriteId(spriteId), HotSpot(hotspot)
{
}
IGUISpriteBank * SpriteBank;
s32 SpriteId;
core::position2d<s32> HotSpot;
};
enum ECURSOR_PLATFORM_BEHAVIOR
{
ECPB_NONE = 0,
ECPB_X11_CACHE_UPDATES = 1
};
class ICursorControl : public virtual IReferenceCounted
{
public:
virtual void setVisible(bool visible) = 0;
virtual bool isVisible() const = 0;
virtual void setPosition(const core::position2d<f32> &pos) = 0;
virtual void setPosition(f32 x, f32 y) = 0;
virtual void setPosition(const core::position2d<s32> &pos) = 0;
virtual void setPosition(s32 x, s32 y) = 0;
virtual const core::position2d<s32>& getPosition() = 0;
virtual core::position2d<f32> getRelativePosition() = 0;
virtual void setReferenceRect(core::rect<s32>* rect=0) = 0;
virtual void setActiveIcon(ECURSOR_ICON iconId) {}
virtual ECURSOR_ICON getActiveIcon() const { return gui::ECI_NORMAL; }
virtual ECURSOR_ICON addIcon(const gui::SCursorSprite& icon) { return gui::ECI_NORMAL; }
virtual void changeIcon(ECURSOR_ICON iconId, const gui::SCursorSprite& sprite) {}
virtual core::dimension2di getSupportedIconSize() const { return core::dimension2di(0,0); }
virtual void setPlatformBehavior(ECURSOR_PLATFORM_BEHAVIOR behavior) {}
virtual ECURSOR_PLATFORM_BEHAVIOR getPlatformBehavior() const { return ECPB_NONE; }
};
} // end namespace gui
} // end namespace irr
#endif
IReferenceCounted.h
irr::IReferenceCounted::IReferenceCounted
IReferenceCounted()
Constructor.
Definition IReferenceCounted.h:46
irr::core::rect
Rectangle template.
Definition rect.h:27
irr::gui::ICursorControl
Interface to manipulate the mouse cursor.
Definition ICursorControl.h:98
irr::gui::ICursorControl::getSupportedIconSize
virtual core::dimension2di getSupportedIconSize() const
Return a system-specific size which is supported for cursors. Larger icons will fail,...
Definition ICursorControl.h:176
irr::gui::ICursorControl::addIcon
virtual ECURSOR_ICON addIcon(const gui::SCursorSprite &icon)
Add a custom sprite as cursor icon.
Definition ICursorControl.h:166
irr::gui::ICursorControl::setReferenceRect
virtual void setReferenceRect(core::rect< s32 > *rect=0)=0
Sets an absolute reference rect for setting and retrieving the cursor position.
irr::gui::ICursorControl::setPosition
virtual void setPosition(s32 x, s32 y)=0
Sets the new position of the cursor.
irr::gui::ICursorControl::changeIcon
virtual void changeIcon(ECURSOR_ICON iconId, const gui::SCursorSprite &sprite)
replace a cursor icon.
Definition ICursorControl.h:173
irr::gui::ICursorControl::setPosition
virtual void setPosition(const core::position2d< s32 > &pos)=0
Sets the new position of the cursor.
irr::gui::ICursorControl::setPosition
virtual void setPosition(const core::position2d< f32 > &pos)=0
Sets the new position of the cursor.
irr::gui::ICursorControl::getPlatformBehavior
virtual ECURSOR_PLATFORM_BEHAVIOR getPlatformBehavior() const
Return platform specific behavior.
Definition ICursorControl.h:184
irr::gui::ICursorControl::getPosition
virtual const core::position2d< s32 > & getPosition()=0
Returns the current position of the mouse cursor.
irr::gui::ICursorControl::setVisible
virtual void setVisible(bool visible)=0
Changes the visible state of the mouse cursor.
irr::gui::ICursorControl::setPlatformBehavior
virtual void setPlatformBehavior(ECURSOR_PLATFORM_BEHAVIOR behavior)
Set platform specific behavior flags.
Definition ICursorControl.h:179
irr::gui::ICursorControl::setPosition
virtual void setPosition(f32 x, f32 y)=0
Sets the new position of the cursor.
irr::gui::ICursorControl::isVisible
virtual bool isVisible() const =0
Returns if the cursor is currently visible.
irr::gui::ICursorControl::getActiveIcon
virtual ECURSOR_ICON getActiveIcon() const
Gets the currently active icon.
Definition ICursorControl.h:162
irr::gui::ICursorControl::setActiveIcon
virtual void setActiveIcon(ECURSOR_ICON iconId)
Sets the active cursor icon.
Definition ICursorControl.h:159
irr::gui::ICursorControl::getRelativePosition
virtual core::position2d< f32 > getRelativePosition()=0
Returns the current position of the mouse cursor.
irr::gui::IGUISpriteBank
Sprite bank interface.
Definition IGUISpriteBank.h:46
irr::core::dimension2di
dimension2d< s32 > dimension2di
Typedef for an integer dimension.
Definition dimension2d.h:217
irr::gui
The gui namespace contains useful classes for easy creation of a graphical user interface.
Definition EGUIAlignment.h:11
irr::gui::GUICursorIconNames
const c8 *const GUICursorIconNames[ECI_COUNT+1]
Names for ECURSOR_ICON.
Definition ICursorControl.h:45
irr::gui::ECURSOR_PLATFORM_BEHAVIOR
ECURSOR_PLATFORM_BEHAVIOR
platform specific behavior flags for the cursor
Definition ICursorControl.h:83
irr::gui::ECPB_X11_CACHE_UPDATES
@ ECPB_X11_CACHE_UPDATES
On X11 try caching cursor updates as XQueryPointer calls can be expensive.
Definition ICursorControl.h:93
irr::gui::ECPB_NONE
@ ECPB_NONE
default - no platform specific behavior
Definition ICursorControl.h:85
irr::gui::ECURSOR_ICON
ECURSOR_ICON
Default icons for cursors.
Definition ICursorControl.h:21
irr::gui::ECI_NORMAL
@ ECI_NORMAL
Definition ICursorControl.h:23
irr::gui::ECI_CROSS
@ ECI_CROSS
Definition ICursorControl.h:24
irr::gui::ECI_IBEAM
@ ECI_IBEAM
Definition ICursorControl.h:27
irr::gui::ECI_HAND
@ ECI_HAND
Definition ICursorControl.h:25
irr::gui::ECI_WAIT
@ ECI_WAIT
Definition ICursorControl.h:29
irr::gui::ECI_COUNT
@ ECI_COUNT
Definition ICursorControl.h:41
irr::gui::ECI_HELP
@ ECI_HELP
Definition ICursorControl.h:26
irr::gui::ECI_SIZENWSE
@ ECI_SIZENWSE
Definition ICursorControl.h:32
irr::gui::ECI_SIZENESW
@ ECI_SIZENESW
Definition ICursorControl.h:31
irr::gui::ECI_UP
@ ECI_UP
Definition ICursorControl.h:35
irr::gui::ECI_SIZEALL
@ ECI_SIZEALL
Definition ICursorControl.h:30
irr::gui::ECI_SIZENS
@ ECI_SIZENS
Definition ICursorControl.h:33
irr::gui::ECI_SIZEWE
@ ECI_SIZEWE
Definition ICursorControl.h:34
irr::gui::ECI_NO
@ ECI_NO
Definition ICursorControl.h:28
irr
Everything in the Irrlicht Engine can be found in this namespace.
Definition aabbox3d.h:13
irr::f32
float f32
32 bit floating point variable.
Definition irrTypes.h:104
irr::c8
char c8
8 bit character variable.
Definition irrTypes.h:31
irr::s32
signed int s32
32 bit signed variable.
Definition irrTypes.h:66
position2d.h
rect.h
irr::gui::SCursorSprite
structure used to set sprites as cursors.
Definition ICursorControl.h:65
irr::gui::SCursorSprite::SCursorSprite
SCursorSprite(gui::IGUISpriteBank *spriteBank, s32 spriteId, const core::position2d< s32 > &hotspot=(core::position2d< s32 >(0, 0)))
Definition ICursorControl.h:71
irr::gui::SCursorSprite::SCursorSprite
SCursorSprite()
Definition ICursorControl.h:66
irr::gui::SCursorSprite::SpriteId
s32 SpriteId
Definition ICursorControl.h:77
irr::gui::SCursorSprite::SpriteBank
IGUISpriteBank * SpriteBank
Definition ICursorControl.h:76
irr::gui::SCursorSprite::HotSpot
core::position2d< s32 > HotSpot
Definition ICursorControl.h:78
- Irrlicht Engine Documentation © 2003-2012 by Nikolaus Gebhardt. Generated on for Irrlicht 3D Engine by Doxygen 1.15.0