#include <fltkviewport.hh>
Public Types | |
| enum | GadgetOrientation { GADGET_VERTICAL, GADGET_HORIZONTAL } |
Public Member Functions | |
| FltkViewport (int x, int y, int w, int h, const char *label=0) | |
| ~FltkViewport () | |
| void | resize (int x, int y, int w, int h) |
| void | draw () |
| int | handle (int event) |
| void | setCanvasSize (int width, int ascent, int descent) |
| Set the canvas size. | |
| bool | usesViewport () |
| Return, whether this view uses a viewport. | |
| int | getHScrollbarThickness () |
| Get the thickness of the horizontal scrollbar, when it is visible. | |
| int | getVScrollbarThickness () |
| Get the thickness of the vertical scrollbar, when it is visible. | |
| void | scroll (int dx, int dy) |
| void | scroll (dw::core::ScrollCommand cmd) |
| Scroll the viewport as commanded. | |
| void | scrollTo (int x, int y) |
| Scroll the vieport to the given position. | |
| void | setViewportSize (int width, int height, int hScrollbarThickness, int vScrollbarThickness) |
| Set the viewport size. | |
| void | setScrollStep (int step) |
| void | setGadgetOrientation (bool hscrollbarVisible, bool vscrollbarVisible, GadgetOrientation gadgetOrientation) |
| void | setDragScroll (bool enable) |
| void | addGadget (Fl_Widget *gadget) |
Protected Member Functions | |
| int | translateViewXToCanvasX (int x) |
| int | translateViewYToCanvasY (int y) |
| int | translateCanvasXToViewX (int x) |
| int | translateCanvasYToViewY (int y) |
Private Types | |
| enum | { SCROLLBAR_THICKNESS = 15 } |
Private Member Functions | |
| void | adjustScrollbarsAndGadgetsAllocation () |
| void | adjustScrollbarValues () |
| void | hscrollbarChanged () |
| void | vscrollbarChanged () |
| void | positionChanged () |
| void | updateCanvasWidgets (int oldScrollX, int oldScrollY) |
Static Private Member Functions | |
| static void | hscrollbarCallback (Fl_Widget *hscrollbar, void *viewportPtr) |
| static void | vscrollbarCallback (Fl_Widget *vscrollbar, void *viewportPtr) |
| static void | draw_area (void *data, int x, int y, int w, int h) |
Private Attributes | |
| int | scrollX |
| int | scrollY |
| int | scrollDX |
| int | scrollDY |
| int | hasDragScroll |
| int | dragScrolling |
| int | dragX |
| int | dragY |
| int | horScrolling |
| int | verScrolling |
| Fl_Scrollbar * | vscrollbar |
| Fl_Scrollbar * | hscrollbar |
| GadgetOrientation | gadgetOrientation [4] |
| lout::container::typed::List < lout::object::TypedPointer < Fl_Widget > > * | gadgets |
| dw::fltk::FltkViewport::FltkViewport | ( | int | x, | |
| int | y, | |||
| int | w, | |||
| int | h, | |||
| const char * | label = 0 | |||
| ) |
| dw::fltk::FltkViewport::~FltkViewport | ( | ) |
References gadgets.
| void dw::fltk::FltkViewport::addGadget | ( | Fl_Widget * | gadget | ) |
References adjustScrollbarsAndGadgetsAllocation(), lout::container::typed::List< T >::append(), and gadgets.
| void dw::fltk::FltkViewport::adjustScrollbarsAndGadgetsAllocation | ( | ) | [private] |
References GADGET_HORIZONTAL, GADGET_VERTICAL, gadgetOrientation, gadgets, hscrollbar, lout::container::typed::Collection< T >::iterator(), SCROLLBAR_THICKNESS, lout::container::typed::List< T >::size(), and vscrollbar.
Referenced by addGadget(), resize(), setGadgetOrientation(), and setViewportSize().
| void dw::fltk::FltkViewport::adjustScrollbarValues | ( | ) | [private] |
References dw::fltk::FltkViewBase::canvasHeight, dw::fltk::FltkViewBase::canvasWidth, hscrollbar, scrollX, scrollY, and vscrollbar.
Referenced by scrollTo(), and setCanvasSize().
| void dw::fltk::FltkViewport::draw | ( | ) |
Reimplemented from dw::fltk::FltkViewBase.
References draw_area(), hscrollbar, SCROLLBAR_THICKNESS, scrollDX, scrollDY, and vscrollbar.
| void dw::fltk::FltkViewport::draw_area | ( | void * | data, | |
| int | x, | |||
| int | y, | |||
| int | w, | |||
| int | h | |||
| ) | [static, private] |
| int dw::fltk::FltkViewport::getHScrollbarThickness | ( | ) | [virtual] |
Get the thickness of the horizontal scrollbar, when it is visible.
Does not have to be implemented, when usesViewport returns false.
Implements dw::core::View.
References SCROLLBAR_THICKNESS.
| int dw::fltk::FltkViewport::getVScrollbarThickness | ( | ) | [virtual] |
Get the thickness of the vertical scrollbar, when it is visible.
Does not have to be implemented, when usesViewport returns false.
Implements dw::core::View.
References SCROLLBAR_THICKNESS.
| int dw::fltk::FltkViewport::handle | ( | int | event | ) |
Reimplemented from dw::fltk::FltkViewBase.
References dw::core::style::CURSOR_DEFAULT, dw::core::style::CURSOR_MOVE, dragScrolling, dragX, dragY, dw::fltk::FltkViewBase::handle(), hasDragScroll, horScrolling, hscrollbar, dw::fltk::FltkViewBase::mouse_x, dw::fltk::FltkViewBase::mouse_y, positionChanged(), scroll(), dw::fltk::FltkViewBase::setCursor(), verScrolling, and vscrollbar.
| void dw::fltk::FltkViewport::hscrollbarCallback | ( | Fl_Widget * | hscrollbar, | |
| void * | viewportPtr | |||
| ) | [static, private] |
Referenced by FltkViewport().
| void dw::fltk::FltkViewport::hscrollbarChanged | ( | ) | [private] |
References hscrollbar, scroll(), and scrollX.
| void dw::fltk::FltkViewport::positionChanged | ( | ) | [private] |
| void dw::fltk::FltkViewport::resize | ( | int | x, | |
| int | y, | |||
| int | w, | |||
| int | h | |||
| ) |
| void dw::fltk::FltkViewport::scroll | ( | dw::core::ScrollCommand | ) | [virtual] |
Scroll the viewport as commanded.
Reimplemented from dw::core::View.
References dw::core::BOTTOM_CMD, dw::fltk::FltkViewBase::canvasHeight, hscrollbar, dw::core::LEFT_CMD, dw::core::LINE_DOWN_CMD, dw::core::LINE_UP_CMD, dw::core::RIGHT_CMD, dw::core::SCREEN_DOWN_CMD, dw::core::SCREEN_UP_CMD, scroll(), scrollTo(), scrollX, dw::core::TOP_CMD, and vscrollbar.
| void dw::fltk::FltkViewport::scroll | ( | int | dx, | |
| int | dy | |||
| ) |
References scrollTo(), scrollX, and scrollY.
Referenced by handle(), hscrollbarChanged(), scroll(), setViewportSize(), and vscrollbarChanged().
| void dw::fltk::FltkViewport::scrollTo | ( | int | x, | |
| int | y | |||
| ) | [virtual] |
Scroll the vieport to the given position.
Does not have to be implemented, when usesViewport returns false.
Implements dw::core::View.
References adjustScrollbarValues(), dw::fltk::FltkViewBase::canvasHeight, dw::fltk::FltkViewBase::canvasWidth, hscrollbar, lout::misc::max(), lout::misc::min(), positionChanged(), SCROLLBAR_THICKNESS, scrollDX, scrollDY, dw::core::Layout::scrollPosChanged(), scrollX, scrollY, dw::fltk::FltkViewBase::theLayout, updateCanvasWidgets(), and vscrollbar.
Referenced by scroll().
| void dw::fltk::FltkViewport::setCanvasSize | ( | int | width, | |
| int | ascent, | |||
| int | descent | |||
| ) | [virtual] |
| void dw::fltk::FltkViewport::setDragScroll | ( | bool | enable | ) | [inline] |
References hasDragScroll.
| void dw::fltk::FltkViewport::setGadgetOrientation | ( | bool | hscrollbarVisible, | |
| bool | vscrollbarVisible, | |||
| FltkViewport::GadgetOrientation | gadgetOrientation | |||
| ) |
References adjustScrollbarsAndGadgetsAllocation().
| void dw::fltk::FltkViewport::setScrollStep | ( | int | step | ) |
References hscrollbar, and vscrollbar.
| void dw::fltk::FltkViewport::setViewportSize | ( | int | width, | |
| int | height, | |||
| int | hScrollbarThickness, | |||
| int | vScrollbarThickness | |||
| ) | [virtual] |
Set the viewport size.
Does not have to be implemented, when usesViewport returns false.
This will normally imply a resize of the UI widget. Width and height are the dimensions of the new size, including the scrollbar thicknesses.
Implements dw::core::View.
References adjustScrollbarsAndGadgetsAllocation(), hscrollbar, scroll(), scrollX, scrollY, and vscrollbar.
| int dw::fltk::FltkViewport::translateCanvasXToViewX | ( | int | x | ) | [protected, virtual] |
| int dw::fltk::FltkViewport::translateCanvasYToViewY | ( | int | y | ) | [protected, virtual] |
| int dw::fltk::FltkViewport::translateViewXToCanvasX | ( | int | x | ) | [protected, virtual] |
| int dw::fltk::FltkViewport::translateViewYToCanvasY | ( | int | y | ) | [protected, virtual] |
| void dw::fltk::FltkViewport::updateCanvasWidgets | ( | int | oldScrollX, | |
| int | oldScrollY | |||
| ) | [private] |
| bool dw::fltk::FltkViewport::usesViewport | ( | ) | [virtual] |
| void dw::fltk::FltkViewport::vscrollbarCallback | ( | Fl_Widget * | vscrollbar, | |
| void * | viewportPtr | |||
| ) | [static, private] |
Referenced by FltkViewport().
| void dw::fltk::FltkViewport::vscrollbarChanged | ( | ) | [private] |
References scroll(), scrollY, and vscrollbar.
int dw::fltk::FltkViewport::dragScrolling [private] |
Referenced by FltkViewport(), handle(), and positionChanged().
int dw::fltk::FltkViewport::dragX [private] |
Referenced by handle().
int dw::fltk::FltkViewport::dragY [private] |
Referenced by handle().
Referenced by adjustScrollbarsAndGadgetsAllocation(), and FltkViewport().
lout::container::typed::List<lout::object::TypedPointer < Fl_Widget> >* dw::fltk::FltkViewport::gadgets [private] |
Referenced by addGadget(), adjustScrollbarsAndGadgetsAllocation(), draw_area(), FltkViewport(), and ~FltkViewport().
int dw::fltk::FltkViewport::hasDragScroll [private] |
Referenced by FltkViewport(), handle(), and setDragScroll().
int dw::fltk::FltkViewport::horScrolling [private] |
Referenced by FltkViewport(), and handle().
Fl_Scrollbar * dw::fltk::FltkViewport::hscrollbar [private] |
int dw::fltk::FltkViewport::scrollDX [private] |
Referenced by draw(), FltkViewport(), and scrollTo().
int dw::fltk::FltkViewport::scrollDY [private] |
Referenced by draw(), FltkViewport(), and scrollTo().
int dw::fltk::FltkViewport::scrollX [private] |
int dw::fltk::FltkViewport::scrollY [private] |
int dw::fltk::FltkViewport::verScrolling [private] |
Referenced by FltkViewport(), and handle().
Fl_Scrollbar* dw::fltk::FltkViewport::vscrollbar [private] |
1.5.9