Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

wftk::Widget Class Reference

Widget Baseclass. More...

#include <widget.h>

Inheritance diagram for wftk::Widget:

wftk::ScreenArea wftk::Label wftk::LineEdit wftk::ProgressBar wftk::SingleContainer wftk::Slider wftk::MultiLineEdit wftk::Button wftk::CornerContainer wftk::Dialog wftk::ListBox wftk::RootWindow wftk::Terminal wftk::PushButton wftk::BorderedDialog wftk::FixedDialog wftk::FullScreenDialog wftk::ToggleButton wftk::MessageDialog wftk::ProgressDialog wftk::QuestionBox List of all members.

Public Member Functions

 Widget ()
 Contstructor.

 Widget (const Surface &backgrnd, bool tileIt=true)
 Constructor which sets the widget background from a given Surface.

 Widget (Surface::Resource *backgrnd, bool tileIt=true)
 Constructor which sets the widget background from a given Resource.

 Widget (const std::string &backgrnd, bool tileIt=true)
 (string is the name of a Resource)

virtual ~Widget ()
 Destructor.

void setBackground (const Surface &backgrnd, bool tileIt=true)
 Set background image.

void setBackground (Surface::Resource *backgrnd, bool tileIt=true)
 Set background image.

void setBackground (const std::string &, bool tileIt=true)
 set background from named resource

void clearBackground ()
 clear background image

Surface::ResourcegetResourceBackground () const
 get the current background

void setColor (const Color &color)
 setting background color.

void setColor (const std::string &)
 set background color from named resource

void setColor (const char *name)
 need this one due to needing Color constructor from const char*

void setDisabledColor (const Color &color)
 to set the background colour when the widget is disabled

void setDisabledColor (const std::string &)
 set disabled color from named resource

void setDisabledColor (const char *name)
 and the const char* version, just like for setColor()

void enable ()
 enable this widget tree

void disable ()
 disable this widget tree.

virtual bool mouseEvent (const Point &, const Point &, Mouse::Button)
 mouse motion event handler

virtual bool buttonEvent (Mouse::Button, bool pressed, const Point &)
 mouse button event handler

virtual void gainedMouse ()
 mouse gain event handler

virtual bool keyEvent (const SDL_keysym &sym, bool pressed)
 keyboard event handler

virtual void gainedFocus ()
 focus gain handler

virtual void lostFocus ()
 focus loss handler

bool isEnabled () const
 returns whether this widget is enabled

const Colorcolor () const
 returns the background color

bool hasFocus () const
 true if the widget has keyboard focus

bool releaseFocus ()
 release the keyboard focus

bool grabFocus ()
 grab the keyboard focus

void setClickToFocus (bool val=true)
 set whether to grab focus on a mouse click

void setPointToFocus (bool val=true)
 set whether to grab focus on mouse entry

WidgetnextFocus ()
 get the next focus in the focus list

WidgetprevFocus ()
 get the previous focus in the focus list

bool acceptsFocus () const
 return whether this widget accepts keyboard focus

void getResourceBackground (const std::string &)
 set background color and image from named resources


Protected Member Functions

virtual void draw (Surface &, const Point &offset, const Region &)
 The area drawn to must lie within the given region.

virtual void drawAfter (Surface &, const Point &offset, const Region &)
 The area drawn to must lie within the given region.

virtual void handleResize (Uint16 w, Uint16 h)
 Calculate new shape for shaped widgets, call to setShape() after a resize.

virtual bool isOpaque () const
 used in Widget's handleResize() implementation, many widgets can reimplement this instead of handleResize()

virtual void setPackingInfo ()
 recalculate the object's prefered size


Detailed Description

Widget Baseclass.


Member Function Documentation

void wftk::Widget::disable  ) 
 

disable this widget tree.

The widget tree gets greyed and the members ignore any events.

void wftk::Widget::draw Surface surf,
const Point offset,
const Region r
[protected, virtual]
 

The area drawn to must lie within the given region.

This is protected so derived classes can call their parents' draw() in their own implementations.

Reimplemented from wftk::ScreenArea.

Reimplemented in wftk::BorderedDialog, wftk::Label, wftk::LineEdit, wftk::PushButton, and wftk::Slider.

void wftk::Widget::drawAfter Surface target,
const Point offset,
const Region r
[protected, virtual]
 

The area drawn to must lie within the given region.

This is protected so derived classes can call their parents' drawAfter() in their own implementations.

Reimplemented from wftk::ScreenArea.

Reimplemented in wftk::RootWindow.


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

Generated Fri Mar 5 08:11:02 2004.
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.