5#ifndef INCLUDE_FIFECHAN_WIDGETS_LISTBOX_HPP_
6#define INCLUDE_FIFECHAN_WIDGETS_LISTBOX_HPP_
12#include "fifechan/platform.hpp"
15#include "fifechan/listeners/keylistener.hpp"
16#include "fifechan/listeners/mouselistener.hpp"
17#include "fifechan/listmodel.hpp"
18#include "fifechan/widget.hpp"
49 ~ListBox()
override =
default;
51 ListBox(ListBox
const &) =
delete;
52 ListBox& operator=(ListBox
const &) =
delete;
53 ListBox(ListBox&&) =
delete;
54 ListBox& operator=(ListBox&&) =
delete;
154 void logic()
override;
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
KeyListener(KeyListener const &)=default
Copy constructor.
void setListModel(ListModel *listModel)
Sets the list model to use.
void setWrappingEnabled(bool wrappingEnabled)
Sets the list box to wrap or not when selecting items with a keyboard.
void adjustSize() override
Resizes the widget's size to fit the content exactly.
int getSelected() const
Gets the selected item as an index in the list model.
void mouseWheelMovedDown(MouseEvent &mouseEvent) override
Called when the mouse wheel has moved down on the widget area.
void mouseDragged(MouseEvent &mouseEvent) override
Called when the mouse has moved and the mouse has previously been pressed on the widget.
bool isWrappingEnabled() const
Checks whether the list box wraps when selecting items with a keyboard.
void mouseWheelMovedUp(MouseEvent &mouseEvent) override
Called when the mouse wheel has moved up on the widget area.
SelectionListenerList::iterator SelectionListenerIterator
Iterator for SelectionListenerList.
int mSelected
The selected item as an index in the list model.
void logic() override
Called for all widgets in the GUI each time Gui::logic is called.
void addSelectionListener(SelectionListener *selectionListener)
Adds a selection listener to the list box.
void adjustSizeImpl()
Concrete implementation of adjustSize.
void removeSelectionListener(SelectionListener *selectionListener)
Removes a selection listener from the list box.
bool mWrappingEnabled
True if wrapping is enabled, false otherwise.
void mousePressed(MouseEvent &mouseEvent) override
Called when a mouse button has been pressed down on the widget area.
void resizeToContent(bool recursion=true) override
Resizes the widget's size to fit the content exactly, calls recursively all childs.
void keyPressed(KeyEvent &keyEvent) override
Called if a key is pressed when the widget has keyboard focus.
ListModel * mListModel
The list model to use.
ListModel * getListModel() const
Gets the list model used.
void draw(Graphics *graphics) override
Draws the widget.
SelectionListenerList mSelectionListeners
The selection listeners of the list box.
void distributeValueChangedEvent()
Notifies all registered selection listeners of a value change.
void setSelected(int selected)
Sets the selected item.
std::list< SelectionListener * > SelectionListenerList
Typdef.
virtual unsigned int getRowHeight() const
Gets the height of a row.
Interface for a data model representing a list (used by ListBox/DropDown).
Represents a mouse event.
MouseListener(MouseListener const &)=default
Copy constructor.
Interface for listening to selection change events.
Used replacement tokens by configure_file():