MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
|
#include <AbstractButton.h>
Public Member Functions | |
AbstractButton () | |
AbstractButton (const char *text) | |
AbstractButton (SDL_Surface *icon) | |
AbstractButton (const char *text, SDL_Surface *icon) | |
~AbstractButton () | |
void | SetLocation (const SPoint &location) |
void | SetIcon (SDL_Surface *icon) |
SDL_Surface * | GetIcon () |
void | SetDimensions (const SPoint &dimensions) |
void | SetEnabled (bool isEnabled) |
void | SetText (const char *text) |
const char * | GetText () |
bool | IsEnabled () const |
bool | Contains (SPoint &pt) |
virtual bool | Handle (MouseButtonEvent &event) |
virtual void | HandleResize (const UPoint &parentSize) |
bool | PaintClickHighlight (Drawing &d) |
virtual void | PaintComponentNonClick (Drawing &d) |
virtual void | PaintComponent (Drawing &d) |
virtual void | OnClick (u8 button)=0 |
virtual void | OnPress (u8 button) |
![]() | |
Panel (u32 width=0, u32 height=0) | |
void | Insert (Panel *child, Panel *afterOrNull) |
Panel * | Pop () |
void | Remove (Panel *child) |
void | SetVisibility (bool value) |
void | ToggleVisibility () |
bool | IsVisible () |
u32 | GetWidth () const |
u32 | GetHeight () const |
void | SetDimensions (u32 width, u32 height) |
void | SetDesiredSize (u32 width, u32 height) |
const UPoint & | GetDimensions () const |
const UPoint & | GetDesiredSize () const |
void | SetRenderPoint (const SPoint &renderPt) |
const SPoint & | GetRenderPoint () const |
const char * | GetName () const |
void | SetName (const char *name) |
void | Print (ByteSink &sink, u32 indent=0) const |
u32 | GetBackground () const |
u32 | SetBackground (const u32 color) |
u32 | GetBorder () const |
u32 | SetBorder (const u32 color) |
u32 | GetForeground () const |
u32 | SetForeground (const u32 color) |
TTF_Font * | GetFont () const |
TTF_Font * | SetFont (TTF_Font *newFont) |
SPoint | GetAbsoluteLocation () |
virtual void | Paint (Drawing &config) |
virtual void | PaintUpdateVisibility (Drawing &config) |
virtual void | PaintBorder (Drawing &config) |
virtual void | PaintChildren (Drawing &config) |
virtual bool | Dispatch (MouseEvent &event, const Rect &rect) |
virtual bool | Handle (MouseMotionEvent &event) |
virtual void | OnMouseExit () |
void | SetAnchor (const GUIAnchor anchor) |
SPoint | GetTextSize (TTF_Font *font, const char *text) |
Additional Inherited Members | |
![]() | |
static void | Indent (ByteSink &sink, u32 count) |
![]() | |
OString16 | m_name |
Rect | m_rect |
u32 | m_bdColor |
u32 | m_bgColor |
u32 | m_fgColor |
TTF_Font * | m_font |
UPoint | m_desiredSize |
SPoint | m_desiredLocation |
Panel * | m_parent |
Panel * | m_top |
Panel * | m_forward |
Panel * | m_backward |
Panel * | m_focusedChild |
bool | m_visible |
A Panel which behaves as a button, built with abstract behavior upon clicks.
MFM::AbstractButton::AbstractButton | ( | ) |
Constructs an AbstractButton with default parameters and default coloring scheme.
MFM::AbstractButton::AbstractButton | ( | const char * | text | ) |
Constructs an AbstractButton with given text to be rendered upon it and default coloring scheme.
text | The text to render on top of this AbstractButton upon rendering. |
MFM::AbstractButton::AbstractButton | ( | SDL_Surface * | icon | ) |
Constructs an AbstractButton with a given icon to be rendered instead of the default rendering scheme.
icon | A pointer to the SDL_Surface which will be rendered upon rendering of this AbstactButton. |
MFM::AbstractButton::AbstractButton | ( | const char * | text, |
SDL_Surface * | icon | ||
) |
Constructs an AbstractButton with a given string and a given icon. Upon rendering, The icon will be rendered, then the string will be rendered on top of it.
text | The string to render on top of this AbstractButton upon rendering. |
icon | The icon which will render as this AbstractButton upon rendering. |
MFM::AbstractButton::~AbstractButton | ( | ) |
Deconstructs this AbstractButton.
bool MFM::AbstractButton::Contains | ( | SPoint & | pt | ) |
Checks to see whether or not a given SPoint lies within the bounds of this AbstractButton. This is used during mouse hit processing to see whether or not this AbstractButton has been clicked on.
pt | The SPoint in question of existing within the bounds of this AbstractButton. |
|
inline |
Gets the icon that is currently being rendered by this AbstractButton .
|
inline |
Gets the text that is currently being rendered on top of this AbstractButton upon rendering.
|
inlinevirtual |
Respond to a MouseButtonEvent (this includes scroll wheel events).
Reimplemented from MFM::Panel.
|
inlinevirtual |
Respond to the resizing of this panel's parent.
Reimplemented from MFM::Panel.
|
inline |
Checks to see whether or not this AbstractButton is enabled and is therefore responding to mouse hits.
true
if this AbstractButton is enabled and is therefore responding to mouse hits, else false
.
|
pure virtual |
Pure abstract behavior method. This is called if this AbstractButton is enabled and has decided that it has been clicked on . Overriding this method allows the subclass of this AbstractButton to behave in any way it pleases upon being clicked.
button | The SDL mouse button that has been pressed to generate this mouse hit, i.e. SDL_BUTTON_LEFT , SDL_BUTTON_MIDDLE, or SDL_BUTTON_RIGHT . |
Implemented in MFM::AbstractGUIDriver< GC >::PauseTileButton, MFM::AbstractGUIDriver< GC >::ReloadButton, MFM::AbstractGUIDriver< GC >::QuitButton, MFM::AbstractGUIDriver< GC >::ScreenshotButton, MFM::AbstractGUIDriver< GC >::SaveButton, MFM::AbstractGUIDriver< GC >::TileViewButton, MFM::AbstractGUIDriver< GC >::GridStepCheckbox, MFM::AbstractGUIDriver< GC >::XRayButton, MFM::AbstractGUIDriver< GC >::NukeButton, MFM::AbstractGUIDriver< GC >::ClearGridButton, MFM::AbstractGUIDriver< GC >::ClearButton, and MFM::AbstractCheckbox.
|
inlinevirtual |
This is called when this AbstractButton is enabled and has decided the button is pressed on it . Overriding this method allows the subclass of this AbstractButton to behave in any way it pleases upon button down.
button | The SDL mouse button that has been pressed to generate this mouse hit, i.e. SDL_BUTTON_LEFT , SDL_BUTTON_MIDDLE, or SDL_BUTTON_RIGHT . |
|
virtual |
Paint the component itself, excluding its border and any children it may have. The default implementation (which may be accessed, if overridden, via this->Panel::PaintComponent) sets the drawing foreground and background colors to the panel colors, and Clear()s the Panel.
Reimplemented from MFM::Panel.
Reimplemented in MFM::AbstractCheckbox.
|
inline |
Sets the size of this AbstractButton which will affect how it is rendered on the screen and how mouse hits are processed.
dimensions | The new size of this AbstractButton . |
|
inline |
Sets whether or not this AbstractButton will be enabled, and therefore whether or not it will respond to mouse hits.
isEnabled | If true , will allow this AbstractButton to respond to mouse hits. If false , will disable this feature. |
|
inline |
Sets the icon of this AbstractButton which will render in its place upon rendering.
icon | A pointer to the SDL_Surface which will render upon rendering of this AbstractButton. |
|
inline |
Sets the location of this AbstractButton, relative to the Panel which it is located inside of, at which to render this AbstractButton and process mouse hits.
location | The new location that this AbstractButton will reside at. |
|
inline |
Sets the text that will be rendered on top of this AbstractButton upon rendering.
text | The new text that will be rendered on top of this AbstractButton upon rendering. |