ManaPlus
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes
DropDown Class Reference

#include <dropdown.h>

Inheritance diagram for DropDown:
ActionListener BasicContainer KeyListener MouseListener FocusListener SelectionListener Widget WidgetDeathListener Widget2

Public Member Functions

 DropDown (const Widget2 *const widget, ListModel *const listModel, const bool extended, const Modal modal, ActionListener *const listener, const std::string &eventId)
 
 ~DropDown ()
 
void updateAlpha ()
 
void draw (Graphics *const graphics)
 
void safeDraw (Graphics *const graphics)
 
void drawFrame (Graphics *const graphics)
 
void safeDrawFrame (Graphics *const graphics)
 
void keyPressed (KeyEvent &event)
 
void mousePressed (MouseEvent &event)
 
void mouseReleased (MouseEvent &event)
 
void mouseDragged (MouseEvent &event)
 
void mouseWheelMovedUp (MouseEvent &event)
 
void mouseWheelMovedDown (MouseEvent &event)
 
void setSelectedString (const std::string &str)
 
std::string getSelectedString () const
 
void valueChanged (const SelectionEvent &event)
 
void updateSelection ()
 
void adjustHeight ()
 
void dropDown ()
 
void foldUp ()
 
void hideDrop (bool event)
 
int getSelected () const
 
void setSelected (int selected)
 
void setListModel (ListModel *const listModel)
 
ListModelgetListModel ()
 
void addSelectionListener (SelectionListener *listener)
 
void removeSelectionListener (SelectionListener *selectionListener)
 
Rect getChildrenArea ()
 
void action (const ActionEvent &actionEvent)
 
void distributeValueChangedEvent ()
 
- Public Member Functions inherited from ActionListener
virtual ~ActionListener ()
 
- Public Member Functions inherited from BasicContainer
 BasicContainer (const Widget2 *const widget)
 
 ~BasicContainer ()
 
void showWidgetPart (Widget *const widget, const Rect &area)
 
void moveToTop (Widget *const widget)
 
void moveToBottom (Widget *const widget)
 
void focusNext ()
 
void focusPrevious ()
 
void logic ()
 
void setFocusHandler (FocusHandler *const focusHandler)
 
void setInternalFocusHandler (FocusHandler *const focusHandler)
 
WidgetgetWidgetAt (int x, int y)
 
void death (const Event &event)
 
WidgetfindFirstWidget (const std::set< Widget *> &list)
 
void add (Widget *const widget)
 
virtual void remove (Widget *const widget)
 
virtual void clear ()
 
- Public Member Functions inherited from Widget
 Widget (const Widget2 *const widget)
 
 ~Widget ()
 
void setFrameSize (const unsigned int frameSize)
 
unsigned int getFrameSize () const
 
WidgetgetParent () const
 
void setWidth (const int width)
 
int getWidth () const
 
void setHeight (const int height)
 
int getHeight () const
 
void setSize (const int width, const int height)
 
void setX (const int x)
 
int getX () const
 
void setY (const int y)
 
int getY () const
 
void setPosition (const int x, const int y)
 
void setDimension (const Rect &dimension)
 
const RectgetDimension () const
 
void setFocusable (const bool focusable)
 
bool isFocusable () const
 
virtual bool isFocused () const
 
void setEnabled (const bool enabled)
 
bool isEnabled () const
 
void setVisible (Visible visible)
 
bool isVisible () const
 
void setBaseColor (const Color &color)
 
const ColorgetBaseColor () const
 
void setForegroundColor (const Color &color)
 
const ColorgetForegroundColor () const
 
void setBackgroundColor (const Color &color)
 
const ColorgetBackgroundColor () const
 
virtual void requestFocus ()
 
virtual void requestMoveToTop ()
 
virtual void requestMoveToBottom ()
 
FocusHandlergetFocusHandler ()
 
void addActionListener (ActionListener *const actionListener)
 
void removeActionListener (ActionListener *const actionListener)
 
void addDeathListener (WidgetDeathListener *const deathListener)
 
void removeDeathListener (WidgetDeathListener *const deathListener)
 
void addMouseListener (MouseListener *const mouseListener)
 
void removeMouseListener (MouseListener *const mouseListener)
 
void addKeyListener (KeyListener *const keyListener)
 
void removeKeyListener (KeyListener *const keyListener)
 
void addFocusListener (FocusListener *const focusListener)
 
void removeFocusListener (FocusListener *const focusListener)
 
void addWidgetListener (WidgetListener *const widgetListener)
 
void removeWidgetListener (WidgetListener *const widgetListener)
 
void setActionEventId (const std::string &actionEventId)
 
const std::string & getActionEventId () const
 
virtual void getAbsolutePosition (int &x, int &y) const
 
virtual void setParent (Widget *parent)
 
FontgetFont () const
 
void setFont (Font *const font)
 
virtual void fontChanged ()
 
bool isTabInEnabled () const
 
void setTabInEnabled (const bool enabled)
 
bool isTabOutEnabled () const
 
void setTabOutEnabled (const bool enabled)
 
void requestModalFocus ()
 
virtual void requestModalMouseInputFocus ()
 
virtual void releaseModalFocus ()
 
virtual void releaseModalMouseInputFocus ()
 
virtual bool isModalFocused () const
 
virtual bool isModalMouseInputFocused () const
 
const std::list< MouseListener * > & getMouseListeners () const A_CONST
 
const std::list< KeyListener * > & getKeyListeners () const A_CONST
 
const std::list< FocusListener * > & getFocusListeners () const A_CONST
 
virtual FocusHandlergetInternalFocusHandler ()
 
void setInternalFocusHandler (FocusHandler *const internalFocusHandler)
 
void setId (const std::string &id)
 
const std::string & getId () const
 
virtual void showPart (const Rect &rectangle)
 
bool isAllowLogic () const
 
void setMouseConsume (const bool b)
 
bool isMouseConsume () const
 
void setRedraw (const bool b)
 
virtual bool isSelectable () const
 
void setSelectable (const bool selectable)
 
void windowResized ()
 
virtual void postInit ()
 
- Public Member Functions inherited from Widget2
virtual ~Widget2 ()
 
const ColorgetThemeColor (const ThemeColorIdT type, const unsigned int alpha) const A_INLINE
 
const ColorgetThemeCharColor (const signed char c, bool &valid) const A_INLINE
 
virtual void setWidget2 (const Widget2 *const widget)
 
void setPalette (int palette)
 
void checkPalette ()
 
void setForegroundColor2 (const Color &color)
 
WidgetgetWindow () const
 
virtual void setWindow (Widget *const window)
 
- Public Member Functions inherited from WidgetDeathListener
virtual ~WidgetDeathListener ()
 
- Public Member Functions inherited from KeyListener
virtual ~KeyListener ()
 
virtual void keyReleased (KeyEvent &event)
 
- Public Member Functions inherited from MouseListener
virtual ~MouseListener ()
 
virtual void mouseEntered (MouseEvent &event)
 
virtual void mouseExited (MouseEvent &event)
 
virtual void mouseClicked (MouseEvent &event)
 
virtual void mouseMoved (MouseEvent &event)
 
- Public Member Functions inherited from FocusListener
virtual ~FocusListener ()
 
virtual void focusGained (const Event &event)
 
virtual void focusLost (const Event &event)
 
- Public Member Functions inherited from SelectionListener
virtual ~SelectionListener ()
 

Protected Types

typedef std::list< SelectionListener * > SelectionListenerList
 
typedef SelectionListenerList::iterator SelectionListenerIterator
 
- Protected Types inherited from BasicContainer
typedef std::vector< Widget * > WidgetList
 
typedef WidgetList::iterator WidgetListIterator
 
typedef WidgetList::const_iterator WidgetListConstIterator
 
typedef WidgetList::reverse_iterator WidgetListReverseIterator
 
typedef WidgetList::const_reverse_iterator WidgetListCReverseIterator
 
- Protected Types inherited from Widget
typedef std::list< MouseListener * > MouseListenerList
 
typedef MouseListenerList::iterator MouseListenerIterator
 
typedef std::list< KeyListener * > KeyListenerList
 
typedef KeyListenerList::iterator KeyListenerIterator
 
typedef std::list< ActionListener * > ActionListenerList
 
typedef ActionListenerList::iterator ActionListenerIterator
 
typedef std::list< WidgetDeathListener * > WidgetDeathListenerList
 
typedef WidgetDeathListenerList::iterator WidgetDeathListenerIterator
 
typedef std::list< FocusListener * > FocusListenerList
 
typedef FocusListenerList::iterator FocusListenerIterator
 
typedef std::list< WidgetListener * > WidgetListenerList
 
typedef WidgetListenerList::iterator WidgetListenerIterator
 

Protected Member Functions

void drawButton (Graphics *const graphics)
 
- Protected Member Functions inherited from ActionListener
 ActionListener ()
 
- Protected Member Functions inherited from BasicContainer
virtual void drawChildren (Graphics *const graphics)
 
virtual void safeDrawChildren (Graphics *const graphics)
 
virtual void logicChildren ()
 
- Protected Member Functions inherited from Widget
void distributeActionEvent ()
 
void distributeResizedEvent ()
 
void distributeMovedEvent ()
 
void distributeHiddenEvent ()
 
void distributeShownEvent ()
 
- Protected Member Functions inherited from Widget2
 Widget2 (const Widget2 *const widget)
 
- Protected Member Functions inherited from WidgetDeathListener
 WidgetDeathListener ()
 
- Protected Member Functions inherited from KeyListener
 KeyListener ()
 
- Protected Member Functions inherited from MouseListener
 MouseListener ()
 
- Protected Member Functions inherited from FocusListener
 FocusListener ()
 
- Protected Member Functions inherited from SelectionListener
 SelectionListener ()
 

Protected Attributes

PopupListmPopup
 
Color mShadowColor
 
Color mHighlightColor
 
int mPadding
 
int mImagePadding
 
int mSpacing
 
int mFoldedUpHeight
 
SelectionListenerList mSelectionListeners
 
bool mExtended
 
bool mDroppedDown
 
bool mPushed
 
bool mIsDragged
 
- Protected Attributes inherited from BasicContainer
WidgetList mWidgets
 
WidgetList mLogicWidgets
 
- Protected Attributes inherited from Widget
MouseListenerList mMouseListeners
 
KeyListenerList mKeyListeners
 
ActionListenerList mActionListeners
 
WidgetDeathListenerList mDeathListeners
 
FocusListenerList mFocusListeners
 
WidgetListenerList mWidgetListeners
 
Color mForegroundColor
 
Color mBackgroundColor
 
Color mBaseColor
 
Rect mDimension
 
std::string mActionEventId
 
std::string mId
 
FocusHandlermFocusHandler
 
FocusHandlermInternalFocusHandler
 
WidgetmParent
 
FontmCurrentFont
 
unsigned int mFrameSize
 
bool mFocusable
 
bool mTabIn
 
bool mTabOut
 
bool mEnabled
 
bool mAllowLogic
 
bool mMouseConsume
 
bool mRedraw
 
bool mSelectable
 
- Protected Attributes inherited from Widget2
int mPaletteOffset
 
WidgetmWindow
 
Color mForegroundColor2
 

Static Protected Attributes

static int instances = 0
 
static Imagebuttons [2][2]
 
static ImageRect skinRect
 
static float mAlpha = 1.0
 
static SkinmSkin = 0
 
- Static Protected Attributes inherited from Widget
static FontmGlobalFont = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from Widget
static void setGlobalFont (Font *const font)
 
static FontgetGloablFont ()
 
static void cleanGlobalFont ()
 
static bool widgetExists (const Widget *const widget)
 
static void distributeWindowResizeEvent ()
 
static WidgetcallPostInit (Widget *const widget)
 
- Data Fields inherited from Widget
Visible mVisible
 

Detailed Description

A drop down box from which you can select different values.

A ListModel provides the contents of the drop down. To be able to use DropDown you must give DropDown an implemented ListModel which represents your list.

Definition at line 50 of file dropdown.h.

Member Typedef Documentation

◆ SelectionListenerIterator

typedef SelectionListenerList::iterator DropDown::SelectionListenerIterator
protected

Definition at line 151 of file dropdown.h.

◆ SelectionListenerList

typedef std::list<SelectionListener*> DropDown::SelectionListenerList
protected

Definition at line 149 of file dropdown.h.

Constructor & Destructor Documentation

◆ DropDown()

DropDown::DropDown ( const Widget2 *const  widget,
ListModel *const  listModel,
const bool  extended,
const Modal  modal,
ActionListener *const  listener,
const std::string &  eventId 
)

Definition at line 55 of file dropdown.cpp.

References Widget::addActionListener(), Widget::addFocusListener(), Widget::addKeyListener(), Widget::addMouseListener(), adjustHeight(), PopupList::adjustSize(), buttons, CAST_U32, ThemeColorId::DROPDOWN, ThemeColorId::DROPDOWN_OUTLINE, dropdownFiles, Skin::getBorder(), Skin::getOption(), Skin::getPadding(), PopupList::getSelected(), Widget2::getThemeColor(), Theme::getThemePath(), ImageRect::grid, Resource::incRef(), instances, Theme::load(), Theme::loadRect(), Widget::mAllowLogic, mAlpha, Widget::mForegroundColor, Widget2::mForegroundColor2, Widget::mFrameSize, mImagePadding, mPadding, mPopup, mSkin, mSpacing, Widget::setActionEventId(), Image::setAlpha(), Widget::setFocusable(), Widget::setHeight(), setListModel(), PopupList::setSelected(), Widget::setWidth(), skinRect, theme, and Theme::unload().

60  :
62  BasicContainer(widget),
63  KeyListener(),
64  MouseListener(),
65  FocusListener(),
67  mPopup(CREATEWIDGETR(PopupList, this, listModel, isExtended, modal)),
70  mPadding(1),
71  mImagePadding(2),
72  mSpacing(0),
73  mFoldedUpHeight(0),
75  mExtended(isExtended),
76  mDroppedDown(false),
77  mPushed(false),
78  mIsDragged(false)
79 {
80  mAllowLogic = false;
81  mFrameSize = 2;
83 
84  mPopup->setHeight(100);
85 
86  // Initialize graphics
87  if (instances == 0 && (theme != nullptr))
88  {
89  // Load the background skin
90  for (int i = 0; i < 2; i ++)
91  {
92  Skin *const skin = theme->load(dropdownFiles[i],
93  "dropdown.xml",
94  true,
96  if (skin != nullptr)
97  {
98  if (i == 0)
99  mSkin = skin;
100  const ImageRect &rect = skin->getBorder();
101  for (int f = 0; f < 2; f ++)
102  {
103  if (rect.grid[f] != nullptr)
104  {
105  rect.grid[f]->incRef();
106  buttons[f][i] = rect.grid[f];
107  buttons[f][i]->setAlpha(mAlpha);
108  }
109  else
110  {
111  buttons[f][i] = nullptr;
112  }
113  }
114  if (i != 0)
115  theme->unload(skin);
116  }
117  else
118  {
119  for (int f = 0; f < 2; f ++)
120  buttons[f][i] = nullptr;
121  }
122  }
123 
124  // get the border skin
125  theme->loadRect(skinRect, "dropdown_background.xml", "", 0, 8);
126  }
127 
128  instances++;
129 
130  setWidth(100);
131  setFocusable(true);
132  setListModel(listModel);
133 
134  if (mPopup->getSelected() < 0)
135  mPopup->setSelected(0);
136 
137  addMouseListener(this);
138  addKeyListener(this);
139  addFocusListener(this);
140 
141  adjustHeight();
142 // mPopup->setForegroundColorAll(getThemeColor(ThemeColorId::DROPDOWN,
143 // 255U),
144 // getThemeColor(ThemeColorId::DROPDOWN_OUTLINE, 255U));
147 
148  if (!eventId.empty())
149  setActionEventId(eventId);
150 
151  if (listener != nullptr)
152  addActionListener(listener);
153 
154  mPopup->adjustSize();
155 
156  if (mSkin != nullptr)
157  {
158  mSpacing = mSkin->getOption("spacing");
159  mFrameSize = CAST_U32(mSkin->getOption("frameSize"));
161  mImagePadding = mSkin->getOption("imagePadding");
162  }
163  adjustHeight();
164 }
#define CAST_U32
Definition: cast.h:30
void setSelected(const int selected)
Definition: popuplist.cpp:106
int mFoldedUpHeight
Definition: dropdown.h:147
void loadRect(ImageRect &image, const std::string &name, const std::string &name2, const int start, const int end)
Definition: theme.cpp:882
int getSelected() const
Definition: popuplist.cpp:114
Definition: skin.h:35
void setWidth(const int width)
Definition: widget.cpp:132
void unload(Skin *const skin)
Definition: theme.cpp:249
Color mHighlightColor
Definition: dropdown.h:143
Color mShadowColor
Definition: dropdown.h:142
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:251
SelectionListenerList mSelectionListeners
Definition: dropdown.h:150
void addFocusListener(FocusListener *const focusListener)
Definition: widget.cpp:281
static std::string getThemePath()
Definition: theme.h:66
Skin * load(const std::string &filename, const std::string &filename2, const bool full, const std::string &defaultPath)
Definition: theme.cpp:178
void setActionEventId(const std::string &actionEventId)
Definition: widget.h:595
Color mForegroundColor
Definition: widget.h:1085
int getOption(const std::string &name) const
Definition: skin.h:105
static int instances
Definition: dropdown.h:159
static Skin * mSkin
Definition: dropdown.h:163
PopupList * mPopup
Definition: dropdown.h:141
virtual void setAlpha(const float alpha)
Definition: image.cpp:286
int getPadding() const
Definition: skin.h:99
bool mDroppedDown
Definition: dropdown.h:154
void setListModel(ListModel *const listModel)
Definition: dropdown.cpp:520
int mPadding
Definition: dropdown.h:144
const ImageRect & getBorder() const
Definition: skin.h:67
Image * grid[9]
Definition: imagerect.h:41
void adjustHeight()
Definition: dropdown.cpp:470
unsigned int mFrameSize
Definition: widget.h:1137
bool mAllowLogic
Definition: widget.h:1159
void addMouseListener(MouseListener *const mouseListener)
Definition: widget.cpp:291
void addKeyListener(KeyListener *const keyListener)
Definition: widget.cpp:271
bool mIsDragged
Definition: dropdown.h:156
bool mPushed
Definition: dropdown.h:155
void setHeight(const int height)
Definition: widget.cpp:139
virtual void incRef()
Definition: resource.cpp:37
Theme * theme
Definition: theme.cpp:61
void setFocusable(const bool focusable)
Definition: widget.cpp:191
Color mForegroundColor2
Definition: widget2.h:112
static ImageRect skinRect
Definition: dropdown.h:161
const Color & getThemeColor(const ThemeColorIdT type, const unsigned int alpha) const A_INLINE
Definition: widget2.h:44
static Image * buttons[2][2]
Definition: dropdown.h:160
#define CREATEWIDGETR(type,...)
Definition: createwidget.h:35
void adjustSize()
Definition: popuplist.cpp:129
BasicContainer(const Widget2 *const widget)
int mSpacing
Definition: dropdown.h:146
bool mExtended
Definition: dropdown.h:153
static float mAlpha
Definition: dropdown.h:162
int mImagePadding
Definition: dropdown.h:145

◆ ~DropDown()

DropDown::~DropDown ( )

Definition at line 166 of file dropdown.cpp.

References buttons, Image::decRef(), gui, instances, mSkin, Gui::removeDragged(), skinRect, theme, Theme::unload(), and Theme::unloadRect().

167 {
168  if (gui != nullptr)
169  gui->removeDragged(this);
170 
171  instances--;
172  if (instances == 0)
173  {
174  for (int f = 0; f < 2; f ++)
175  {
176  for (int i = 0; i < 2; i ++)
177  {
178  if (buttons[f][i] != nullptr)
179  buttons[f][i]->decRef();
180  }
181  }
182  if (theme != nullptr)
183  {
184  theme->unload(mSkin);
186  }
187  }
188 }
void unload(Skin *const skin)
Definition: theme.cpp:249
Gui * gui
Definition: gui.cpp:110
static int instances
Definition: dropdown.h:159
static Skin * mSkin
Definition: dropdown.h:163
Theme * theme
Definition: theme.cpp:61
void removeDragged(const Widget *const widget)
Definition: gui.cpp:1160
static ImageRect skinRect
Definition: dropdown.h:161
static Image * buttons[2][2]
Definition: dropdown.h:160
static void unloadRect(const ImageRect &rect, const int start, const int end)
Definition: theme.cpp:914
void decRef()
Definition: image.cpp:522

Member Function Documentation

◆ action()

void DropDown::action ( const ActionEvent actionEvent)
virtual

Called when an action is recieved from a widget. It is used to be able to recieve a notification that an action has occured.

Parameters
actionEventThe event of the action.

Implements ActionListener.

Definition at line 535 of file dropdown.cpp.

References Widget::distributeActionEvent(), and foldUp().

536 {
537  foldUp();
539 }
void distributeActionEvent()
Definition: widget.cpp:492
void foldUp()
Definition: dropdown.cpp:500

◆ addSelectionListener()

void DropDown::addSelectionListener ( SelectionListener listener)

Definition at line 565 of file dropdown.cpp.

References mSelectionListeners.

566 {
567  mSelectionListeners.push_back(selectionListener);
568 }
SelectionListenerList mSelectionListeners
Definition: dropdown.h:150

◆ adjustHeight()

void DropDown::adjustHeight ( )

Definition at line 470 of file dropdown.cpp.

References Widget::getFont(), Widget::getHeight(), mPadding, and Widget::setHeight().

Referenced by DropDown(), dropDown(), foldUp(), setListModel(), Setup_Relations::Setup_Relations(), Setup_Theme::Setup_Theme(), and Setup_Relations::updateAll().

471 {
472  setHeight(getFont()->getHeight() + 2 * mPadding);
473 }
Font * getFont() const
Definition: widget.cpp:330
int mPadding
Definition: dropdown.h:144
void setHeight(const int height)
Definition: widget.cpp:139
int getHeight() const
Definition: widget.h:239

◆ distributeValueChangedEvent()

void DropDown::distributeValueChangedEvent ( )

Definition at line 575 of file dropdown.cpp.

References mSelectionListeners.

Referenced by updateSelection().

576 {
578  iter != mSelectionListeners.end();
579  ++iter)
580  {
581  SelectionEvent event(this);
582  (*iter)->valueChanged(event);
583  }
584 }
SelectionListenerList mSelectionListeners
Definition: dropdown.h:150
SelectionListenerList::iterator SelectionListenerIterator
Definition: dropdown.h:151

◆ draw()

void DropDown::draw ( Graphics *const  graphics)
virtual

Draws the widget. It is called by the parent widget when it is time for the widget to draw itself. The graphics object is set up so that all drawing is relative to the widget, i.e coordinate (0,0) is the top left corner of the widget. It is not possible to draw outside of a widget's dimension.

Parameters
graphicsaA graphics object to draw with.

Implements Widget.

Definition at line 216 of file dropdown.cpp.

References Color::a, BLOCK_END, BLOCK_START, CAST_U32, drawButton(), Graphics::drawImage(), Graphics::drawLine(), Graphics::drawRectangle(), Font::drawString(), ServerCommandType::font, ListModel::getElementAt(), Widget::getFont(), Image::getHeight(), ExtendedListModel::getImageAt(), PopupList::getListModel(), PopupList::getSelected(), Image::getWidth(), Rect::height, Widget::isFocused(), mAlpha, Widget::mDimension, mDroppedDown, mExtended, mFoldedUpHeight, Widget::mForegroundColor, Widget2::mForegroundColor2, mHighlightColor, mImagePadding, ServerCommandType::model, mPadding, mPopup, mShadowColor, mSpacing, Graphics::setColor(), updateAlpha(), and Rect::width.

Referenced by safeDraw().

217 {
218  BLOCK_START("DropDown::draw")
219  int h;
220 
221  if (mDroppedDown)
222  h = mFoldedUpHeight;
223  else
224  h = mDimension.height;
225 
226  updateAlpha();
227 
228  const unsigned int alpha = CAST_U32(mAlpha * 255.0F);
229  const int pad = 2 * mPadding;
230  mHighlightColor.a = alpha;
231  mShadowColor.a = alpha;
232 
233  ListModel *const model = mPopup->getListModel();
234  if ((model != nullptr) && mPopup->getSelected() >= 0)
235  {
236  Font *const font = getFont();
237  if (mExtended)
238  {
239  const int sel = mPopup->getSelected();
240  ExtendedListModel *const model2
241  = static_cast<ExtendedListModel *>(model);
242  const Image *const image = model2->getImageAt(sel);
243  if (image == nullptr)
244  {
245  font->drawString(graphics,
248  model->getElementAt(sel),
249  mPadding, mPadding);
250  }
251  else
252  {
253  graphics->drawImage(image,
255  (mDimension.height - image->getHeight()) / 2 + mPadding);
256  font->drawString(graphics,
259  model->getElementAt(sel),
260  image->getWidth() + mImagePadding + mSpacing, mPadding);
261  }
262  }
263  else
264  {
265  font->drawString(graphics,
268  model->getElementAt(mPopup->getSelected()),
269  mPadding, mPadding);
270  }
271  }
272 
273  if (isFocused())
274  {
275  graphics->setColor(mHighlightColor);
276  graphics->drawRectangle(Rect(mPadding, mPadding,
277  mDimension.width - h - pad, h - pad));
278  }
279 
280  drawButton(graphics);
281 
282  if (mDroppedDown)
283  {
284  // Draw two lines separating the ListBox with selected
285  // element view.
286  const int w = mDimension.width;
287  graphics->setColor(mHighlightColor);
288  graphics->drawLine(0, h, w, h);
289  graphics->setColor(mShadowColor);
290  graphics->drawLine(0, h + 1, w, h + 1);
291  }
292  BLOCK_END("DropDown::draw")
293 }
#define CAST_U32
Definition: cast.h:30
Font * getFont() const
Definition: widget.cpp:330
int mFoldedUpHeight
Definition: dropdown.h:147
int width
Definition: rect.h:218
int getSelected() const
Definition: popuplist.cpp:114
Definition: font.h:88
Color mHighlightColor
Definition: dropdown.h:143
Color mShadowColor
Definition: dropdown.h:142
void drawButton(Graphics *const graphics)
Definition: dropdown.cpp:322
Definition: rect.h:72
#define BLOCK_START(name)
Definition: perfomance.h:78
ListModel * getListModel()
Definition: dropdown.cpp:530
if(!vert) return
void updateAlpha()
Definition: dropdown.cpp:190
#define BLOCK_END(name)
Definition: perfomance.h:79
Color mForegroundColor
Definition: widget.h:1085
virtual void drawRectangle(const Rect &rectangle)=0
virtual bool isFocused() const
Definition: widget.cpp:183
PopupList * mPopup
Definition: dropdown.h:141
bool mDroppedDown
Definition: dropdown.h:154
virtual void setColor(const Color &color)
Definition: graphics.h:319
int mPadding
Definition: dropdown.h:144
virtual const Image * getImageAt(int i)=0
void drawString(Graphics *const graphics, Color col, const Color &col2, const std::string &text, const int x, const int y)
Definition: font.cpp:253
int height
Definition: rect.h:223
Color mForegroundColor2
Definition: widget2.h:112
virtual void drawImage(const Image *const image, int dstX, int dstY)=0
virtual void drawLine(int x1, int y1, int x2, int y2)=0
Definition: image.h:61
int getWidth() const A_INLINE
Definition: image.h:116
Rect mDimension
Definition: widget.h:1100
int mSpacing
Definition: dropdown.h:146
bool mExtended
Definition: dropdown.h:153
int getSelected() const
Definition: dropdown.cpp:509
static float mAlpha
Definition: dropdown.h:162
int mImagePadding
Definition: dropdown.h:145
int getHeight() const A_INLINE
Definition: image.h:122

◆ drawButton()

void DropDown::drawButton ( Graphics *const  graphics)
protected

Draws the button with the little down arrow.

Parameters
graphicsa Graphics object to draw with.

Definition at line 322 of file dropdown.cpp.

References buttons, Graphics::drawImage(), Image::getHeight(), Image::getWidth(), Rect::height, Widget::mDimension, mDroppedDown, mFoldedUpHeight, mImagePadding, mPushed, and Rect::width.

Referenced by draw().

323 {
324  const int height = mDroppedDown ? mFoldedUpHeight : mDimension.height;
325 
326  Image *image = buttons[mDroppedDown][mPushed];
327  if (image != nullptr)
328  {
329  graphics->drawImage(image,
330  mDimension.width - image->getWidth() - mImagePadding,
331  (height - image->getHeight()) / 2);
332  }
333 }
int mFoldedUpHeight
Definition: dropdown.h:147
int width
Definition: rect.h:218
bool mDroppedDown
Definition: dropdown.h:154
int height
Definition: rect.h:223
bool mPushed
Definition: dropdown.h:155
virtual void drawImage(const Image *const image, int dstX, int dstY)=0
Definition: image.h:61
int getWidth() const A_INLINE
Definition: image.h:116
static Image * buttons[2][2]
Definition: dropdown.h:160
Rect mDimension
Definition: widget.h:1100
int mImagePadding
Definition: dropdown.h:145
int getHeight() const A_INLINE
Definition: image.h:122

◆ drawFrame()

void DropDown::drawFrame ( Graphics *const  graphics)
virtual

Called when a widget is given a chance to draw a frame around itself. The frame is not considered a part of the widget, it only allows a frame to be drawn around the widget, thus a frame will never be included when calculating if a widget should receive events from user input. Also a widget's frame will never be included when calculating a widget's position.

The size of the frame is calculated using the widget's frame size. If a widget has a frame size of 10 pixels than the area the drawFrame function can draw to will be the size of the widget with an additional extension of 10 pixels in each direction.

An example when drawFrame is a useful function is if a widget needs a glow around itself.

Parameters
graphicsA graphics object to draw with.
See also
setFrameSize, getFrameSize

Reimplemented from Widget.

Definition at line 300 of file dropdown.cpp.

References BLOCK_END, BLOCK_START, CAST_S32, Graphics::drawImageRect(), Widget::getFrameSize(), Rect::height, Widget::mDimension, skinRect, and Rect::width.

301 {
302  BLOCK_START("DropDown::drawFrame")
303  const int bs2 = CAST_S32(getFrameSize());
304  const Rect &rect = mDimension;
305  graphics->drawImageRect(0, 0,
306  rect.width + bs2, rect.height + bs2,
307  skinRect);
309 }
Definition: rect.h:72
#define BLOCK_START(name)
Definition: perfomance.h:78
#define BLOCK_END(name)
Definition: perfomance.h:79
unsigned int getFrameSize() const
Definition: widget.h:183
#define CAST_S32
Definition: cast.h:29
void drawFrame(Graphics *const graphics)
Definition: dropdown.cpp:300
void drawImageRect(int x, int y, int w, int h, const ImageRect &restrict imgRect) restrict2 override final
static ImageRect skinRect
Definition: dropdown.h:161
Rect mDimension
Definition: widget.h:1100

◆ dropDown()

void DropDown::dropDown ( )

Definition at line 475 of file dropdown.cpp.

References adjustHeight(), CAST_S32, Widget::getAbsolutePosition(), Widget::getFrameSize(), Widget::getHeight(), Popup::getPadding(), Rect::height, Widget::mDimension, mDroppedDown, mFoldedUpHeight, mPadding, Widget::mParent, mPopup, Widget::requestFocus(), Widget::requestMoveToTop(), Widget::setWidth(), PopupList::show(), Rect::width, x, and y.

Referenced by keyPressed(), and mousePressed().

476 {
477  if (!mDroppedDown)
478  {
479  if (mParent == nullptr)
480  return;
481  mDroppedDown = true;
483  adjustHeight();
484 
485  int x = 0;
486  int y = 0;
487  getAbsolutePosition(x, y);
488  const int frame = CAST_S32(mParent->getFrameSize());
489  const int pad = mPopup->getPadding();
490  const int pad2 = pad * 2;
491 
492  // here width should be adjusted on some other parameters
493  mPopup->setWidth(mDimension.width - pad2 + 8);
494  mPopup->show(x - mPadding - frame - 1, y + mDimension.height);
496  mPopup->requestFocus();
497  }
498 }
int getPadding() const
Definition: popup.h:134
int mFoldedUpHeight
Definition: dropdown.h:147
int width
Definition: rect.h:218
void setWidth(const int width)
Definition: widget.cpp:132
void show(int x, int y)
Definition: popuplist.cpp:81
virtual void requestMoveToTop()
Definition: widget.cpp:212
unsigned int getFrameSize() const
Definition: widget.h:183
PopupList * mPopup
Definition: dropdown.h:141
bool mDroppedDown
Definition: dropdown.h:154
#define CAST_S32
Definition: cast.h:29
virtual void requestFocus()
Definition: widget.cpp:203
int mPadding
Definition: dropdown.h:144
void adjustHeight()
Definition: dropdown.cpp:470
Widget * mParent
Definition: widget.h:1127
int height
Definition: rect.h:223
virtual void getAbsolutePosition(int &x, int &y) const
Definition: widget.cpp:311
int getHeight() const
Definition: widget.h:239
Rect mDimension
Definition: widget.h:1100

◆ foldUp()

void DropDown::foldUp ( )

Definition at line 500 of file dropdown.cpp.

References adjustHeight(), and mDroppedDown.

Referenced by action(), mousePressed(), and mouseReleased().

501 {
502  if (mDroppedDown)
503  {
504  mDroppedDown = false;
505  adjustHeight();
506  }
507 }
bool mDroppedDown
Definition: dropdown.h:154
void adjustHeight()
Definition: dropdown.cpp:470

◆ getChildrenArea()

Rect DropDown::getChildrenArea ( )
virtual

Gets the area of the widget occupied by the widget's children. By default this method returns an empty rectangle as not all widgets are containers. If you want to make a container this method should return the area where the children resides. This method is used when drawing children of a widget when computing clip rectangles for the children.

An example of a widget that overloads this method is ScrollArea. A ScrollArea has a view of its contant and that view is the children area. The size of a ScrollArea's children area might vary depending on if the scroll bars of the ScrollArea is shown or not.

Returns
The area of the widget occupied by the widget's children.
See also
BasicContainer
BasicContainer::getChildrenArea
BasicContainer::drawChildren

Reimplemented from BasicContainer.

Definition at line 541 of file dropdown.cpp.

References Rect::height, Widget::mDimension, mDroppedDown, mFoldedUpHeight, and Rect::width.

542 {
543  if (mDroppedDown)
544  {
545  // Calculate the children area (with the one pixel border in mind)
546  return Rect(1, mFoldedUpHeight + 1,
548  }
549 
550  return Rect();
551 }
int mFoldedUpHeight
Definition: dropdown.h:147
int width
Definition: rect.h:218
Definition: rect.h:72
bool mDroppedDown
Definition: dropdown.h:154
int height
Definition: rect.h:223
Rect mDimension
Definition: widget.h:1100

◆ getListModel()

ListModel * DropDown::getListModel ( )

Definition at line 530 of file dropdown.cpp.

References PopupList::getListModel(), and mPopup.

531 {
532  return mPopup->getListModel();
533 }
PopupList * mPopup
Definition: dropdown.h:141
ListModel * getListModel() const
Definition: popuplist.h:62

◆ getSelected()

int DropDown::getSelected ( ) const

◆ getSelectedString()

std::string DropDown::getSelectedString ( ) const

Definition at line 461 of file dropdown.cpp.

References ListModel::getElementAt(), PopupList::getListModel(), getSelected(), and mPopup.

Referenced by Setup_Theme::action(), and TextCommandEditor::save().

462 {
463  ListModel *const listModel = mPopup->getListModel();
464  if (listModel == nullptr)
465  return "";
466 
467  return listModel->getElementAt(getSelected());
468 }
PopupList * mPopup
Definition: dropdown.h:141
virtual std::string getElementAt(int i)=0
ListModel * getListModel() const
Definition: popuplist.h:62
int getSelected() const
Definition: dropdown.cpp:509

◆ hideDrop()

void DropDown::hideDrop ( bool  event)

Definition at line 378 of file dropdown.cpp.

References Widget::distributeActionEvent(), mPopup, Widget::setVisible(), and Visible_false.

Referenced by mousePressed(), InventoryWindow::setVisible(), InventoryWindow::~InventoryWindow(), and LoginDialog::~LoginDialog().

379 {
380  if (event)
383 }
void setVisible(Visible visible)
Definition: widget.cpp:224
void distributeActionEvent()
Definition: widget.cpp:492
PopupList * mPopup
Definition: dropdown.h:141
const bool Visible_false
Definition: visible.h:29

◆ keyPressed()

void DropDown::keyPressed ( KeyEvent event)
virtual

Called if a key is pressed when the widget has keyboard focus. If a key is held down the widget will generate multiple key presses.

Parameters
eventDiscribes the event.

Reimplemented from KeyListener.

Definition at line 335 of file dropdown.cpp.

References dropDown(), PopupList::getListModel(), getSelected(), InputAction::GUI_DOWN, InputAction::GUI_END, InputAction::GUI_HOME, InputAction::GUI_SELECT, InputAction::GUI_SELECT2, InputAction::GUI_UP, InputGuiEvent::isConsumed(), mPopup, PRAGMA45(), and setSelected().

336 {
337  if (event.isConsumed())
338  return;
339 
340  const InputActionT actionId = event.getActionId();
341  PRAGMA45(GCC diagnostic push)
342  PRAGMA45(GCC diagnostic ignored "-Wswitch-enum")
343  switch (actionId)
344  {
347  dropDown();
348  break;
349 
350  case InputAction::GUI_UP:
351  setSelected(getSelected() - 1);
352  break;
353 
355  setSelected(getSelected() + 1);
356  break;
357 
359  setSelected(0);
360  break;
361 
363  if (mPopup->getListModel() != nullptr)
364  {
366  getNumberOfElements() - 1);
367  }
368  break;
369 
370  default:
371  return;
372  }
373  PRAGMA45(GCC diagnostic pop)
374 
375  event.consume();
376 }
PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wunused-result") int TestLauncher
PopupList * mPopup
Definition: dropdown.h:141
InputAction ::T InputActionT
Definition: inputaction.h:715
void dropDown()
Definition: dropdown.cpp:475
bool isConsumed() const
ListModel * getListModel() const
Definition: popuplist.h:62
void setSelected(int selected)
Definition: dropdown.cpp:514
int getSelected() const
Definition: dropdown.cpp:509

◆ mouseDragged()

void DropDown::mouseDragged ( MouseEvent event)
virtual

Called when the mouse has moved and the mouse has previously been pressed on the widget.

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 427 of file dropdown.cpp.

References mIsDragged.

428 {
429  mIsDragged = true;
430  event.consume();
431 }
bool mIsDragged
Definition: dropdown.h:156

◆ mousePressed()

void DropDown::mousePressed ( MouseEvent event)
virtual

Called when a mouse button has been pressed on the widget area.

NOTE: A mouse press is NOT equal to a mouse click. Use mouseClickMessage to check for mouse clicks.

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 385 of file dropdown.cpp.

References dropDown(), foldUp(), MouseEvent::getButton(), hideDrop(), MouseButton::LEFT, mDroppedDown, and mPushed.

386 {
387  event.consume();
388  // If we have a mouse press on the widget.
389  if (event.getButton() == MouseButton::LEFT
390  && !mDroppedDown && event.getSource() == this)
391  {
392  mPushed = true;
393  dropDown();
394  }
395  else
396  {
397  mPushed = false;
398  foldUp();
399  hideDrop(true);
400  }
401 }
void hideDrop(bool event)
Definition: dropdown.cpp:378
MouseButtonT getButton() const
Definition: mouseevent.h:115
bool mDroppedDown
Definition: dropdown.h:154
void dropDown()
Definition: dropdown.cpp:475
void foldUp()
Definition: dropdown.cpp:500
bool mPushed
Definition: dropdown.h:155

◆ mouseReleased()

void DropDown::mouseReleased ( MouseEvent event)
virtual

Called when a mouse button has been released on the widget area.

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 403 of file dropdown.cpp.

References foldUp(), Rect::height, MouseButton::LEFT, Widget::mDimension, mIsDragged, mPushed, Rect::width, x, and y.

404 {
405  if (mIsDragged)
406  mPushed = false;
407 
408  const MouseButtonT button = event.getButton();
409  const int x = event.getX();
410  const int y = event.getY();
411  // Released outside of widget. Can happen when we have modal
412  // input focus.
413  if ((0 > y || y >= mDimension.height || x < 0 || x >= mDimension.width)
414  && button == MouseButton::LEFT)
415  {
416  if (mIsDragged)
417  foldUp();
418  }
419  else if (button == MouseButton::LEFT)
420  {
421  mPushed = false;
422  }
423 
424  mIsDragged = false;
425 }
int width
Definition: rect.h:218
int height
Definition: rect.h:223
bool mIsDragged
Definition: dropdown.h:156
void foldUp()
Definition: dropdown.cpp:500
bool mPushed
Definition: dropdown.h:155
MouseButton ::T MouseButtonT
Definition: mousebutton.h:77
Rect mDimension
Definition: widget.h:1100

◆ mouseWheelMovedDown()

void DropDown::mouseWheelMovedDown ( MouseEvent event)
virtual

Called when the mouse wheel has moved down on the widget area.

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 439 of file dropdown.cpp.

References getSelected(), and setSelected().

440 {
441  setSelected(getSelected() + 1);
442  event.consume();
443 }
void setSelected(int selected)
Definition: dropdown.cpp:514
int getSelected() const
Definition: dropdown.cpp:509

◆ mouseWheelMovedUp()

void DropDown::mouseWheelMovedUp ( MouseEvent event)
virtual

Called when the mouse wheel has moved up on the widget area.

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 433 of file dropdown.cpp.

References getSelected(), and setSelected().

434 {
435  setSelected(getSelected() - 1);
436  event.consume();
437 }
void setSelected(int selected)
Definition: dropdown.cpp:514
int getSelected() const
Definition: dropdown.cpp:509

◆ removeSelectionListener()

void DropDown::removeSelectionListener ( SelectionListener selectionListener)

Definition at line 570 of file dropdown.cpp.

References mSelectionListeners.

571 {
573 }
SelectionListenerList mSelectionListeners
Definition: dropdown.h:150

◆ safeDraw()

void DropDown::safeDraw ( Graphics *const  graphics)
virtual

Implements Widget.

Definition at line 295 of file dropdown.cpp.

References draw().

296 {
297  DropDown::draw(graphics);
298 }
void draw(Graphics *const graphics)
Definition: dropdown.cpp:216

◆ safeDrawFrame()

void DropDown::safeDrawFrame ( Graphics *const  graphics)
virtual

Reimplemented from Widget.

Definition at line 311 of file dropdown.cpp.

References BLOCK_END, BLOCK_START, CAST_S32, Graphics::drawImageRect(), Widget::getFrameSize(), Rect::height, Widget::mDimension, skinRect, and Rect::width.

312 {
313  BLOCK_START("DropDown::drawFrame")
314  const int bs2 = CAST_S32(getFrameSize());
315  const Rect &rect = mDimension;
316  graphics->drawImageRect(0, 0,
317  rect.width + bs2, rect.height + bs2,
318  skinRect);
320 }
Definition: rect.h:72
#define BLOCK_START(name)
Definition: perfomance.h:78
#define BLOCK_END(name)
Definition: perfomance.h:79
unsigned int getFrameSize() const
Definition: widget.h:183
#define CAST_S32
Definition: cast.h:29
void drawFrame(Graphics *const graphics)
Definition: dropdown.cpp:300
void drawImageRect(int x, int y, int w, int h, const ImageRect &restrict imgRect) restrict2 override final
static ImageRect skinRect
Definition: dropdown.h:161
Rect mDimension
Definition: widget.h:1100

◆ setListModel()

void DropDown::setListModel ( ListModel *const  listModel)

Definition at line 520 of file dropdown.cpp.

References adjustHeight(), PopupList::getSelected(), mPopup, PopupList::setListModel(), and PopupList::setSelected().

Referenced by DropDown().

521 {
522  mPopup->setListModel(listModel);
523 
524  if (mPopup->getSelected() < 0)
525  mPopup->setSelected(0);
526 
527  adjustHeight();
528 }
void setSelected(const int selected)
Definition: popuplist.cpp:106
int getSelected() const
Definition: popuplist.cpp:114
void setListModel(ListModel *const model)
Definition: popuplist.cpp:122
PopupList * mPopup
Definition: dropdown.h:141
void adjustHeight()
Definition: dropdown.cpp:470

◆ setSelected()

void DropDown::setSelected ( int  selected)

◆ setSelectedString()

void DropDown::setSelectedString ( const std::string &  str)

Definition at line 445 of file dropdown.cpp.

References ListModel::getElementAt(), PopupList::getListModel(), ListModel::getNumberOfElements(), mPopup, setSelected(), and ServerCommandType::str.

Referenced by LoginDialog::LoginDialog(), Setup_Theme::Setup_Theme(), and TextCommandEditor::TextCommandEditor().

446 {
447  ListModel *const listModel = mPopup->getListModel();
448  if (listModel == nullptr)
449  return;
450 
451  for (int f = 0; f < listModel->getNumberOfElements(); f ++)
452  {
453  if (listModel->getElementAt(f) == str)
454  {
455  setSelected(f);
456  break;
457  }
458  }
459 }
virtual int getNumberOfElements()=0
PopupList * mPopup
Definition: dropdown.h:141
virtual std::string getElementAt(int i)=0
ListModel * getListModel() const
Definition: popuplist.h:62
void setSelected(int selected)
Definition: dropdown.cpp:514

◆ updateAlpha()

void DropDown::updateAlpha ( )

Update the alpha value to the graphic components.

Definition at line 190 of file dropdown.cpp.

References buttons, Theme::getMinimumOpacity(), ImageRect::grid, Settings::guiAlpha, mAlpha, Image::setAlpha(), settings, skinRect, and theme.

Referenced by draw().

191 {
192  const float alpha = std::max(settings.guiAlpha,
194 
195  if (mAlpha != alpha)
196  {
197  mAlpha = alpha;
198 
199  if (buttons[0][0] != nullptr)
200  buttons[0][0]->setAlpha(mAlpha);
201  if (buttons[0][1] != nullptr)
202  buttons[0][1]->setAlpha(mAlpha);
203  if (buttons[1][0] != nullptr)
204  buttons[1][0]->setAlpha(mAlpha);
205  if (buttons[1][1] != nullptr)
206  buttons[1][1]->setAlpha(mAlpha);
207 
208  for (int a = 0; a < 9; a++)
209  {
210  if (skinRect.grid[a] != nullptr)
212  }
213  }
214 }
float getMinimumOpacity() const
Definition: theme.h:123
Settings settings
Definition: settings.cpp:31
virtual void setAlpha(const float alpha)
Definition: image.cpp:286
Image * grid[9]
Definition: imagerect.h:41
Theme * theme
Definition: theme.cpp:61
static ImageRect skinRect
Definition: dropdown.h:161
static Image * buttons[2][2]
Definition: dropdown.h:160
float guiAlpha
Definition: settings.h:129
static float mAlpha
Definition: dropdown.h:162

◆ updateSelection()

void DropDown::updateSelection ( )

Definition at line 557 of file dropdown.cpp.

References Widget::distributeActionEvent(), distributeValueChangedEvent(), mDroppedDown, and mPushed.

Referenced by PopupList::focusGained(), PopupList::focusLost(), and PopupList::mouseReleased().

558 {
559  mDroppedDown = false;
560  mPushed = false;
563 }
void distributeActionEvent()
Definition: widget.cpp:492
bool mDroppedDown
Definition: dropdown.h:154
bool mPushed
Definition: dropdown.h:155
void distributeValueChangedEvent()
Definition: dropdown.cpp:575

◆ valueChanged()

void DropDown::valueChanged ( const SelectionEvent event)
virtual

Called when the value of a selection has been changed in a Widget. It is used to be able to recieve a notification that a value has been changed.

Parameters
eventThe event of the value change.

Reimplemented from SelectionListener.

Definition at line 553 of file dropdown.cpp.

554 {
555 }

Field Documentation

◆ buttons

Image * DropDown::buttons
staticprotected

Definition at line 160 of file dropdown.h.

Referenced by drawButton(), DropDown(), updateAlpha(), and ~DropDown().

◆ instances

int DropDown::instances = 0
staticprotected

Definition at line 159 of file dropdown.h.

Referenced by DropDown(), and ~DropDown().

◆ mAlpha

float DropDown::mAlpha = 1.0
staticprotected

Definition at line 162 of file dropdown.h.

Referenced by draw(), DropDown(), and updateAlpha().

◆ mDroppedDown

bool DropDown::mDroppedDown
protected

◆ mExtended

bool DropDown::mExtended
protected

Definition at line 153 of file dropdown.h.

Referenced by draw().

◆ mFoldedUpHeight

int DropDown::mFoldedUpHeight
protected

Definition at line 147 of file dropdown.h.

Referenced by draw(), drawButton(), dropDown(), and getChildrenArea().

◆ mHighlightColor

Color DropDown::mHighlightColor
protected

Definition at line 143 of file dropdown.h.

Referenced by draw().

◆ mImagePadding

int DropDown::mImagePadding
protected

Definition at line 145 of file dropdown.h.

Referenced by draw(), drawButton(), and DropDown().

◆ mIsDragged

bool DropDown::mIsDragged
protected

Definition at line 156 of file dropdown.h.

Referenced by mouseDragged(), and mouseReleased().

◆ mPadding

int DropDown::mPadding
protected

Definition at line 144 of file dropdown.h.

Referenced by adjustHeight(), draw(), DropDown(), and dropDown().

◆ mPopup

PopupList* DropDown::mPopup
protected

◆ mPushed

bool DropDown::mPushed
protected

Definition at line 155 of file dropdown.h.

Referenced by drawButton(), mousePressed(), mouseReleased(), and updateSelection().

◆ mSelectionListeners

SelectionListenerList DropDown::mSelectionListeners
protected

◆ mShadowColor

Color DropDown::mShadowColor
protected

Definition at line 142 of file dropdown.h.

Referenced by draw().

◆ mSkin

Skin * DropDown::mSkin = 0
staticprotected

Definition at line 163 of file dropdown.h.

Referenced by DropDown(), and ~DropDown().

◆ mSpacing

int DropDown::mSpacing
protected

Definition at line 146 of file dropdown.h.

Referenced by draw(), and DropDown().

◆ skinRect

ImageRect DropDown::skinRect
staticprotected

Definition at line 161 of file dropdown.h.

Referenced by drawFrame(), DropDown(), safeDrawFrame(), updateAlpha(), and ~DropDown().


The documentation for this class was generated from the following files: