cwidget::widgets::widget Class Reference

The basic widget interface. More...

#include <widget.h>

Inheritance diagram for cwidget::widgets::widget:

cwidget::widgets::button cwidget::widgets::label cwidget::widgets::pager cwidget::widgets::text_layout cwidget::widgets::file_pager cwidget::widgets::multiplex cwidget::widgets::size_box cwidget::widgets::transient

List of all members.

Public Types

typedef std::list
< binding_connection >
::iterator 
key_connection

Public Member Functions

void incref ()
void decref ()
void show ()
virtual void show_all ()
void hide ()
void toggle_visible ()
void set_visible (bool _visible)
bool dispatch_key (const config::key &k)
virtual void dispatch_mouse (short id, int x, int y, int z, mmask_t bstate)
virtual int width_request ()=0
 
Returns:
the desired width of the widget.

virtual int height_request (int width)=0
 Calculate the desired height of the widget, given its width.
void alloc_size (int x, int y, int w, int h)
 Set the size and location in the parent of this widget.
virtual bool focus_me ()
bool get_isfocussed ()
void set_owner (container *w)
void display (const style &st)
 Display this widget in the given style environment.
int timeout (int msecs)
virtual void destroy ()
 Destroys the visible representation of this widget and disconnects it from any children that it may have.
util::ref_ptr< container > get_owner ()
virtual bool get_cursorvisible ()=0
virtual point get_cursorloc ()=0
int get_startx ()
int get_starty ()
int get_width ()
int get_height ()
bool get_visible ()
void sync ()
int scroll (int n=1)
int addch (chtype ch)
int mvaddch (int y, int x, chtype ch)
int add_wch (wchar_t wch)
int add_wch (const cchar_t *cch)
int mvadd_wch (int y, int x, wchar_t wch)
int mvadd_wch (int y, int x, const cchar_t *cch)
int addstr (const char *str)
int addnstr (const char *str, int n)
int mvaddstr (int y, int x, const char *str)
int mvaddnstr (int y, int x, const char *str, int n)
int addstr (const wchar_t *str)
int addnstr (const wchar_t *str, int n)
int mvaddstr (int y, int x, const wchar_t *str)
int mvaddnstr (int y, int x, const wchar_t *str, int n)
int addstr (const std::wstring &str)
int addnstr (const std::wstring &str, int n)
int mvaddstr (int y, int x, const std::wstring &str)
int mvaddnstr (int y, int x, const std::wstring &str, int n)
int addstr (const wchstring &str)
int addnstr (const wchstring &str, int n)
int mvaddstr (int y, int x, const wchstring &str)
int mvaddnstr (int y, int x, const wchstring &str, int n)
int addstr (const chstring &str)
int addnstr (const chstring &str, int n)
int mvaddstr (int y, int x, const chstring &str)
int mvaddnstr (int y, int x, const chstring &str, int n)
int attroff (int attrs)
int attron (int attrs)
int attrset (int attrs)
void bkgdset (const chtype ch)
int bkgd (const chtype ch)
chtype getbkgd ()
int border (chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br)
int box (chtype verch, chtype horch)
int hline (chtype ch, int n)
int vline (chtype ch, int n)
int mvhline (int y, int x, chtype ch, int n)
int mvvline (int y, int x, chtype ch, int n)
int delch ()
int mvdelch (int y, int x)
int deleteln ()
int insdelln (int n)
int insertln ()
int echochar (chtype ch)
int move (int y, int x)
void getyx (int &y, int &x)
void getbegyx (int &y, int &x)
void getmaxyx (int &y, int &x)
int getmaxy ()
int getmaxx ()
void show_string_as_progbar (int x, int y, const std::wstring &s, const style &st1, const style &st2, int size1, int totalsize)
void display_header (std::wstring s, const style &st)
void display_status (std::wstring s, const style &st)
int erase ()
int clear ()
int clrtobot ()
int clrtoeol ()
int keypad (bool bf)
int meta (bool bf)
bool enclose (int y, int x)
void set_opaque (bool opaque)
 Enable or disable clearing the background before displaying the widget.
void set_bg_style (const style &new_style)
 Update this widget's basic style to the given value.
void apply_style (const style &st)
 Set the display attributes of our associated window directly from the given style.
key_connection connect_key (const std::string &key, config::keybindings *bindings, const sigc::slot0< void > &slot)
key_connection connect_key_post (const std::string &key, config::keybindings *bindings, const sigc::slot0< void > &slot)
void disconnect_key (key_connection c)
void disconnect_key_post (key_connection c)

Static Public Member Functions

static void handle_pending_deletes ()

Public Attributes

sigc::signal0< void > shown_sig
sigc::signal0< void > hidden_sig
sigc::signal0< void > destroyed
sigc::signal0< void > do_layout
sigc::signal0< void > focussed
sigc::signal0< void > unfocussed

Protected Member Functions

cwindow get_win ()
virtual void paint (const style &st)=0
 Display this widget.
virtual bool handle_key (const config::key &k)
 Handles a keypress in this widget.
void cleanup ()
 Handle cleanup when the reference count goes to 0.

Friends

class container
bool toplevel::poll ()
void toplevel::mainloop (int)
void toplevel::redraw ()
util::ref_ptr< widgettoplevel::settoplevel (const util::ref_ptr< widget > &)
void toplevel::suspend_without_signals ()
void toplevel::resume ()
void toplevel::updatecursornow ()
void toplevel::handleresize ()

Classes

struct  binding_connection


Detailed Description

The basic widget interface.

Note that due to the current reference counting implementation, this is not presently threadsafe.


Member Function Documentation

virtual void cwidget::widgets::widget::paint ( const style st  )  [protected, pure virtual]

Display this widget.

Parameters:
st the style environment in which the widget is to be displayed.

Implemented in cwidget::widgets::button, cwidget::widgets::label, cwidget::widgets::multiplex, cwidget::widgets::pager, and cwidget::widgets::text_layout.

bool cwidget::widgets::widget::handle_key ( const config::key k  )  [protected, virtual]

Handles a keypress in this widget.

Parameters:
k the key that was pressed (see keybindings.h).
Returns:
true if the key was consumed; if false is returned, further processing of the key will be performed.

Reimplemented in cwidget::widgets::button, cwidget::widgets::pager, and cwidget::widgets::text_layout.

void cwidget::widgets::widget::cleanup (  )  [protected]

Handle cleanup when the reference count goes to 0.

virtual int cwidget::widgets::widget::width_request (  )  [pure virtual]

Returns:
the desired width of the widget.

Implemented in cwidget::widgets::button, cwidget::widgets::label, cwidget::widgets::multiplex, cwidget::widgets::pager, cwidget::widgets::size_box, cwidget::widgets::text_layout, and cwidget::widgets::transient.

virtual int cwidget::widgets::widget::height_request ( int  width  )  [pure virtual]

Calculate the desired height of the widget, given its width.

Parameters:
width the width of this widget
Returns:
the desired height

Implemented in cwidget::widgets::button, cwidget::widgets::label, cwidget::widgets::multiplex, cwidget::widgets::pager, cwidget::widgets::size_box, cwidget::widgets::text_layout, and cwidget::widgets::transient.

void cwidget::widgets::widget::alloc_size ( int  x,
int  y,
int  w,
int  h 
)

Set the size and location in the parent of this widget.

This routine should be called by the parent to actually resize and/or move the widget around. There is no guarantee that the new width and height bear any relation to what the _request functions asked for, although the parent is expected to make a best-effort attempt to give a widget its desired size.

As a special case, calling alloc_size(0, 0, 0, 0) indicates that the widget has no allocation at all.

Parameters:
x the new x location within the parent
y the new y location within the parent
w the new width of the widget
h the new height of the widget

void cwidget::widgets::widget::display ( const style st  ) 

Display this widget in the given style environment.

This is an interface function only; subclasses should override paint() to control behavior (but should call display() on subwidgets).

Parameters:
st the style environment in which this widget should be displayed.

void cwidget::widgets::widget::set_opaque ( bool  opaque  )  [inline]

Enable or disable clearing the background before displaying the widget.

Parameters:
opaque if true (the default setting), the widget's entire area will be overwritten with its background style prior to displaying it.

void cwidget::widgets::widget::set_bg_style ( const style new_style  ) 

Update this widget's basic style to the given value.

The style stack must be empty.

void cwidget::widgets::widget::apply_style ( const style st  ) 

Set the display attributes of our associated window directly from the given style.

(it is expected that subclasses will use this to control what is output to the window)


The documentation for this class was generated from the following files:
Generated on Fri Feb 8 12:54:57 2008 for cwidget by  doxygen 1.5.4