Faith::Widget Class Reference

a Widget is a class which represents a user-interface component. More...

#include <faith/widget.h>

Inheritance diagram for Faith::Widget:

Faith::Object Faith::PaintDevice Faith::ComboBox Faith::Label Faith::LineEdit Faith::MainWindow Faith::MenuBar Faith::PopupMenu Faith::PushButton Faith::ScrollBar Faith::ScrollView Faith::Slider Faith::ToolBar Faith::ToolButton List of all members.

Public Types

 DeleteOnClose = 1 << 0
 TopLevel = 1 << 1
 Popup = (1 << 2) | TopLevel
 AvoidInit = 1<<3
 RepaintNoErase = 1<<4
 NoFocus
 WeakFocus
 ClickFocus
enum  Flags {
  DeleteOnClose = 1 << 0, TopLevel = 1 << 1, Popup = (1 << 2) | TopLevel, AvoidInit = 1<<3,
  RepaintNoErase = 1<<4
}
enum  FocusMode { NoFocus, WeakFocus, ClickFocus }

Public Slots

virtual void show ()
virtual void hide ()
void setCaption (const Faith::String &title)
void update ()

Signals

void hidden ()
void shown ()
void closed ()

Public Member Functions

 Widget (Widget *parent, const char *name=0, int wflags=0)
virtual ~Widget ()
void setFlags (int flags)
int flags () const
virtual Handle handle ()
Faith::String caption () const
Faith::Layoutlayout ()
SizePolicy sizePolicy () const
void setSizePolicy (const SizePolicy &p)
void setSizePolicy (SizePolicy::Policy h, SizePolicy::Policy v)
Faith::Rect rect () const
Faith::Rect geometry () const
int width () const
int height () const
Faith::Size minimumSize () const
Faith::Size maximumSize () const
void setMinimumSize (const Faith::Size &size)
void setMaximumSize (const Faith::Size &size)
Faith::Size size () const
Faith::Point topLeft () const
void move (int x, int y)
void resize (int w, int h)
void setWidth (int w)
void setHeight (int h)
void move (const Faith::Point &pt)
void resize (const Faith::Size &sz)
void setGeometry (int x, int y, int w, int h)
void setGeometry (const Rect &r)
Faith::WidgetparentWidget ()
const Faith::WidgetparentWidget () const
Faith::Point mapFromGlobal (const Faith::Point &pt) const
Faith::Point mapToGlobal (const Faith::Point &pt) const
Faith::Rect mapFromGlobal (const Faith::Rect &rect) const
Faith::Rect mapToGlobal (const Faith::Rect &rect) const
const Faith::PixmaperasePixmap () const
const ColorGroupcolorGroup () const
void setPaletteBackgroundColor (const Color &color)
Faith::Color paletteBackgroundColor () const
void setMouseTracking (bool on)
void grabMouse ()
void releaseMouse ()
void setFocusMode (FocusMode mode)
FocusMode focusMode () const
bool hasFocus () const
bool isVisible () const
void setActiveWindow ()
bool topLevel () const
void repaint ()
FontMetrics fontMetrics () const
virtual Size sizeHint () const
Stylestyle ()
const Stylestyle () const
virtual bool event (Faith::Event *event)
virtual void mousePressEvent (Faith::MouseEvent *)
virtual void mouseReleaseEvent (Faith::MouseEvent *)
virtual void mouseMoveEvent (Faith::MouseEvent *)
virtual void keyPressEvent (Faith::KeyPressEvent *)
virtual void paintEvent (Faith::PaintEvent *e)
virtual void focusInEvent (Faith::FocusEvent *)
virtual void focusOutEvent (Faith::FocusEvent *)
virtual void enterEvent (Faith::Event *)
virtual void leaveEvent (Faith::Event *)
virtual void showEvent (Faith::Event *)
virtual void hideEvent (Faith::Event *)
virtual void closeEvent (Faith::CloseEvent *)
virtual void resizeEvent (Faith::ResizeEvent *)
virtual void moveEvent (Faith::MoveEvent *)

Protected Member Functions

virtual void polish (Style *)

Detailed Description

a Widget is a class which represents a user-interface component.

Every Widget, if it has a parent (in other words, if the parent is not 0), then it becomes a child of the specified parent and thus becomes a "control". If no parent is specified, it becomes a top-level Widget, and is usually given a border, titlebar, etc.

Like everything that inherits from the class Object, when its parent goes away, Widget will also be deleted, so manually deleting Widgets created by new is unnecessary, unless no parent is specified


Member Enumeration Documentation

enum Faith::Widget::Flags

Enumerator:
DeleteOnClose 
TopLevel 
Popup 
AvoidInit 
RepaintNoErase 

enum Faith::Widget::FocusMode

How this widget gets focus WeakFocus is the only strange one here, and it means that the widget only accepts focus with Tabs.

NoFocus is the default

Enumerator:
NoFocus 
WeakFocus 
ClickFocus 


Constructor & Destructor Documentation

Faith::Widget::Widget ( Widget parent,
const char *  name = 0,
int  wflags = 0 
)

Create a widget with the given parent.

The widget will be deleted automatically if a parent is specified

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

the Widget destructor. Performs some book-keeping and also deletes all child Widgets


Member Function Documentation

Faith::String Faith::Widget::caption (  )  const

void Faith::Widget::closed (  )  [signal]

emitted after a closeEvent()

virtual void Faith::Widget::closeEvent ( Faith::CloseEvent  )  [virtual]

This function is called when the user closes this (top-level) Widget. This can be done by clicking "on the little X" or pressing a keyboard shortcut, or using the taskbar, ...

const ColorGroup& Faith::Widget::colorGroup (  )  const [inline]

virtual void Faith::Widget::enterEvent ( Faith::Event  )  [inline, virtual]

Reimplemented in Faith::ToolButton.

const Faith::Pixmap* Faith::Widget::erasePixmap (  )  const [inline]

virtual bool Faith::Widget::event ( Faith::Event event  )  [virtual]

Gets an event from Faith, and gives it to one of the following *Event functions as appropriate.

Faith will delete this event itself, you should not

Reimplemented from Faith::Object.

int Faith::Widget::flags (  )  const [inline]

virtual void Faith::Widget::focusInEvent ( Faith::FocusEvent  )  [inline, virtual]

Reimplemented in Faith::LineEdit.

FocusMode Faith::Widget::focusMode (  )  const [inline]

virtual void Faith::Widget::focusOutEvent ( Faith::FocusEvent  )  [inline, virtual]

Reimplemented in Faith::LineEdit.

FontMetrics Faith::Widget::fontMetrics (  )  const [inline]

Faith::Rect Faith::Widget::geometry (  )  const

Returns:
the rectangle that specifies the window's position and size, excluding its border and titlebar, if applicable.
The position is relative to its parent.

See also:
mapToGlobal

void Faith::Widget::grabMouse (  ) 

After calling this function, this widget will be the only one to recieve mouse events. You should rarely have to use this function as Faith will do it sensibly

See also:
releaseMouse

virtual Handle Faith::Widget::handle (  )  [inline, virtual]

Implements Faith::PaintDevice.

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

Returns:
true if this widget has focus (would receive keypresses)

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

void Faith::Widget::hidden (  )  [signal]

emitted after a hideEvent()

virtual void Faith::Widget::hide (  )  [virtual, slot]

causes the Widget to be hidden immediately, or just as the event loop is entered

will emit hidden(), eventually

See also:
show

virtual void Faith::Widget::hideEvent ( Faith::Event  )  [inline, virtual]

Reimplemented in Faith::PopupMenu.

bool Faith::Widget::isVisible (  )  const

Returns:
if the window is visible
this is false if the window is "shown" but its ancestor is not visible

virtual void Faith::Widget::keyPressEvent ( Faith::KeyPressEvent  )  [inline, virtual]

Reimplemented in Faith::LineEdit.

Faith::Layout* Faith::Widget::layout (  ) 

virtual void Faith::Widget::leaveEvent ( Faith::Event  )  [inline, virtual]

Reimplemented in Faith::MenuBar, Faith::PopupMenu, and Faith::ToolButton.

Faith::Rect Faith::Widget::mapFromGlobal ( const Faith::Rect rect  )  const [inline]

Returns:
the position of rect relative to this Widget.
Parameters:
rect is a rectangle relative to the entire display

Faith::Point Faith::Widget::mapFromGlobal ( const Faith::Point pt  )  const

Returns:
the position of pt relative to this Widget.
Parameters:
pt is a point relative to the entire display

Faith::Rect Faith::Widget::mapToGlobal ( const Faith::Rect rect  )  const [inline]

Returns:
the position of rect relative to the entire display.
Parameters:
rect is a rectangle relative to this Widget

Faith::Point Faith::Widget::mapToGlobal ( const Faith::Point pt  )  const

Returns:
the position of pt relative to the entire display.
Parameters:
pt is a point relative to this Widget

Faith::Size Faith::Widget::maximumSize (  )  const

Returns:
the minimum size of the window
For each dimension of the window: If the size policy is Maximum or Fixed, then it is equal to SizeHint, or it is invalid to mean that the size is unlimited

This is of course unless you call setMinimumSize

See also:
setMaximumSize

Faith::Size Faith::Widget::minimumSize (  )  const

Returns:
the minimum size of the window
For each dimension of the window: If the size policy is Expanding, Minimum or Fixed, then it is equal to SizeHint, otherwise it is 0,0

This is of course unless you call setMinimumSize

See also:
setMinimumSize

virtual void Faith::Widget::mouseMoveEvent ( Faith::MouseEvent  )  [inline, virtual]

Reimplemented in Faith::LineEdit, Faith::MenuBar, Faith::PopupMenu, Faith::PushButton, Faith::ScrollBar, and Faith::Slider.

virtual void Faith::Widget::mousePressEvent ( Faith::MouseEvent  )  [inline, virtual]

This function is called when the user presses the mouse while over the widget (immediately after the push down)

Reimplemented in Faith::ComboBox, Faith::LineEdit, Faith::MenuBar, Faith::PopupMenu, Faith::PushButton, Faith::ScrollBar, Faith::Slider, and Faith::ToolButton.

virtual void Faith::Widget::mouseReleaseEvent ( Faith::MouseEvent  )  [inline, virtual]

This function is called when the use releases the mouse after it has been clicked on this widget.

This function is called even when the mouse was not over this widget. The only condition is that a mousePressEvent was sent to this object prior

Reimplemented in Faith::PopupMenu, Faith::PushButton, Faith::ScrollBar, Faith::Slider, and Faith::ToolButton.

void Faith::Widget::move ( const Faith::Point pt  )  [inline]

void Faith::Widget::move ( int  x,
int  y 
)

virtual void Faith::Widget::moveEvent ( Faith::MoveEvent  )  [inline, virtual]

virtual void Faith::Widget::paintEvent ( Faith::PaintEvent e  )  [virtual]

Reimplemented in Faith::ComboBox, Faith::Label, Faith::LineEdit, Faith::MenuBar, Faith::PopupMenu, Faith::PushButton, Faith::ScrollBar, Faith::ScrollView, Faith::Slider, Faith::ToolBar, and Faith::ToolButton.

Faith::Color Faith::Widget::paletteBackgroundColor (  )  const

Returns:
the background color of the widget as set by setPaletteBackgroundColor()
Or colorGroup().backgroundColor()

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

Faith::Widget* Faith::Widget::parentWidget (  ) 

get the direct parent widget of this widget. if it has a parent, but is marked as Top level, this will be zero

virtual void Faith::Widget::polish ( Style  )  [inline, protected, virtual]

Called with the new style, when the style is changed. This is useful to pick up new sizes of widgets

By default, this does nothing

Reimplemented in Faith::ScrollBar, and Faith::Slider.

Faith::Rect Faith::Widget::rect (  )  const

Returns:
the rectangle that specifies the window's size, or otherwise, Rect(0,0, width(), height())

void Faith::Widget::releaseMouse (  ) 

call this after you want to release the mouse after calling grabMouse

See also:
grabMouse

void Faith::Widget::repaint (  )  [inline]

generate a paintEvent, and send it to me immediately it may be more efficient to use update if there is the possibility that you will call this multiple times without re-entering the event loop.

void Faith::Widget::resize ( const Faith::Size sz  )  [inline]

void Faith::Widget::resize ( int  w,
int  h 
)

virtual void Faith::Widget::resizeEvent ( Faith::ResizeEvent  )  [inline, virtual]

Reimplemented in Faith::ComboBox, and Faith::ScrollView.

void Faith::Widget::setActiveWindow (  ) 

void Faith::Widget::setCaption ( const Faith::String title  )  [slot]

Specifies what text will appear in the titlebar of this Widget, if it is a top-level window.

void Faith::Widget::setFlags ( int  flags  ) 

set any flags, XOred

void Faith::Widget::setFocusMode ( FocusMode  mode  ) 

void Faith::Widget::setGeometry ( const Rect r  )  [inline]

void Faith::Widget::setGeometry ( int  x,
int  y,
int  w,
int  h 
)

void Faith::Widget::setHeight ( int  h  )  [inline]

void Faith::Widget::setMaximumSize ( const Faith::Size size  ) 

set a maximum size to this widget the default is an invalid size which means no limit

Setting this to an invalid value takes maximumSize back to its default behavior

void Faith::Widget::setMinimumSize ( const Faith::Size size  ) 

set a minimum size to this widget the default is Size(0,0)

Setting this to an invalid value takes minimumSize back to its default behavior

void Faith::Widget::setMouseTracking ( bool  on  ) 

enable and disable mouse tracking

when mouse tracking is enabled, this widget always receives MouseMotion events, otherwise, it receives them only when a mouse button is pressed

By default this is disabled

void Faith::Widget::setPaletteBackgroundColor ( const Color color  ) 

set the background color, the color this widget is automatically painted to.

TODO: unsettablize this option

void Faith::Widget::setSizePolicy ( SizePolicy::Policy  h,
SizePolicy::Policy  v 
) [inline]

void Faith::Widget::setSizePolicy ( const SizePolicy p  )  [inline]

void Faith::Widget::setWidth ( int  w  )  [inline]

virtual void Faith::Widget::show (  )  [virtual, slot]

causes the Widget to be shown immediately, or just as the event loop is entered

See also:
hide

shown

Reimplemented in Faith::PopupMenu.

virtual void Faith::Widget::showEvent ( Faith::Event  )  [inline, virtual]

Reimplemented in Faith::PopupMenu.

void Faith::Widget::shown (  )  [signal]

emitted after a showEvent()

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

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

Returns:
this Widget's recommended size.
If this widget doesn't want to make a recommendation, the size will be invalid Faith::Size::isInvalid()

Reimplemented in Faith::ComboBox, Faith::Label, Faith::LineEdit, Faith::PushButton, Faith::ToolBar, and Faith::ToolButton.

SizePolicy Faith::Widget::sizePolicy (  )  const [inline]

const Style* Faith::Widget::style (  )  const [inline]

Style* Faith::Widget::style (  ) 

Faith::Point Faith::Widget::topLeft (  )  const [inline]

bool Faith::Widget::topLevel (  )  const

Returns:
true if the widget has no parent, or is marked as toplevel otherwise

void Faith::Widget::update (  )  [slot]

cause this window to become invalidated, and hence repainted soon

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


The documentation for this class was generated from the following file:
Generated on Fri Sep 1 00:23:09 2006 for Faith by  doxygen 1.4.7