Wt::Widget Class Reference

#include <widget.h>

Inherits Wt::Object, Wt::LayoutItem, and Wt::Pixmap.

Inherited by Wt::Button, Wt::Frame, and Wt::Window.

List of all members.

Public Types

 NoFocus = 0
 TabFocus = 1 << 0
 ClickFocus = 1 << 1
 StrongFocus = TabFocus | ClickFocus
 WheelFocus = 1 << 2 | StrongFocus
enum  FocusPolicy {
  NoFocus = 0, TabFocus = 1 << 0, ClickFocus = 1 << 1, StrongFocus = TabFocus | ClickFocus,
  WheelFocus = 1 << 2 | StrongFocus
}

Public Member Functions

 Widget (Widget *parent=0, const std::string &name="Widget::anon", int Wflags=0)
virtual ~Widget ()
WidgetparentWidget () const
 parents are guaranteed to be widgets and not general wobjects
WidgettopParentWidget () const
void reparent (Widget *new_parent)
int width () const
int height () const
Size size () const
Rect rect () const
Point mapToGlobal (const Point &pos) const
Point mapFromGlobal (const Point &pos) const
Point mapToParent (const Point &pos) const
Point mapFromParent (const Point &pos) const
Region mapToGlobal (const Region &region) const
Region mapToParent (const Region &region) const
virtual void setBackgroundColor (const Color &c)
const ColorbackgroundColor () const
virtual void setForegroundColor (const Color &c)
const ColorforegroundColor () const
virtual bool setBackgroundPixmapFlags (int flags, int alignment)
virtual void setBackgroundPixmap (const Pixmap &pixmap, int flags=0, int alignment=0)
const PixmapbackgroundPixmap () const
int backgroundPixmapFlags () const
int backgroundPixmapAlignment () const
const Fontfont () const
virtual void setFont (const Font &font)
void unsetFont ()
virtual bool event (Event *e)
 event handling
virtual void resize (int w, int h)
void resize (const Size &size)
virtual void move (int x, int y)
void move (const Point &p)
virtual void setGeometry (int x, int y, int w, int h)
virtual void setGeometry (const Rect &r)
void update (const Rect &r)
void update (int x, int y, int w, int h)
void update ()
void repaint (const Rect &r, bool erase=true)
void repaint (const Region &r, bool erase=true)
void repaint (int x, int y, int w, int h, bool erase=true)
void repaint (bool erase)
void repaint ()
void updateGeometry ()
void raise ()
void lower ()
bool isShown () const
bool isHidden () const
bool isEmpty () const
virtual Size sizeHint () const
virtual void setSizeHint (const Size &size)
virtual Size minimumSize () const
virtual void setMinimumSize (const Size &size)
virtual Size maximumSize () const
virtual void setMaximumSize (const Size &size)
virtual SizePolicy sizePolicy () const
virtual void setSizePolicy (const SizePolicy &size_policy)
virtual SizePolicy::ExpandData expanding () const
Layoutlayout () const
void setLayout (Layout *layout)
void erase (const Rect &r)
void erase (const Region &r)
void erase (int x, int y, int w, int h)
void erase ()
void drawText (int x, int y, const std::string &text)
void drawText (const Point &p, const std::string &text)
WidgetchildAt (const Point &p, bool self_include=false) const
WidgetchildAt (int x, int y, bool self_include=false) const
WidgetfocusWidget () const
bool hasFocus () const
bool isFocusEnabled (int reason) const
virtual void setFocus (int reason)
void grabKeyboard ()
void releaseKeyboard ()
void grabMouse ()
void releaseMouse ()
virtual void hide ()
virtual void show ()
bool close ()
virtual bool close (bool destroy)
void setHidden (bool do_hide=true)
void setShown (bool do_show=true)
virtual void enable ()
virtual void disable ()
void setEnabled (bool do_enable=true)
void setDisabled (bool do_disable=true)

Static Public Member Functions

static void update (Widget *w, const Region &region)
static WidgetkeyboardGrabber ()
static WidgetmouseGrabber ()

Public Attributes

WVar< bool > hidden
 public attributes
WVar< bool > enabled
WVar< bool > mouseTracking
WVar< int > focusPolicy
WVar< int > ownFont

Protected Member Functions

virtual void mousePressEvent (MouseEvent *)
 event handling specialization
virtual void mouseReleaseEvent (MouseEvent *)
virtual void mouseDoubleClickEvent (MouseEvent *)
virtual void mouseMoveEvent (MouseEvent *)
virtual void wheelEvent (WheelEvent *)
virtual void focusInEvent (FocusEvent *)
virtual void focusOutEvent (FocusEvent *)
virtual void keyPressEvent (KeyEvent *)
virtual void keyReleaseEvent (KeyEvent *)
virtual void enterEvent (Event *)
virtual void leaveEvent (Event *)
virtual void paintEvent (PaintEvent *)
virtual void resizeEvent (ResizeEvent *)
virtual void moveEvent (MoveEvent *)
virtual void showEvent (ShowEvent *)
virtual void hideEvent (HideEvent *)
virtual void closeEvent (CloseEvent *)
virtual void draw (Painter *p, const Region &region)
 widget should be able to draw itself
bool autoerase ()
bool autoclip ()
virtual void fontChange (const Font &oldFont)
void updateBackground ()
FocusDatafocusData () const
virtual bool focusNextPrevChild (bool next)
 cycles focus amongs widgets
void hiddenChanged (bool hidden_new)
bool is_hidden (bool val) const
bool is_enabled (bool val) const

Protected Attributes

Signal01< void, Layout * > layoutChanged


Member Enumeration Documentation

enum Wt::Widget::FocusPolicy

Enumerator:
NoFocus 
TabFocus 
ClickFocus 
StrongFocus 
WheelFocus 


Constructor & Destructor Documentation

Wt::Widget::Widget ( Widget parent = 0,
const std::string &  name = "Widget::anon",
int  Wflags = 0 
) [explicit]

Todo:
document why we need explicit?

Wt::Widget::~Widget (  )  [virtual]


Member Function Documentation

bool Wt::Widget::autoclip (  )  [inline, protected]

bool Wt::Widget::autoerase (  )  [inline, protected]

const Color & Wt::Widget::backgroundColor (  )  const

Reimplemented in Wt::Window::Frame.

const Pixmap& Wt::Widget::backgroundPixmap (  )  const [inline]

int Wt::Widget::backgroundPixmapAlignment (  )  const [inline]

int Wt::Widget::backgroundPixmapFlags (  )  const [inline]

Widget* Wt::Widget::childAt ( int  x,
int  y,
bool  self_include = false 
) const [inline]

Widget * Wt::Widget::childAt ( const Point p,
bool  self_include = false 
) const

bool Wt::Widget::close ( bool  destroy  )  [virtual]

bool Wt::Widget::close (  ) 

void Wt::Widget::closeEvent ( CloseEvent  )  [protected, virtual]

void Wt::Widget::disable (  )  [virtual]

void Wt::Widget::draw ( Painter p,
const Region region 
) [protected, virtual]

widget should be able to draw itself

A clever widget can draw only the parts of it that are specified in the region argument. A not so clever widget can safely ignore the region argument and draw the entire widget area.

Keep in mind that double buffering is already implemented and you can't gain anything by reimplementing it again at this level.

Reimplemented in Wt::Button, and Wt::Frame.

void Wt::Widget::drawText ( const Point p,
const std::string &  text 
)

void Wt::Widget::drawText ( int  x,
int  y,
const std::string &  text 
)

void Wt::Widget::enable (  )  [virtual]

void Wt::Widget::enterEvent ( Event  )  [protected, virtual]

Reimplemented in Wt::Button, and Wt::Window::Frame.

void Wt::Widget::erase (  ) 

void Wt::Widget::erase ( int  x,
int  y,
int  w,
int  h 
)

void Wt::Widget::erase ( const Region r  ) 

void Wt::Widget::erase ( const Rect r  ) 

bool Wt::Widget::event ( Event e  )  [virtual]

event handling

Reimplemented from Wt::Object.

SizePolicy::ExpandData Wt::Widget::expanding (  )  const [virtual]

Reimplemented from Wt::LayoutItem.

FocusData* Wt::Widget::focusData (  )  const [inline, protected]

void Wt::Widget::focusInEvent ( FocusEvent  )  [protected, virtual]

Reimplemented in Wt::Button.

bool Wt::Widget::focusNextPrevChild ( bool  next  )  [protected, virtual]

cycles focus amongs widgets

Todo:
use Boost graph or tree in order to make this simple function and FocusData to carry the meat of the implementation instead the other way around
Bug:
Backtab is working unexpectedly
Bug:
focusNextPrevChild is not working right for widgets with children

void Wt::Widget::focusOutEvent ( FocusEvent  )  [protected, virtual]

Reimplemented in Wt::Button.

Widget* Wt::Widget::focusWidget (  )  const [inline]

const Font & Wt::Widget::font (  )  const

Reimplemented in Wt::Window::Frame.

void Wt::Widget::fontChange ( const Font oldFont  )  [protected, virtual]

Reimplemented in Wt::Label.

const Color & Wt::Widget::foregroundColor (  )  const

Reimplemented in Wt::Window::Frame.

void Wt::Widget::grabKeyboard (  ) 

void Wt::Widget::grabMouse (  ) 

bool Wt::Widget::hasFocus (  )  const [inline]

int Wt::Widget::height (  )  const [inline]

void Wt::Widget::hiddenChanged ( bool  hidden_new  )  [protected]

void Wt::Widget::hide (  )  [virtual]

Reimplemented in Wt::Window.

void Wt::Widget::hideEvent ( HideEvent  )  [protected, virtual]

bool Wt::Widget::is_enabled ( bool  val  )  const [protected]

bool Wt::Widget::is_hidden ( bool  val  )  const [protected]

bool Wt::Widget::isEmpty (  )  const [inline, virtual]

Reimplemented from Wt::LayoutItem.

bool Wt::Widget::isFocusEnabled ( int  reason  )  const

bool Wt::Widget::isHidden (  )  const [inline]

bool Wt::Widget::isShown (  )  const [inline]

Widget * Wt::Widget::keyboardGrabber (  )  [static]

void Wt::Widget::keyPressEvent ( KeyEvent  )  [protected, virtual]

Reimplemented in Wt::Button.

void Wt::Widget::keyReleaseEvent ( KeyEvent  )  [protected, virtual]

Reimplemented in Wt::Button.

Layout* Wt::Widget::layout (  )  const [inline]

void Wt::Widget::leaveEvent ( Event  )  [protected, virtual]

Reimplemented in Wt::Button, and Wt::Window::Frame.

void Wt::Widget::lower (  ) 

Reimplemented in Wt::Window.

Point Wt::Widget::mapFromGlobal ( const Point pos  )  const

Point Wt::Widget::mapFromParent ( const Point pos  )  const

Region Wt::Widget::mapToGlobal ( const Region region  )  const

Point Wt::Widget::mapToGlobal ( const Point pos  )  const

Region Wt::Widget::mapToParent ( const Region region  )  const

Point Wt::Widget::mapToParent ( const Point pos  )  const

Size Wt::Widget::maximumSize (  )  const [virtual]

Reimplemented from Wt::LayoutItem.

Size Wt::Widget::minimumSize (  )  const [virtual]

Reimplemented from Wt::LayoutItem.

void Wt::Widget::mouseDoubleClickEvent ( MouseEvent  )  [protected, virtual]

Widget * Wt::Widget::mouseGrabber (  )  [static]

void Wt::Widget::mouseMoveEvent ( MouseEvent  )  [protected, virtual]

Reimplemented in Wt::Window::Frame.

void Wt::Widget::mousePressEvent ( MouseEvent  )  [protected, virtual]

event handling specialization

Reimplemented in Wt::Button, and Wt::Window::Frame.

void Wt::Widget::mouseReleaseEvent ( MouseEvent  )  [protected, virtual]

Reimplemented in Wt::Button, and Wt::Window::Frame.

void Wt::Widget::move ( const Point p  ) 

void Wt::Widget::move ( int  x,
int  y 
) [virtual]

void Wt::Widget::moveEvent ( MoveEvent  )  [protected, virtual]

void Wt::Widget::paintEvent ( PaintEvent  )  [protected, virtual]

Reimplemented in Wt::RootWindow.

Widget* Wt::Widget::parentWidget (  )  const [inline]

parents are guaranteed to be widgets and not general wobjects

void Wt::Widget::raise (  ) 

Reimplemented in Wt::Window.

Rect Wt::Widget::rect (  )  const [inline]

Reimplemented from Wt::PixmapOf< SDLPixmap >.

void Wt::Widget::releaseKeyboard (  ) 

void Wt::Widget::releaseMouse (  ) 

void Wt::Widget::repaint (  ) 

void Wt::Widget::repaint ( bool  erase  ) 

void Wt::Widget::repaint ( int  x,
int  y,
int  w,
int  h,
bool  erase = true 
)

void Wt::Widget::repaint ( const Region r,
bool  erase = true 
)

void Wt::Widget::repaint ( const Rect r,
bool  erase = true 
)

void Wt::Widget::reparent ( Widget new_parent  ) 

void Wt::Widget::resize ( const Size size  ) 

Reimplemented from Wt::PixmapOf< SDLPixmap >.

void Wt::Widget::resize ( int  w,
int  h 
) [virtual]

Reimplemented in Wt::RootWindow.

void Wt::Widget::resizeEvent ( ResizeEvent  )  [protected, virtual]

void Wt::Widget::setBackgroundColor ( const Color c  )  [virtual]

Reimplemented in Wt::Window, and Wt::Window::Frame.

void Wt::Widget::setBackgroundPixmap ( const Pixmap pixmap,
int  flags = 0,
int  alignment = 0 
) [virtual]

bool Wt::Widget::setBackgroundPixmapFlags ( int  flags,
int  alignment 
) [virtual]

void Wt::Widget::setDisabled ( bool  do_disable = true  ) 

void Wt::Widget::setEnabled ( bool  do_enable = true  ) 

void Wt::Widget::setFocus ( int  reason  )  [virtual]

void Wt::Widget::setFont ( const Font font  )  [virtual]

Reimplemented in Wt::Window::Frame.

void Wt::Widget::setForegroundColor ( const Color c  )  [virtual]

Reimplemented in Wt::Window::Frame.

void Wt::Widget::setGeometry ( const Rect r  )  [virtual]

Reimplemented from Wt::LayoutItem.

void Wt::Widget::setGeometry ( int  x,
int  y,
int  w,
int  h 
) [virtual]

void Wt::Widget::setHidden ( bool  do_hide = true  ) 

void Wt::Widget::setLayout ( Layout layout  ) 

void Wt::Widget::setMaximumSize ( const Size size  )  [virtual]

Reimplemented from Wt::LayoutItem.

void Wt::Widget::setMinimumSize ( const Size size  )  [virtual]

Reimplemented from Wt::LayoutItem.

void Wt::Widget::setShown ( bool  do_show = true  ) 

void Wt::Widget::setSizeHint ( const Size size  )  [virtual]

Reimplemented from Wt::LayoutItem.

void Wt::Widget::setSizePolicy ( const SizePolicy size_policy  )  [virtual]

Reimplemented from Wt::LayoutItem.

void Wt::Widget::show (  )  [virtual]

Reimplemented in Wt::Window.

void Wt::Widget::showEvent ( ShowEvent  )  [protected, virtual]

Size Wt::Widget::size (  )  const [inline]

Reimplemented from Wt::PixmapOf< SDLPixmap >.

Size Wt::Widget::sizeHint (  )  const [virtual]

Reimplemented from Wt::LayoutItem.

SizePolicy Wt::Widget::sizePolicy (  )  const [virtual]

Reimplemented from Wt::LayoutItem.

Widget* Wt::Widget::topParentWidget (  )  const [inline]

void Wt::Widget::unsetFont (  ) 

void Wt::Widget::update (  ) 

Reimplemented in Wt::Button, and Wt::Label.

void Wt::Widget::update ( int  x,
int  y,
int  w,
int  h 
)

void Wt::Widget::update ( const Rect r  ) 

void Wt::Widget::update ( Widget w,
const Region region 
) [static]

Parameters:
w widget to send clipped paint event
region should be in w coordinates

void Wt::Widget::updateBackground (  )  [protected]

void Wt::Widget::updateGeometry (  ) 

Widget::updateGeometry() should call Widget::setGeometry() if there is no parent

void Wt::Widget::wheelEvent ( WheelEvent  )  [protected, virtual]

int Wt::Widget::width (  )  const [inline]


Member Data Documentation

WVar<bool> Wt::Widget::enabled

WVar<int> Wt::Widget::focusPolicy

WVar<bool> Wt::Widget::hidden

public attributes

Signal01<void, Layout *> Wt::Widget::layoutChanged [protected]

WVar<bool> Wt::Widget::mouseTracking

WVar<int> Wt::Widget::ownFont


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

Generated Fri Jul 28 19:22:39 2006.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.