Dillo v3.1.1-14-g8f67d6e0
Loading...
Searching...
No Matches
dw::fltk::FltkViewport Class Reference

#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)
 
- Public Member Functions inherited from dw::fltk::FltkWidgetView
 FltkWidgetView (int x, int y, int w, int h, const char *label=0)
 
 ~FltkWidgetView ()
 
void drawText (core::style::Font *font, core::style::Color *color, core::style::Color::Shading shading, int x, int y, const char *text, int len)
 
void drawSimpleWrappedText (core::style::Font *font, core::style::Color *color, core::style::Color::Shading shading, int x, int y, int w, int h, const char *text)
 
void drawImage (core::Imgbuf *imgbuf, int xRoot, int yRoot, int x, int y, int width, int height)
 
bool usesFltkWidgets ()
 
void addFltkWidget (Fl_Widget *widget, core::Allocation *allocation)
 
void removeFltkWidget (Fl_Widget *widget)
 
void allocateFltkWidget (Fl_Widget *widget, core::Allocation *allocation)
 
void drawFltkWidget (Fl_Widget *widget, core::Rectangle *area)
 
- Public Member Functions inherited from dw::fltk::FltkViewBase
 FltkViewBase (int x, int y, int w, int h, const char *label=0)
 
 ~FltkViewBase ()
 
void draw ()
 
int handle (int event)
 
void setLayout (core::Layout *layout)
 This methods notifies the view, that it has been attached to a layout.
 
void setCursor (core::style::Cursor cursor)
 Set the cursor appearance.
 
void setBgColor (core::style::Color *color)
 Set the background of the view.
 
void startDrawing (core::Rectangle *area)
 Called before drawing.
 
void finishDrawing (core::Rectangle *area)
 Called after drawing.
 
void queueDraw (core::Rectangle *area)
 Queue a region, which is given in canvas coordinates, for drawing.
 
void queueDrawTotal ()
 Queue the total viewport for drawing.
 
void cancelQueueDraw ()
 Cancel a draw queue request.
 
void drawPoint (core::style::Color *color, core::style::Color::Shading shading, int x, int y)
 
void drawLine (core::style::Color *color, core::style::Color::Shading shading, int x1, int y1, int x2, int y2)
 
void drawTypedLine (core::style::Color *color, core::style::Color::Shading shading, core::style::LineType type, int width, int x1, int y1, int x2, int y2)
 
void drawRectangle (core::style::Color *color, core::style::Color::Shading shading, bool filled, int x, int y, int width, int height)
 
void drawArc (core::style::Color *color, core::style::Color::Shading shading, bool filled, int centerX, int centerY, int width, int height, int angle1, int angle2)
 
void drawPolygon (core::style::Color *color, core::style::Color::Shading shading, bool filled, bool convex, core::Point *points, int npoints)
 
core::ViewgetClippingView (int x, int y, int width, int height)
 
void mergeClippingView (core::View *clippingView)
 
void setBufferedDrawing (bool b)
 
- Public Member Functions inherited from lout::object::Object
virtual ~Object ()
 The destructor is defined as virtual (but not abstract), so that destruction of Object's works properly.
 
virtual bool equals (Object *other)
 Returns, whether two objects are equal.
 
virtual int hashValue ()
 Return a hash value for the object.
 
virtual Objectclone ()
 Return an exact copy of the object.
 
virtual void intoStringBuffer (misc::StringBuffer *sb)
 Store a textual representation of the object in a misc::StringBuffer.
 
const char * toString ()
 Use object::Object::intoStringBuffer to return a textual representation of the object.
 
virtual size_t sizeOf ()
 Return the number of bytes, this object totally uses.
 

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 selectionScroll ()
 
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 selectionScroll (void *vport)
 
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
 

Additional Inherited Members

- Protected Attributes inherited from dw::fltk::FltkViewBase
core::LayouttheLayout
 
int canvasWidth
 
int canvasHeight
 
int mouse_x
 
int mouse_y
 
Fl_Widget * focused_child
 

Detailed Description

Definition at line 14 of file fltkviewport.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
SCROLLBAR_THICKNESS 

Definition at line 20 of file fltkviewport.hh.

◆ GadgetOrientation

Enumerator
GADGET_VERTICAL 
GADGET_HORIZONTAL 

Definition at line 17 of file fltkviewport.hh.

Constructor & Destructor Documentation

◆ FltkViewport()

dw::fltk::FltkViewport::FltkViewport ( int  x,
int  y,
int  w,
int  h,
const char *  label = 0 
)

◆ ~FltkViewport()

dw::fltk::FltkViewport::~FltkViewport ( )

Definition at line 85 of file fltkviewport.cc.

References DBG_OBJ_DELETE, and gadgets.

Member Function Documentation

◆ addGadget()

void dw::fltk::FltkViewport::addGadget ( Fl_Widget *  gadget)

◆ adjustScrollbarsAndGadgetsAllocation()

◆ adjustScrollbarValues()

void dw::fltk::FltkViewport::adjustScrollbarValues ( )
private

◆ draw()

void dw::fltk::FltkViewport::draw ( )

Definition at line 205 of file fltkviewport.cc.

References _MSG, draw(), draw_area(), hscrollbar, SCROLLBAR_THICKNESS, scrollDX, scrollDY, and vscrollbar.

Referenced by draw().

◆ draw_area()

void dw::fltk::FltkViewport::draw_area ( void *  data,
int  x,
int  y,
int  w,
int  h 
)
staticprivate

Definition at line 182 of file fltkviewport.cc.

References gadgets, and lout::container::typed::Collection< T >::iterator().

Referenced by draw().

◆ getHScrollbarThickness()

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.

Definition at line 381 of file fltkviewport.cc.

References SCROLLBAR_THICKNESS.

◆ getVScrollbarThickness()

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.

Definition at line 386 of file fltkviewport.cc.

References SCROLLBAR_THICKNESS.

◆ handle()

◆ hscrollbarCallback()

void dw::fltk::FltkViewport::hscrollbarCallback ( Fl_Widget *  hscrollbar,
void *  viewportPtr 
)
staticprivate

Definition at line 164 of file fltkviewport.cc.

Referenced by FltkViewport().

◆ hscrollbarChanged()

void dw::fltk::FltkViewport::hscrollbarChanged ( )
private

Definition at line 149 of file fltkviewport.cc.

References hscrollbar, scroll(), and scrollX.

◆ positionChanged()

◆ resize()

void dw::fltk::FltkViewport::resize ( int  x,
int  y,
int  w,
int  h 
)

◆ scroll() [1/2]

◆ scroll() [2/2]

void dw::fltk::FltkViewport::scroll ( int  dx,
int  dy 
)

◆ scrollTo()

void dw::fltk::FltkViewport::scrollTo ( int  x,
int  y 
)
virtual

◆ selectionScroll() [1/2]

void dw::fltk::FltkViewport::selectionScroll ( )
private

◆ selectionScroll() [2/2]

void dw::fltk::FltkViewport::selectionScroll ( void *  vport)
staticprivate

Definition at line 472 of file fltkviewport.cc.

References selectionScroll().

◆ setCanvasSize()

void dw::fltk::FltkViewport::setCanvasSize ( int  width,
int  ascent,
int  descent 
)
virtual

Set the canvas size.

Reimplemented from dw::fltk::FltkViewBase.

Definition at line 347 of file fltkviewport.cc.

References adjustScrollbarValues(), and dw::fltk::FltkViewBase::setCanvasSize().

◆ setDragScroll()

void dw::fltk::FltkViewport::setDragScroll ( bool  enable)
inline

Definition at line 76 of file fltkviewport.hh.

References hasDragScroll.

Referenced by UIcmd_tab_new().

◆ setGadgetOrientation()

void dw::fltk::FltkViewport::setGadgetOrientation ( bool  hscrollbarVisible,
bool  vscrollbarVisible,
FltkViewport::GadgetOrientation  gadgetOrientation 
)

Definition at line 539 of file fltkviewport.cc.

References adjustScrollbarsAndGadgetsAllocation(), and gadgetOrientation.

◆ setScrollStep()

void dw::fltk::FltkViewport::setScrollStep ( int  step)

Definition at line 370 of file fltkviewport.cc.

References hscrollbar, and vscrollbar.

Referenced by UIcmd_tab_new().

◆ setViewportSize()

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.

Definition at line 478 of file fltkviewport.cc.

References _MSG, adjustScrollbarsAndGadgetsAllocation(), hscrollbar, scroll(), scrollX, scrollY, and vscrollbar.

◆ translateCanvasXToViewX()

int dw::fltk::FltkViewport::translateCanvasXToViewX ( int  x)
protectedvirtual

Implements dw::fltk::FltkViewBase.

Definition at line 527 of file fltkviewport.cc.

References scrollX.

◆ translateCanvasYToViewY()

int dw::fltk::FltkViewport::translateCanvasYToViewY ( int  y)
protectedvirtual

Implements dw::fltk::FltkViewBase.

Definition at line 532 of file fltkviewport.cc.

References scrollY.

◆ translateViewXToCanvasX()

int dw::fltk::FltkViewport::translateViewXToCanvasX ( int  x)
protectedvirtual

Implements dw::fltk::FltkViewBase.

Definition at line 517 of file fltkviewport.cc.

References scrollX.

Referenced by positionChanged().

◆ translateViewYToCanvasY()

int dw::fltk::FltkViewport::translateViewYToCanvasY ( int  y)
protectedvirtual

Implements dw::fltk::FltkViewBase.

Definition at line 522 of file fltkviewport.cc.

References scrollY.

Referenced by positionChanged().

◆ updateCanvasWidgets()

void dw::fltk::FltkViewport::updateCanvasWidgets ( int  oldScrollX,
int  oldScrollY 
)
private

Definition at line 504 of file fltkviewport.cc.

References hscrollbar, and vscrollbar.

Referenced by scrollTo().

◆ usesViewport()

bool dw::fltk::FltkViewport::usesViewport ( )
virtual

Return, whether this view uses a viewport.

Implements dw::core::View.

Definition at line 376 of file fltkviewport.cc.

◆ vscrollbarCallback()

void dw::fltk::FltkViewport::vscrollbarCallback ( Fl_Widget *  vscrollbar,
void *  viewportPtr 
)
staticprivate

Definition at line 159 of file fltkviewport.cc.

Referenced by FltkViewport().

◆ vscrollbarChanged()

void dw::fltk::FltkViewport::vscrollbarChanged ( )
private

Definition at line 154 of file fltkviewport.cc.

References scroll(), scrollY, and vscrollbar.

Member Data Documentation

◆ dragScrolling

int dw::fltk::FltkViewport::dragScrolling
private

Definition at line 24 of file fltkviewport.hh.

Referenced by FltkViewport(), handle(), and positionChanged().

◆ dragX

int dw::fltk::FltkViewport::dragX
private

Definition at line 24 of file fltkviewport.hh.

Referenced by handle().

◆ dragY

int dw::fltk::FltkViewport::dragY
private

Definition at line 24 of file fltkviewport.hh.

Referenced by handle().

◆ gadgetOrientation

GadgetOrientation dw::fltk::FltkViewport::gadgetOrientation[4]
private

◆ gadgets

lout::container::typed::List<lout::object::TypedPointer < Fl_Widget> >* dw::fltk::FltkViewport::gadgets
private

◆ hasDragScroll

int dw::fltk::FltkViewport::hasDragScroll
private

Definition at line 24 of file fltkviewport.hh.

Referenced by FltkViewport(), handle(), and setDragScroll().

◆ horScrolling

int dw::fltk::FltkViewport::horScrolling
private

Definition at line 25 of file fltkviewport.hh.

Referenced by FltkViewport(), and handle().

◆ hscrollbar

◆ scrollDX

int dw::fltk::FltkViewport::scrollDX
private

Definition at line 23 of file fltkviewport.hh.

Referenced by draw(), FltkViewport(), and scrollTo().

◆ scrollDY

int dw::fltk::FltkViewport::scrollDY
private

Definition at line 23 of file fltkviewport.hh.

Referenced by draw(), FltkViewport(), and scrollTo().

◆ scrollX

int dw::fltk::FltkViewport::scrollX
private

◆ scrollY

int dw::fltk::FltkViewport::scrollY
private

◆ verScrolling

int dw::fltk::FltkViewport::verScrolling
private

Definition at line 25 of file fltkviewport.hh.

Referenced by FltkViewport(), and handle().

◆ vscrollbar


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