ManaPlus
|
#include <scrollarea.h>
Public Types | |
enum | ScrollPolicy { SHOW_ALWAYS = 0 , SHOW_NEVER , SHOW_AUTO } |
Public Member Functions | |
ScrollArea (Widget2 *const widget2, Widget *const widget, const Opaque opaque, const std::string &skin) | |
~ScrollArea () | |
void | logic () |
void | updateAlpha () |
void | draw (Graphics *const graphics) |
void | safeDraw (Graphics *const graphics) |
void | drawFrame (Graphics *const graphics) |
void | safeDrawFrame (Graphics *const graphics) |
void | setOpaque (Opaque opaque) |
bool | isOpaque () const |
void | mouseMoved (MouseEvent &event) |
void | mouseEntered (MouseEvent &event) |
void | mouseExited (MouseEvent &event) |
void | mousePressed (MouseEvent &event) |
void | mouseReleased (MouseEvent &event) |
void | mouseDragged (MouseEvent &event) |
void | widgetResized (const Event &event) |
void | widgetMoved (const Event &event) |
Rect | getVerticalBarDimension () const |
Rect | getHorizontalBarDimension () const |
Rect | getVerticalMarkerDimension () |
Rect | getHorizontalMarkerDimension () |
Rect | getUpButtonDimension () const |
Rect | getDownButtonDimension () const |
Rect | getLeftButtonDimension () const |
Rect | getRightButtonDimension () const |
void | setContent (Widget *widget) |
Widget * | getContent () |
void | setHorizontalScrollPolicy (const ScrollPolicy hPolicy) |
ScrollPolicy | getHorizontalScrollPolicy () const |
void | setVerticalScrollPolicy (const ScrollPolicy vPolicy) |
ScrollPolicy | getVerticalScrollPolicy () const |
void | setScrollPolicy (const ScrollPolicy hPolicy, const ScrollPolicy vPolicy) |
void | setVerticalScrollAmount (const int vScroll) |
int | getVerticalScrollAmount () const |
void | setHorizontalScrollAmount (int hScroll) |
int | getHorizontalScrollAmount () const |
void | setScrollAmount (const int hScroll, const int vScroll) |
int | getHorizontalMaxScroll () |
int | getVerticalMaxScroll () |
void | setScrollbarWidth (const int width) |
int | getScrollbarWidth () const |
void | setLeftButtonScrollAmount (const int amount) |
void | setRightButtonScrollAmount (const int amount) |
void | setUpButtonScrollAmount (const int amount) |
void | setDownButtonScrollAmount (const int amount) |
int | getLeftButtonScrollAmount () const |
int | getRightButtonScrollAmount () const |
int | getUpButtonScrollAmount () const |
int | getDownButtonScrollAmount () const |
void | showWidgetPart (Widget *const widget, const Rect &area) |
Rect | getChildrenArea () |
Widget * | getWidgetAt (int x, int y) |
void | setWidth (int width) |
void | setHeight (int height) |
void | setDimension (const Rect &dimension) |
void | mouseWheelMovedUp (MouseEvent &event) |
void | mouseWheelMovedDown (MouseEvent &event) |
bool | isSelectable () const |
Public Member Functions inherited from BasicContainer | |
BasicContainer (const Widget2 *const widget) | |
~BasicContainer () | |
void | moveToTop (Widget *const widget) |
void | moveToBottom (Widget *const widget) |
void | focusNext () |
void | focusPrevious () |
void | setFocusHandler (FocusHandler *const focusHandler) |
void | setInternalFocusHandler (FocusHandler *const focusHandler) |
void | death (const Event &event) |
Widget * | findFirstWidget (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 |
Widget * | getParent () 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 Rect & | getDimension () 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 Color & | getBaseColor () const |
void | setForegroundColor (const Color &color) |
const Color & | getForegroundColor () const |
void | setBackgroundColor (const Color &color) |
const Color & | getBackgroundColor () const |
virtual void | requestFocus () |
virtual void | requestMoveToTop () |
virtual void | requestMoveToBottom () |
FocusHandler * | getFocusHandler () |
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) |
Font * | getFont () 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 FocusHandler * | getInternalFocusHandler () |
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) |
void | setSelectable (const bool selectable) |
void | windowResized () |
virtual void | postInit () |
Public Member Functions inherited from Widget2 | |
virtual | ~Widget2 () |
const Color & | getThemeColor (const ThemeColorIdT type, const unsigned int alpha) const A_INLINE |
const Color & | getThemeCharColor (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) |
Widget * | getWindow () const |
virtual void | setWindow (Widget *const window) |
Public Member Functions inherited from WidgetDeathListener | |
virtual | ~WidgetDeathListener () |
Public Member Functions inherited from MouseListener | |
virtual | ~MouseListener () |
virtual void | mouseClicked (MouseEvent &event) |
Public Member Functions inherited from WidgetListener | |
virtual | ~WidgetListener () |
virtual void | widgetHidden (const Event &event) |
virtual void | widgetShown (const Event &event) |
Protected Types | |
enum | BUTTON_DIR { UP = 0 , DOWN , LEFT , RIGHT , BUTTONS_DIR } |
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 | init (std::string skinName) |
void | checkPolicies () |
void | drawButton (Graphics *const graphics, const BUTTON_DIR dir) |
void | calcButton (Graphics *const graphics, const BUTTON_DIR dir) |
void | drawVBar (Graphics *const graphics) const |
void | drawHBar (Graphics *const graphics) const |
void | drawVMarker (Graphics *const graphics) |
void | drawHMarker (Graphics *const graphics) |
void | calcVBar (const Graphics *const graphics) |
void | calcHBar (const Graphics *const graphics) |
void | calcVMarker (Graphics *const graphics) |
void | calcHMarker (Graphics *const graphics) |
Image * | getImageByState (Rect &dim, const BUTTON_DIR dir) |
void | updateCalcFlag (const Graphics *const graphics) |
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 MouseListener | |
MouseListener () | |
Protected Member Functions inherited from WidgetListener | |
WidgetListener () | |
Static Protected Attributes | |
static int | instances = 0 |
static float | mAlpha = 1.0 |
static bool | mShowButtons = true |
static int | mMarkerSize = 0 |
static int | mScrollbarSize = 12 |
static ImageRect | background |
static ImageRect | vMarker |
static ImageRect | vMarkerHi |
static ImageRect | vBackground |
static ImageRect | hBackground |
static Image * | buttons [4][2] |
Static Protected Attributes inherited from Widget | |
static Font * | mGlobalFont = 0 |
Additional Inherited Members | |
Static Public Member Functions inherited from Widget | |
static void | setGlobalFont (Font *const font) |
static Font * | getGloablFont () |
static void | cleanGlobalFont () |
static bool | widgetExists (const Widget *const widget) |
static void | distributeWindowResizeEvent () |
static Widget * | callPostInit (Widget *const widget) |
Data Fields inherited from Widget | |
Visible | mVisible |
A scroll area.
Contrary to Guichan's scroll area, this scroll area takes ownership over its content. However, it won't delete a previously set content widget when setContent is called!
Definition at line 91 of file scrollarea.h.
|
protected |
Scrollpolicies for the horizontal and vertical scrollbar. The policies are:
SHOW_ALWAYS - Always show the scrollbars no matter what. SHOW_NEVER - Never show the scrollbars no matter waht. SHOW_AUTO - Show the scrollbars only when needed. That is if the content grows larger then the ScrollArea.
Enumerator | |
---|---|
SHOW_ALWAYS | |
SHOW_NEVER | |
SHOW_AUTO |
Definition at line 105 of file scrollarea.h.
ScrollArea::ScrollArea | ( | Widget2 *const | widget2, |
Widget *const | widget, | ||
const Opaque | opaque, | ||
const std::string & | skin | ||
) |
Definition at line 105 of file scrollarea.cpp.
References Widget::addMouseListener(), init(), mOpaque, and setContent().
ScrollArea::~ScrollArea | ( | ) |
Destructor. Also deletes the content.
Definition at line 150 of file scrollarea.cpp.
References background, buttons, BUTTONS_DIR, delete2, getContent(), gui, hBackground, instances, mVertexes, mVertexes2, Gui::removeDragged(), setContent(), Theme::unloadRect(), UP, vBackground, vMarker, and vMarkerHi.
|
protected |
Definition at line 544 of file scrollarea.cpp.
References calcTileCollection(), getImageByState(), mVertexes, Rect::x, and Rect::y.
Referenced by draw().
|
protected |
Definition at line 635 of file scrollarea.cpp.
References Graphics::calcPattern(), getHorizontalBarDimension(), ImageRect::grid, hBackground, Rect::height, mVertexes, Rect::width, Rect::x, and Rect::y.
Referenced by draw().
|
protected |
Definition at line 723 of file scrollarea.cpp.
References Graphics::calcWindow(), getHorizontalMarkerDimension(), Rect::height, Widget::mDimension, mHasMouse, mScrollbarWidth, mVertexes, mY, vMarker, vMarkerHi, Rect::width, Rect::x, and Rect::y.
Referenced by draw().
|
protected |
Definition at line 580 of file scrollarea.cpp.
References Graphics::calcPattern(), getVerticalBarDimension(), ImageRect::grid, Rect::height, mVertexes, vBackground, Rect::width, Rect::x, and Rect::y.
Referenced by draw().
|
protected |
Definition at line 684 of file scrollarea.cpp.
References Graphics::calcWindow(), getVerticalMarkerDimension(), Rect::height, Widget::mDimension, mHasMouse, mScrollbarWidth, mVertexes, mX, vMarker, vMarkerHi, Rect::width, Rect::x, and Rect::y.
Referenced by draw().
|
protected |
Checks the policies for the scroll bars.
Definition at line 1382 of file scrollarea.cpp.
References getContent(), Widget::getHeight(), Widget::getWidth(), mHBarVisible, mHPolicy, mScrollbarWidth, mVBarVisible, mVPolicy, SHOW_ALWAYS, SHOW_AUTO, and SHOW_NEVER.
Referenced by getHorizontalMaxScroll(), getVerticalMaxScroll(), logic(), setContent(), setDimension(), setHeight(), setHorizontalScrollPolicy(), setScrollPolicy(), setVerticalScrollPolicy(), and setWidth().
|
virtual |
Draws the scroll area.
Implements Widget.
Definition at line 344 of file scrollarea.cpp.
References BLOCK_END, BLOCK_START, calcButton(), calcHBar(), calcHMarker(), calcVBar(), calcVMarker(), ImageCollection::clear(), DOWN, BasicContainer::drawChildren(), Graphics::drawTileCollection(), Graphics::finalize(), Graphics::getRedraw(), LEFT, mHBarVisible, mOpaque, Widget::mRedraw, mShowButtons, mVBarVisible, mVertexes, Opaque_false, RIGHT, Graphics::setRedraw(), UP, updateAlpha(), and updateCalcFlag().
|
protected |
Definition at line 534 of file scrollarea.cpp.
References Graphics::drawImage(), getImageByState(), Rect::x, and Rect::y.
Referenced by safeDraw().
|
virtual |
Draws the background and border of the scroll area.
Reimplemented from Widget.
Definition at line 456 of file scrollarea.cpp.
References background, BLOCK_END, BLOCK_START, Graphics::calcWindow(), ImageCollection::clear(), Graphics::drawTileCollection(), Graphics::finalize(), Rect::height, Widget::mDimension, Widget::mFrameSize, mOpaque, Widget::mRedraw, mVertexes2, Opaque_true, updateCalcFlag(), and Rect::width.
|
protected |
Definition at line 607 of file scrollarea.cpp.
References Graphics::drawPattern(), getHorizontalBarDimension(), ImageRect::grid, hBackground, Rect::height, Rect::width, Rect::x, and Rect::y.
Referenced by safeDraw().
|
protected |
Definition at line 704 of file scrollarea.cpp.
References Graphics::drawImageRect(), getHorizontalMarkerDimension(), Rect::height, Widget::mDimension, mHasMouse, mScrollbarWidth, mY, vMarker, vMarkerHi, Rect::width, Rect::x, and Rect::y.
Referenced by safeDraw().
|
protected |
Definition at line 557 of file scrollarea.cpp.
References Graphics::drawPattern(), getVerticalBarDimension(), ImageRect::grid, Rect::height, vBackground, Rect::width, Rect::x, and Rect::y.
Referenced by safeDraw().
|
protected |
Definition at line 666 of file scrollarea.cpp.
References Graphics::drawImageRect(), getVerticalMarkerDimension(), Rect::height, Widget::mDimension, mHasMouse, mScrollbarWidth, mX, vMarker, vMarkerHi, Rect::width, Rect::x, and Rect::y.
Referenced by safeDraw().
|
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.
Reimplemented from BasicContainer.
Definition at line 1322 of file scrollarea.cpp.
References Widget::getHeight(), Widget::getWidth(), Rect::height, mHBarVisible, mScrollbarWidth, mVBarVisible, and Rect::width.
Referenced by getHorizontalMarkerDimension(), getHorizontalMaxScroll(), getVerticalMarkerDimension(), getVerticalMaxScroll(), getWidgetAt(), mousePressed(), mouseWheelMovedDown(), and mouseWheelMovedUp().
Widget * ScrollArea::getContent | ( | ) |
Gets the content.
Definition at line 1207 of file scrollarea.cpp.
References BasicContainer::mWidgets.
Referenced by checkPolicies(), getHorizontalMaxScroll(), getVerticalMaxScroll(), getWidgetAt(), logic(), showWidgetPart(), ShortcutWindow::widgetHidden(), widgetResized(), ~ScrollArea(), and Setup_Colors::~Setup_Colors().
Rect ScrollArea::getDownButtonDimension | ( | ) | const |
Definition at line 1144 of file scrollarea.cpp.
References Rect::height, Widget::mDimension, mHBarVisible, mScrollbarWidth, mShowButtons, mVBarVisible, and Rect::width.
Referenced by getImageByState(), and mousePressed().
|
inline |
Gets the amount to scroll in pixels when the down scroll button is pushed.
Definition at line 411 of file scrollarea.h.
References mDownButtonScrollAmount.
Rect ScrollArea::getHorizontalBarDimension | ( | ) | const |
Definition at line 995 of file scrollarea.cpp.
References Rect::height, Widget::mDimension, mHBarVisible, mScrollbarWidth, mShowButtons, mVBarVisible, and Rect::width.
Referenced by calcHBar(), drawHBar(), mouseDragged(), and mousePressed().
Rect ScrollArea::getHorizontalMarkerDimension | ( | ) |
Definition at line 1073 of file scrollarea.cpp.
References getChildrenArea(), getHorizontalMaxScroll(), Widget::getWidth(), Rect::height, Widget::mDimension, mHBarVisible, mHScroll, mMarkerSize, mScrollbarWidth, mShowButtons, mVBarVisible, BasicContainer::mWidgets, and Rect::width.
Referenced by calcHMarker(), drawHMarker(), mouseDragged(), and mousePressed().
int ScrollArea::getHorizontalMaxScroll | ( | ) |
Gets the maximum amount of horizontal scroll.
Definition at line 1266 of file scrollarea.cpp.
References checkPolicies(), getChildrenArea(), getContent(), Widget::getFrameSize(), Widget::getWidth(), and Rect::width.
Referenced by getHorizontalMarkerDimension(), mouseDragged(), mouseReleased(), and setHorizontalScrollAmount().
|
inline |
Gets the amount that is scrolled horizontally.
Definition at line 291 of file scrollarea.h.
References mHScroll.
|
inline |
Gets the horizontal scrollbar policy. See enum with policies.
Definition at line 230 of file scrollarea.h.
References mHPolicy.
|
protected |
Definition at line 503 of file scrollarea.cpp.
References buttons, BUTTONS_DIR, CAST_SIZE, CAST_U32, DOWN, getDownButtonDimension(), getLeftButtonDimension(), getRightButtonDimension(), getUpButtonDimension(), LEFT, Logger::log(), logger, mDownButtonPressed, mLeftButtonPressed, mRightButtonPressed, mUpButtonPressed, RIGHT, Catch::toString(), and UP.
Referenced by calcButton(), and drawButton().
Rect ScrollArea::getLeftButtonDimension | ( | ) | const |
Definition at line 1163 of file scrollarea.cpp.
References Rect::height, Widget::mDimension, mHBarVisible, mScrollbarWidth, and mShowButtons.
Referenced by getImageByState(), and mousePressed().
|
inline |
Gets the amount to scroll in pixels when the left scroll button is pushed.
Definition at line 381 of file scrollarea.h.
References mLeftButtonScrollAmount.
Rect ScrollArea::getRightButtonDimension | ( | ) | const |
Definition at line 1172 of file scrollarea.cpp.
References Rect::height, Widget::mDimension, mHBarVisible, mScrollbarWidth, mShowButtons, mVBarVisible, and Rect::width.
Referenced by getImageByState(), and mousePressed().
|
inline |
Gets the amount to scroll in pixels when the right scroll button is pushed.
Definition at line 391 of file scrollarea.h.
References mRightButtonScrollAmount.
|
inline |
Gets the width of the scroll bars.
Definition at line 331 of file scrollarea.h.
References mScrollbarWidth.
Rect ScrollArea::getUpButtonDimension | ( | ) | const |
Definition at line 1135 of file scrollarea.cpp.
References Widget::mDimension, mScrollbarWidth, mShowButtons, mVBarVisible, and Rect::width.
Referenced by getImageByState(), and mousePressed().
|
inline |
Gets the amount to scroll in pixels when the up scroll button is pushed.
Definition at line 401 of file scrollarea.h.
References mUpButtonScrollAmount.
Rect ScrollArea::getVerticalBarDimension | ( | ) | const |
Definition at line 975 of file scrollarea.cpp.
References Rect::height, Widget::mDimension, mHBarVisible, mScrollbarWidth, mShowButtons, mVBarVisible, and Rect::width.
Referenced by calcVBar(), drawVBar(), mouseDragged(), and mousePressed().
Rect ScrollArea::getVerticalMarkerDimension | ( | ) |
Definition at line 1015 of file scrollarea.cpp.
References getChildrenArea(), Widget::getHeight(), getVerticalMaxScroll(), Rect::height, Widget::mDimension, mHBarVisible, mMarkerSize, mScrollbarWidth, mShowButtons, mVBarVisible, mVScroll, BasicContainer::mWidgets, and Rect::width.
Referenced by calcVMarker(), drawVMarker(), mouseDragged(), and mousePressed().
int ScrollArea::getVerticalMaxScroll | ( | ) |
Gets the maximum amount of vertical scroll.
Definition at line 1283 of file scrollarea.cpp.
References checkPolicies(), getChildrenArea(), getContent(), Widget::getFrameSize(), Widget::getHeight(), and Rect::height.
Referenced by ChatTab::addNewRow(), NpcDialog::addText(), NpcDialog::buildLayout(), ChatTab::chatLog(), getVerticalMarkerDimension(), UpdaterWindow::logic(), mouseDragged(), mouseReleased(), setVerticalScrollAmount(), WhoIsOnline::updateWindow(), and TabbedArea::widgetResized().
|
inline |
Gets the amount that is scrolled vertically.
Definition at line 274 of file scrollarea.h.
References mVScroll.
Referenced by ChatTab::addNewRow(), ChatTab::chatLog(), ChatTab::scroll(), WhoIsOnline::updateWindow(), and TabbedArea::widgetResized().
|
inline |
Gets the vertical scrollbar policy. See enum with policies.
Definition at line 247 of file scrollarea.h.
References mVPolicy.
|
virtual |
Gets a widget from a certain position in the widget. This function is used to decide which gets mouse input, thus it can be overloaded to change that behaviour.
NOTE: This always returns NULL if the widget is not a container.
x | The x coordinate of the widget to get. |
y | The y coordinate of the widget to get. |
Reimplemented from BasicContainer.
Definition at line 1334 of file scrollarea.cpp.
References getChildrenArea(), getContent(), x, and y.
|
protected |
Initializes the scroll area.
Definition at line 182 of file scrollarea.cpp.
References background, buttonFiles, buttons, BUTTONS_DIR, Skin::getBorder(), Skin::getOption(), Theme::getThemePath(), ImageRect::grid, hBackground, instances, Theme::load(), Theme::loadRect(), mMarkerSize, mOpaque, mScrollbarSize, mScrollbarWidth, mShowButtons, setDownButtonScrollAmount(), setLeftButtonScrollAmount(), setOpaque(), setRightButtonScrollAmount(), setUpButtonScrollAmount(), theme, Theme::unload(), UP, vBackground, vMarker, and vMarkerHi.
Referenced by ScrollArea().
|
inline |
Returns whether the widget draws its background or not.
Definition at line 158 of file scrollarea.h.
References mOpaque, and Opaque_true.
|
virtual |
Reimplemented from Widget.
Definition at line 1478 of file scrollarea.cpp.
References Widget::isSelectable(), mHBarVisible, and mVBarVisible.
|
virtual |
Logic function optionally adapts width or height of contents. This depends on the scrollbar settings.
Reimplemented from BasicContainer.
Definition at line 273 of file scrollarea.cpp.
References BLOCK_END, BLOCK_START, checkPolicies(), getContent(), Widget::getFrameSize(), Rect::height, Widget::isVisible(), Widget::logic(), Widget::mDimension, mDownButtonPressed, mDownButtonScrollAmount, mHBarVisible, mHPolicy, mHScroll, mLeftButtonPressed, mLeftButtonScrollAmount, mRightButtonPressed, mRightButtonScrollAmount, mScrollbarWidth, mUpButtonPressed, mUpButtonScrollAmount, mVBarVisible, mVPolicy, mVScroll, Widget::setHeight(), setHorizontalScrollAmount(), Widget::setPosition(), setVerticalScrollAmount(), Widget::setWidth(), SHOW_NEVER, and Rect::width.
Referenced by ChatTab::addNewRow(), ChatTab::chatLog(), UpdaterWindow::logic(), and WhoIsOnline::logic().
|
virtual |
Called when the mouse has moved and the mouse has previously been pressed on the widget.
event | Describes the event. |
Reimplemented from MouseListener.
Definition at line 933 of file scrollarea.cpp.
References getHorizontalBarDimension(), getHorizontalMarkerDimension(), getHorizontalMaxScroll(), getVerticalBarDimension(), getVerticalMarkerDimension(), getVerticalMaxScroll(), Rect::height, mHorizontalMarkerDragOffset, mIsHorizontalMarkerDragged, mIsVerticalMarkerDragged, Widget::mRedraw, mVerticalMarkerDragOffset, setHorizontalScrollAmount(), setVerticalScrollAmount(), Rect::width, Rect::x, and Rect::y.
|
virtual |
Called when the mouse enteres the widget area.
Reimplemented from MouseListener.
Definition at line 749 of file scrollarea.cpp.
References mHasMouse.
|
virtual |
Called when the mouse leaves the widget area.
Reimplemented from MouseListener.
Definition at line 754 of file scrollarea.cpp.
References mHasMouse.
|
virtual |
Called when the mouse moves in the widget area.
Reimplemented from MouseListener.
Definition at line 743 of file scrollarea.cpp.
|
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.
event | Describes the event. |
Reimplemented from MouseListener.
Definition at line 776 of file scrollarea.cpp.
References CAST_S32, MouseEvent::getButton(), getChildrenArea(), getDownButtonDimension(), getHorizontalBarDimension(), getHorizontalMarkerDimension(), getLeftButtonDimension(), getRightButtonDimension(), getUpButtonDimension(), getVerticalBarDimension(), getVerticalMarkerDimension(), InputGuiEvent::isConsumed(), MouseButton::LEFT, mClickX, mClickY, mDownButtonPressed, mDownButtonScrollAmount, mHorizontalMarkerDragOffset, mHScroll, mIsHorizontalMarkerDragged, mIsVerticalMarkerDragged, mLeftButtonPressed, mLeftButtonScrollAmount, mRightButtonPressed, mRightButtonScrollAmount, mUpButtonPressed, mUpButtonScrollAmount, mVerticalMarkerDragOffset, mVScroll, setHorizontalScrollAmount(), setVerticalScrollAmount(), Rect::x, x, Rect::y, and y.
|
virtual |
Called when a mouse button has been released on the widget area.
event | Describes the event. |
Reimplemented from MouseListener.
Definition at line 861 of file scrollarea.cpp.
References MouseEvent::getButton(), getHorizontalMaxScroll(), getVerticalMaxScroll(), InputGuiEvent::isConsumed(), MouseButton::LEFT, mClickX, mClickY, mDownButtonPressed, mHScroll, mIsHorizontalMarkerDragged, mIsVerticalMarkerDragged, mLeftButtonPressed, Widget::mMouseConsume, Widget::mRedraw, mRightButtonPressed, mUpButtonPressed, mVScroll, setHorizontalScrollAmount(), and setVerticalScrollAmount().
|
virtual |
Called when the mouse wheel has moved down on the widget area.
event | Describes the event. |
Reimplemented from MouseListener.
Definition at line 1371 of file scrollarea.cpp.
References getChildrenArea(), InputGuiEvent::isConsumed(), mVScroll, and setVerticalScrollAmount().
|
virtual |
Called when the mouse wheel has moved up on the widget area.
event | Describes the event. |
Reimplemented from MouseListener.
Definition at line 1360 of file scrollarea.cpp.
References getChildrenArea(), InputGuiEvent::isConsumed(), mVScroll, and setVerticalScrollAmount().
|
virtual |
Implements Widget.
Definition at line 398 of file scrollarea.cpp.
References BLOCK_END, BLOCK_START, DOWN, drawButton(), drawHBar(), drawHMarker(), drawVBar(), drawVMarker(), LEFT, mHBarVisible, Widget::mRedraw, mShowButtons, mVBarVisible, RIGHT, BasicContainer::safeDrawChildren(), UP, and updateAlpha().
|
virtual |
Reimplemented from Widget.
Definition at line 480 of file scrollarea.cpp.
References background, BLOCK_END, BLOCK_START, Graphics::drawImageRect(), Rect::height, Widget::mDimension, Widget::mFrameSize, mOpaque, Opaque_true, updateCalcFlag(), and Rect::width.
void ScrollArea::setContent | ( | Widget * | widget | ) |
Sets the content.
widget | The content of the scroll area. |
Definition at line 1191 of file scrollarea.cpp.
References BasicContainer::add(), checkPolicies(), BasicContainer::clear(), and Widget::setPosition().
Referenced by ScrollArea(), ShopWindow::updateSelection(), Setup_Colors::valueChanged(), and ~ScrollArea().
void ScrollArea::setDimension | ( | const Rect & | dimension | ) |
Definition at line 1354 of file scrollarea.cpp.
References checkPolicies(), and Widget::setDimension().
Referenced by WhoIsOnline::postInit().
|
inline |
Sets the amount to scroll in pixels when the down scroll button is pushed.
amount | The amount to scroll in pixels. |
Definition at line 371 of file scrollarea.h.
References mDownButtonScrollAmount.
Referenced by init().
void ScrollArea::setHeight | ( | int | height | ) |
Definition at line 1348 of file scrollarea.cpp.
References checkPolicies(), and Widget::setHeight().
Referenced by PopupList::adjustSize(), MailEditWindow::MailEditWindow(), MailViewWindow::MailViewWindow(), Setup_Colors::Setup_Colors(), PopupMenu::showPopup(), and SetupTabScroll::widgetResized().
void ScrollArea::setHorizontalScrollAmount | ( | int | hScroll | ) |
Sets the amount to scroll horizontally.
hScroll | The amount to scroll. |
Definition at line 1248 of file scrollarea.cpp.
References getHorizontalMaxScroll(), and mHScroll.
Referenced by logic(), mouseDragged(), mousePressed(), mouseReleased(), setScrollAmount(), and showWidgetPart().
void ScrollArea::setHorizontalScrollPolicy | ( | const ScrollPolicy | hPolicy | ) |
Sets the horizontal scrollbar policy. See enum with policies.
hPolicy | The policy for the horizontal scrollbar. |
Definition at line 1215 of file scrollarea.cpp.
References checkPolicies(), and mHPolicy.
Referenced by SkillDialog::addDefaultTab(), ShortcutWindow::addTab(), SocialTab::createControls(), BuyDialog::init(), InventoryWindow::InventoryWindow(), SkillDialog::loadXmlFile(), MailEditWindow::MailEditWindow(), MailViewWindow::MailViewWindow(), MailWindow::MailWindow(), NpcDialog::NpcDialog(), SellDialog::postInit(), EmoteWindow::postInit(), TextSelectDialog::postInit(), QuestsWindow::QuestsWindow(), ServerDialog::ServerDialog(), Setup_Colors::Setup_Colors(), Setup_Input::Setup_Input(), Setup_Relations::Setup_Relations(), Setup_Video::Setup_Video(), SetupTabScroll::SetupTabScroll(), ShopWindow::ShopWindow(), ShortcutWindow::ShortcutWindow(), StatsPage::StatsPage(), StatsPageBasic::StatsPageBasic(), TradeWindow::TradeWindow(), and WorldSelectDialog::WorldSelectDialog().
|
inline |
Sets the amount to scroll in pixels when the left scroll button is pushed.
amount | The amount to scroll in pixels. |
Definition at line 341 of file scrollarea.h.
References mLeftButtonScrollAmount.
Referenced by init().
void ScrollArea::setOpaque | ( | Opaque | opaque | ) |
Sets whether the widget should draw its background or not.
Definition at line 497 of file scrollarea.cpp.
References mOpaque, Opaque_true, and Widget::setFrameSize().
Referenced by init().
|
inline |
Sets the amount to scroll in pixels when the right scroll button is pushed.
amount | The amount to scroll in pixels. |
Definition at line 351 of file scrollarea.h.
References mRightButtonScrollAmount.
Referenced by init().
void ScrollArea::setScrollAmount | ( | const int | hScroll, |
const int | vScroll | ||
) |
Sets the amount to scroll horizontally and vertically.
hScroll | The amount to scroll on horizontal scroll. |
vScroll | The amount to scroll on vertical scroll. |
Definition at line 1260 of file scrollarea.cpp.
References setHorizontalScrollAmount(), and setVerticalScrollAmount().
Referenced by ChatTab::ChatTab().
void ScrollArea::setScrollbarWidth | ( | const int | width | ) |
Sets the width of the scroll bars.
width | The width of the scroll bars. |
Definition at line 1302 of file scrollarea.cpp.
References mScrollbarWidth.
void ScrollArea::setScrollPolicy | ( | const ScrollPolicy | hPolicy, |
const ScrollPolicy | vPolicy | ||
) |
Sets the horizontal and vertical scrollbar policy.
hPolicy | The policy for the horizontal scrollbar. |
vPolicy | The policy for the vertical scrollbar. |
Definition at line 1227 of file scrollarea.cpp.
References checkPolicies(), mHPolicy, and mVPolicy.
Referenced by ChatTab::ChatTab(), NpcDialog::NpcDialog(), and Setup_Colors::Setup_Colors().
|
inline |
Sets the amount to scroll in pixels when the up scroll button is pushed.
amount | The amount to scroll in pixels. |
Definition at line 361 of file scrollarea.h.
References mUpButtonScrollAmount.
Referenced by init().
void ScrollArea::setVerticalScrollAmount | ( | const int | vScroll | ) |
Sets the amount to scroll vertically.
vScroll | The amount to scroll. |
Definition at line 1235 of file scrollarea.cpp.
References getVerticalMaxScroll(), and mVScroll.
Referenced by ChatTab::addNewRow(), NpcDialog::addText(), NpcDialog::buildLayout(), ChatTab::chatLog(), DidYouKnowWindow::loadData(), HelpWindow::loadHelp(), HelpWindow::loadHelpSimple(), UpdaterWindow::loadNews(), UpdaterWindow::loadPatch(), logic(), UpdaterWindow::logic(), mouseDragged(), mousePressed(), mouseReleased(), mouseWheelMovedDown(), mouseWheelMovedUp(), HelpWindow::search(), ServerDialog::ServerDialog(), setScrollAmount(), showWidgetPart(), WhoIsOnline::updateWindow(), and TabbedArea::widgetResized().
void ScrollArea::setVerticalScrollPolicy | ( | const ScrollPolicy | vPolicy | ) |
Sets the vertical scrollbar policy. See enum with policies.
vPolicy | The policy for the vertical scrollbar. |
Definition at line 1221 of file scrollarea.cpp.
References checkPolicies(), and mVPolicy.
Referenced by SkillDialog::addDefaultTab(), SocialTab::createControls(), SkillDialog::loadXmlFile(), NpcDialog::NpcDialog(), PopupMenu::PopupMenu(), EmoteWindow::postInit(), SetupTabScroll::SetupTabScroll(), StatsPage::StatsPage(), and StatsPageBasic::StatsPageBasic().
void ScrollArea::setWidth | ( | int | width | ) |
Definition at line 1342 of file scrollarea.cpp.
References checkPolicies(), and Widget::setWidth().
Referenced by PopupList::adjustSize(), Setup_Video::Setup_Video(), PopupMenu::showPopup(), and SetupTabScroll::widgetResized().
Shows a certain part of a widget in the basic container. Used when widgets want a specific part to be visible in its parent. An example is a TextArea that wants a specific part of its text to be visible when a TextArea is a child of a ScrollArea.
widget | The widget whom wants a specific part of itself to be visible. |
area | The rectangle to be visible. |
Reimplemented from BasicContainer.
Definition at line 1308 of file scrollarea.cpp.
References getContent(), Widget::getFrameSize(), Widget::getX(), Widget::getY(), setHorizontalScrollAmount(), setVerticalScrollAmount(), and BasicContainer::showWidgetPart().
void ScrollArea::updateAlpha | ( | ) |
Update the alpha value to the graphic components.
Definition at line 320 of file scrollarea.cpp.
References background, Theme::getMinimumOpacity(), ImageRect::grid, Settings::guiAlpha, hBackground, mAlpha, settings, theme, vBackground, vMarker, and vMarkerHi.
Referenced by draw(), and safeDraw().
|
protected |
Definition at line 430 of file scrollarea.cpp.
References Graphics::getRedraw(), Graphics::getTopClip(), Rect::height, mDrawHeight, mDrawWidth, Widget::mRedraw, mXOffset, mYOffset, Rect::width, ClipRect::xOffset, and ClipRect::yOffset.
Referenced by draw(), drawFrame(), and safeDrawFrame().
|
virtual |
Invoked when a widget is moved.
event | Describes the event. |
Reimplemented from WidgetListener.
Definition at line 771 of file scrollarea.cpp.
References Widget::mRedraw.
|
virtual |
Invoked when a widget changes its size.
event | Describes the event. |
Reimplemented from WidgetListener.
Definition at line 759 of file scrollarea.cpp.
References getContent(), Rect::height, Widget::mDimension, Widget::mFrameSize, Widget::mRedraw, Widget::setSize(), and Rect::width.
|
staticprotected |
Definition at line 476 of file scrollarea.h.
Referenced by drawFrame(), init(), safeDrawFrame(), updateAlpha(), and ~ScrollArea().
|
staticprotected |
Definition at line 481 of file scrollarea.h.
Referenced by getImageByState(), init(), and ~ScrollArea().
|
staticprotected |
Definition at line 480 of file scrollarea.h.
Referenced by calcHBar(), drawHBar(), init(), updateAlpha(), and ~ScrollArea().
|
staticprotected |
Definition at line 471 of file scrollarea.h.
Referenced by init(), and ~ScrollArea().
|
staticprotected |
Definition at line 472 of file scrollarea.h.
Referenced by updateAlpha().
|
protected |
Definition at line 543 of file scrollarea.h.
Referenced by mousePressed(), and mouseReleased().
|
protected |
Definition at line 544 of file scrollarea.h.
Referenced by mousePressed(), and mouseReleased().
|
protected |
True if the down button is pressed, false otherwise.
Definition at line 568 of file scrollarea.h.
Referenced by getImageByState(), logic(), mousePressed(), and mouseReleased().
|
protected |
Holds the down button scroll amount.
Definition at line 519 of file scrollarea.h.
Referenced by getDownButtonScrollAmount(), logic(), mousePressed(), and setDownButtonScrollAmount().
|
protected |
Definition at line 548 of file scrollarea.h.
Referenced by updateCalcFlag().
|
protected |
Definition at line 547 of file scrollarea.h.
Referenced by updateCalcFlag().
|
protected |
Definition at line 596 of file scrollarea.h.
Referenced by calcHMarker(), calcVMarker(), drawHMarker(), drawVMarker(), mouseEntered(), and mouseExited().
|
protected |
True if the horizontal scroll bar is visible, false otherwise.
Definition at line 558 of file scrollarea.h.
Referenced by checkPolicies(), draw(), getChildrenArea(), getDownButtonDimension(), getHorizontalBarDimension(), getHorizontalMarkerDimension(), getLeftButtonDimension(), getRightButtonDimension(), getVerticalBarDimension(), getVerticalMarkerDimension(), isSelectable(), logic(), and safeDraw().
|
protected |
Holds the horizontal markers drag offset.
Definition at line 534 of file scrollarea.h.
Referenced by mouseDragged(), and mousePressed().
|
protected |
Holds the horizontal scroll bar policy.
Definition at line 489 of file scrollarea.h.
Referenced by checkPolicies(), getHorizontalScrollPolicy(), logic(), setHorizontalScrollPolicy(), and setScrollPolicy().
|
protected |
Holds the horizontal scroll amount.
Definition at line 504 of file scrollarea.h.
Referenced by getHorizontalMarkerDimension(), getHorizontalScrollAmount(), logic(), mousePressed(), mouseReleased(), and setHorizontalScrollAmount().
|
protected |
True if the horizontal marked is dragged.
Definition at line 588 of file scrollarea.h.
Referenced by mouseDragged(), mousePressed(), and mouseReleased().
|
protected |
True if the vertical marked is dragged.
Definition at line 583 of file scrollarea.h.
Referenced by mouseDragged(), mousePressed(), and mouseReleased().
|
protected |
True if the left button is pressed, false otherwise.
Definition at line 573 of file scrollarea.h.
Referenced by getImageByState(), logic(), mousePressed(), and mouseReleased().
|
protected |
Holds the left button scroll amount.
Definition at line 524 of file scrollarea.h.
Referenced by getLeftButtonScrollAmount(), logic(), mousePressed(), and setLeftButtonScrollAmount().
|
staticprotected |
Definition at line 474 of file scrollarea.h.
Referenced by getHorizontalMarkerDimension(), getVerticalMarkerDimension(), and init().
|
protected |
True if the scroll area should be opaque (that is display its background), false otherwise.
Definition at line 594 of file scrollarea.h.
Referenced by draw(), drawFrame(), init(), isOpaque(), safeDrawFrame(), ScrollArea(), and setOpaque().
|
protected |
True if the right button is pressed, false otherwise.
Definition at line 578 of file scrollarea.h.
Referenced by getImageByState(), logic(), mousePressed(), and mouseReleased().
|
protected |
Holds the right button scroll amount.
Definition at line 529 of file scrollarea.h.
Referenced by getRightButtonScrollAmount(), logic(), mousePressed(), and setRightButtonScrollAmount().
|
staticprotected |
Definition at line 475 of file scrollarea.h.
Referenced by init().
|
protected |
Holds the width of the scroll bars.
Definition at line 509 of file scrollarea.h.
Referenced by calcHMarker(), calcVMarker(), checkPolicies(), drawHMarker(), drawVMarker(), getChildrenArea(), getDownButtonDimension(), getHorizontalBarDimension(), getHorizontalMarkerDimension(), getLeftButtonDimension(), getRightButtonDimension(), getScrollbarWidth(), getUpButtonDimension(), getVerticalBarDimension(), getVerticalMarkerDimension(), init(), logic(), and setScrollbarWidth().
|
staticprotected |
Definition at line 473 of file scrollarea.h.
Referenced by draw(), getDownButtonDimension(), getHorizontalBarDimension(), getHorizontalMarkerDimension(), getLeftButtonDimension(), getRightButtonDimension(), getUpButtonDimension(), getVerticalBarDimension(), getVerticalMarkerDimension(), init(), and safeDraw().
|
protected |
True if the up button is pressed, false otherwise.
Definition at line 563 of file scrollarea.h.
Referenced by getImageByState(), logic(), mousePressed(), and mouseReleased().
|
protected |
Holds the up button scroll amount.
Definition at line 514 of file scrollarea.h.
Referenced by getUpButtonScrollAmount(), logic(), mousePressed(), and setUpButtonScrollAmount().
|
protected |
True if the vertical scroll bar is visible, false otherwise.
Definition at line 553 of file scrollarea.h.
Referenced by checkPolicies(), draw(), getChildrenArea(), getDownButtonDimension(), getHorizontalBarDimension(), getHorizontalMarkerDimension(), getRightButtonDimension(), getUpButtonDimension(), getVerticalBarDimension(), getVerticalMarkerDimension(), isSelectable(), logic(), and safeDraw().
|
protected |
Definition at line 483 of file scrollarea.h.
Referenced by calcButton(), calcHBar(), calcHMarker(), calcVBar(), calcVMarker(), draw(), and ~ScrollArea().
|
protected |
Definition at line 484 of file scrollarea.h.
Referenced by drawFrame(), and ~ScrollArea().
|
protected |
Holds the vertical markers drag offset.
Definition at line 539 of file scrollarea.h.
Referenced by mouseDragged(), and mousePressed().
|
protected |
Holds the vertical scroll bar policy.
Definition at line 494 of file scrollarea.h.
Referenced by checkPolicies(), getVerticalScrollPolicy(), logic(), setScrollPolicy(), and setVerticalScrollPolicy().
|
protected |
Holds the vertical scroll amount.
Definition at line 499 of file scrollarea.h.
Referenced by getVerticalMarkerDimension(), getVerticalScrollAmount(), logic(), mousePressed(), mouseReleased(), mouseWheelMovedDown(), mouseWheelMovedUp(), and setVerticalScrollAmount().
|
protected |
Definition at line 541 of file scrollarea.h.
Referenced by calcVMarker(), drawVMarker(), and mouseMoved().
|
protected |
Definition at line 545 of file scrollarea.h.
Referenced by updateCalcFlag().
|
protected |
Definition at line 542 of file scrollarea.h.
Referenced by calcHMarker(), drawHMarker(), and mouseMoved().
|
protected |
Definition at line 546 of file scrollarea.h.
Referenced by updateCalcFlag().
|
staticprotected |
Definition at line 479 of file scrollarea.h.
Referenced by calcVBar(), drawVBar(), init(), updateAlpha(), and ~ScrollArea().
|
staticprotected |
Definition at line 477 of file scrollarea.h.
Referenced by calcHMarker(), calcVMarker(), drawHMarker(), drawVMarker(), init(), updateAlpha(), and ~ScrollArea().
|
staticprotected |
Definition at line 478 of file scrollarea.h.
Referenced by calcHMarker(), calcVMarker(), drawHMarker(), drawVMarker(), init(), updateAlpha(), and ~ScrollArea().