Yate: Window Class Reference

Yate

Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Window Class Referenceabstract

An abstract user interface window. More...

`#include <yatecbase.h>`

Inheritance diagram for Window:

## Public Member Functions
| Window (const char *id=0)
virtual | ~Window ()
virtual const String & | toString () const
virtual void | title (const String &text)
virtual void | context (const String &text)
virtual bool | setParams (const NamedList &params)
virtual void | setOver (const Window *parent)=0
virtual bool | hasElement (const String &name)=0
virtual bool | setActive (const String &name, bool active)=0
virtual bool | setFocus (const String &name, bool select=false)=0
virtual bool | setShow (const String &name, bool visible)=0
virtual bool | setText (const String &name, const String &text, bool richText=false)=0
virtual bool | setCheck (const String &name, bool checked)=0
virtual bool | setSelect (const String &name, const String &item)=0
virtual bool | setUrgent (const String &name, bool urgent)=0
virtual bool | hasOption (const String &name, const String &item)=0
virtual bool | addOption (const String &name, const String &item, bool atStart=false, const String &text=String::empty())=0
virtual bool | getOptions (const String &name, NamedList *items)=0
virtual bool | delOption (const String &name, const String &item)=0
virtual bool | addLines (const String &name, const NamedList *lines, unsigned int max, bool atStart=false)
virtual bool | addTableRow (const String &name, const String &item, const NamedList *data=0, bool atStart=false)
virtual bool | setMultipleRows (const String &name, const NamedList &data, const String &prefix=String::empty())
virtual bool | insertTableRow (const String &name, const String &item, const String &before, const NamedList *data=0)
virtual bool | delTableRow (const String &name, const String &item)
virtual bool | setTableRow (const String &name, const String &item, const NamedList *data)
virtual bool | updateTableRow (const String &name, const String &item, const NamedList *data=0, bool atStart=false)
virtual bool | updateTableRows (const String &name, const NamedList *data, bool atStart=false)
virtual bool | getTableRow (const String &name, const String &item, NamedList *data=0)
virtual bool | clearTable (const String &name)
virtual bool | setBusy (const String &name, bool on)=0
virtual bool | getText (const String &name, String &text, bool richText=false)=0
virtual bool | getCheck (const String &name, bool &checked)=0
virtual bool | getSelect (const String &name, String &item)=0
virtual bool | getSelect (const String &name, NamedList &items)=0
virtual bool | buildMenu (const NamedList &params)=0
virtual bool | removeMenu (const NamedList &params)=0
virtual bool | setImage (const String &name, const String &image, bool fit=false)=0
virtual bool | setProperty (const String &name, const String &item, const String &value)
virtual bool | getProperty (const String &name, const String &item, String &value)
void | populate ()
void | init ()
virtual void | show ()=0
virtual void | hide ()=0
virtual void | size (int width, int height)=0
virtual void | move (int x, int y)=0
virtual void | moveRel (int dx, int dy)=0
virtual bool | related (const Window *wnd) const
virtual void | menu (int x, int y)=0
virtual bool | canClose ()
const String & | id () const
const String & | title () const
const String & | context () const
bool | visible () const
void | visible (bool yes)
bool | active () const
bool | master () const
bool | popup () const
virtual bool | createDialog (const String &name, const String &title, const String &alias=String::empty(), const NamedList *params=0)=0
virtual bool | closeDialog (const String &name)=0
Public Member Functions inherited from GenObject
| GenObject ()
virtual | ~GenObject ()
virtual bool | alive () const
virtual void | destruct ()
virtual const String & | traceId () const
virtual void * | getObject (const String &name) const
NamedCounter * | getObjCounter () const
NamedCounter * | setObjCounter (NamedCounter *counter)

## Static Public Member Functions
static bool | isValidParamPrefix (const String &prefix)
Static Public Member Functions inherited from GenObject
static void * | getObject (const String &name, const GenObject *obj)
static bool | getObjCounting ()
static void | setObjCounting (bool enable)
static NamedCounter * | getObjCounter (const String &name, bool create=true)
static ObjList & | getObjCounters ()

## Protected Member Functions
virtual void | doPopulate ()=0
virtual void | doInit ()=0

## Protected Attributes
String | m_id
String | m_title
String | m_context
bool | m_visible
bool | m_active
bool | m_master
bool | m_popup
bool | m_saveOnClose

## Friends
class | Client

## Detailed Description

An abstract user interface window.

A window is the basic user interface element. Everything inside is implementation specific functionality.

## Constructor & Destructor Documentation

## ◆ Window()

Window | ( | const char * | id = 0 | ) |
| explicit

Constructor, creates a new windows with an ID

Parameters

  id | String identifier of the new window

Referenced by related(), and setOver().

## ◆ ~Window()

virtual ~Window | ( |  | ) |
| virtual

Destructor

## Member Function Documentation

## ◆ active()

bool active | ( |  | ) | const
| inline

Check if this window is the active one

Returns
  True if window is active

Referenced by setActive().

## ◆ addLines()

virtual bool addLines | ( | const String & | name,
|  | const NamedList * | lines,
|  | unsigned int | max,
|  | bool | atStart = false )
| virtual

Append or insert text lines to a widget

Parameters

  name | The name of the widget
  lines | List containing the lines
  max | The maximum number of lines allowed to be displayed. Set to 0 to ignore
  atStart | True to insert, false to append

Returns
  True on success

## ◆ addOption()

virtual bool addOption | ( | const String & | name,
|  | const String & | item,
|  | bool | atStart = false,
|  | const String & | text = String::empty() )
| pure virtual

Add an item to an element that supports such an operation (list)

Parameters

  name | Name of the element
  item | Name of the item to add
  atStart | True to insert item on the first position, false to append
  text | Displayed text to associate with the item (not all lists support it)

Returns
  True if the operation was successfull

References String::empty().

## ◆ addTableRow()

virtual bool addTableRow | ( | const String & | name,
|  | const String & | item,
|  | const NamedList * | data = 0,
|  | bool | atStart = false )
| virtual

Add a row to a table owned by this window

Parameters

  name | Name of the element
  item | Name of the item to add
  data | Table's columns to set
  atStart | True to insert, false to append

Returns
  True if the operation was successfull

## ◆ buildMenu()

virtual bool buildMenu | ( | const NamedList & | params | ) |
| pure virtual

Build a menu from a list of parameters. See Client::buildMenu() for more info

Parameters

  params | Menu build parameters

Returns
  True on success

## ◆ canClose()

virtual bool canClose | ( |  | ) |
| inlinevirtual

Check if this window can be closed

Returns
  True if this window can be closed, false to prevent hiding it

## ◆ clearTable()

virtual bool clearTable | ( | const String & | name | ) |
| virtual

Clear (delete all rows) a table owned by this window

Parameters

  name | Name of the element

Returns
  True if the operation was successfull

## ◆ closeDialog()

virtual bool closeDialog | ( | const String & | name | ) |
| pure virtual

Destroy a modal dialog

Parameters

  name | Dialog name

Returns
  True on success

## ◆ context() [1/2]

const String & context | ( |  | ) | const
| inline

Get the contextual information previously associated with this window

Returns
  String contextual information

## ◆ context() [2/2]

virtual void context | ( | const String & | text | ) |
| virtual

Set the contextual information previously associated with this window

Parameters

  text | New contextual information

## ◆ createDialog()

virtual bool createDialog | ( | const String & | name,
|  | const String & | title,
|  | const String & | alias = String::empty(),
|  | const NamedList * | params = 0 )
| pure virtual

Create a modal dialog

Parameters

  name | Dialog name (resource config section)
  title | Dialog title
  alias | Optional dialog alias (used as dialog object name)
  params | Optional dialog parameters

Returns
  True on success

References String::empty().

## ◆ delOption()

virtual bool delOption | ( | const String & | name,
|  | const String & | item )
| pure virtual

Remove an item from an element (list)

Parameters

  name | Name of the element
  item | Name of the item to remove

Returns
  True if the operation was successfull

## ◆ delTableRow()

virtual bool delTableRow | ( | const String & | name,
|  | const String & | item )
| virtual

Delete a row from a table owned by this window

Parameters

  name | Name of the element
  item | Name of the item to remove

Returns
  True if the operation was successfull

## ◆ getCheck()

virtual bool getCheck | ( | const String & | name,
|  | bool & | checked )
| pure virtual

Get the checked state of a checkable control

Parameters

  name | Name of the element
  checked | The checked state of the control

Returns
  True if the operation was successfull

## ◆ getOptions()

virtual bool getOptions | ( | const String & | name,
|  | NamedList * | items )
| pure virtual

Get an element's items

Parameters

  name | Name of the element to search for
  items | List to fill with element's items

Returns
  True if the element exists

## ◆ getProperty()

virtual bool getProperty | ( | const String & | name,
|  | const String & | item,
|  | String & | value )
| inlinevirtual

Get a property from this window or from a widget owned by it

Parameters

  name | Name of the element
  item | Property's name
  value | Property's value

Returns
  True on success

## ◆ getSelect() [1/2]

virtual bool getSelect | ( | const String & | name,
|  | NamedList & | items )
| pure virtual

Retrieve an element's multiple selection

Parameters

  name | Name of the element
  items | List to be to filled with selection's contents

Returns
  True if the operation was successfull

## ◆ getSelect() [2/2]

virtual bool getSelect | ( | const String & | name,
|  | String & | item )
| pure virtual

Retrieve an element's selection

Parameters

  name | Name of the element
  item | String to fill with selection's contents

Returns
  True if the operation was successfull

## ◆ getTableRow()

virtual bool getTableRow | ( | const String & | name,
|  | const String & | item,
|  | NamedList * | data = 0 )
| virtual

Retrieve a row from a table owned by this window

Parameters

  name | Name of the element
  item | Name of the item to retrieve
  data | List to fill with table's columns contents

Returns
  True if the operation was successfull

## ◆ getText()

virtual bool getText | ( | const String & | name,
|  | String & | text,
|  | bool | richText = false )
| pure virtual

Get an element's text

Parameters

  name | Name of the element
  text | The destination string
  richText | True to get the element's roch text if supported.

Returns
  True if the operation was successfull

## ◆ hasElement()

virtual bool hasElement | ( | const String & | name | ) |
| pure virtual

Check if this window has an element by name

Parameters

  name | Name of the element to search for

Returns
  True if one element with the given name exists

## ◆ hasOption()

virtual bool hasOption | ( | const String & | name,
|  | const String & | item )
| pure virtual

Check if an element has an item by its name

Parameters

  name | Name of the element to search for
  item | Name of the item that should be searched

Returns
  True if one item with the given name exists in the element

## ◆ hide()

virtual void hide | ( |  | ) |
| pure virtual

Hide this window

Referenced by visible().

## ◆ id()

const String & id | ( |  | ) | const
| inline

Retrieve the standard name of this Window

Returns
  Identifier of this window

## ◆ init()

void init | ( |  | ) |
| inline

Initialize the window if not already done

## ◆ insertTableRow()

virtual bool insertTableRow | ( | const String & | name,
|  | const String & | item,
|  | const String & | before,
|  | const NamedList * | data = 0 )
| virtual

Insert a row into a table owned by this window

Parameters

  name | Name of the element
  item | Name of the item to insert
  before | Name of the item to insert before
  data | Table's columns to set

Returns
  True if the operation was successfull

## ◆ isValidParamPrefix()

bool isValidParamPrefix | ( | const String & | prefix | ) |
| static

Check if a string is a parameter prefix handled by setParams(). Exact prefix match is not a valid one

Parameters

  prefix | String to check

Returns
  True if the given prefix is a valid one

## ◆ master()

bool master | ( |  | ) | const
| inline

Check if this window is a master (topmost) window

Returns
  True if this window is topmost

## ◆ move()

virtual void move | ( | int | x,
|  | int | y )
| pure virtual

Move this window

Parameters

  x | The x coordinate of the upper left corner
  y | The y coordinate of the upper left corner

## ◆ moveRel()

virtual void moveRel | ( | int | dx,
|  | int | dy )
| pure virtual

Move this window related to its current position

Parameters

  dx | The value to be added to the current x coordinate of the upper left corner
  dy | The value to be added to the current y coordinate of the upper left corner

## ◆ populate()

void populate | ( |  | ) |
| inline

Populate the window if not already done

## ◆ popup()

bool popup | ( |  | ) | const
| inline

Check if this window is a popup window

Returns
  True if this window is initially hidden

## ◆ related()

virtual bool related | ( | const Window * | wnd | ) | const
| virtual

Checkes if this window is related to the given window

Parameters

  wnd | The window to check for any relation

Returns
  False if wnd is this window or a master one

References Window().

## ◆ removeMenu()

virtual bool removeMenu | ( | const NamedList & | params | ) |
| pure virtual

Remove a menu (from UI and memory) See Client::removeMenu() for more info

Parameters

  params | Menu remove parameters

Returns
  True on success

## ◆ setActive()

virtual bool setActive | ( | const String & | name,
|  | bool | active )
| pure virtual

Set an element as interactive in the window

Parameters

  name | Name of the element
  active | True to make interactive, false to disallow interaction

Returns
  True if the operation was successfull

References active().

## ◆ setBusy()

virtual bool setBusy | ( | const String & | name,
|  | bool | on )
| pure virtual

Show or hide control busy state

Parameters

  name | Name of the element
  on | True to show, false to hide

Returns
  True if all the operations were successfull

## ◆ setCheck()

virtual bool setCheck | ( | const String & | name,
|  | bool | checked )
| pure virtual

Set the checked or toggled status of an element in the window

Parameters

  name | Name of the element
  checked | True to make element checked or toggled

Returns
  True if the operation was successfull

## ◆ setFocus()

virtual bool setFocus | ( | const String & | name,
|  | bool | select = false )
| pure virtual

Set an element as receiving input in the window

Parameters

  name | Name of the element
  select | Also select the content of the focused element

Returns
  True if the operation was successfull

## ◆ setImage()

virtual bool setImage | ( | const String & | name,
|  | const String & | image,
|  | bool | fit = false )
| pure virtual

Set an element's image

Parameters

  name | Name of the element
  image | Image to set
  fit | Fit image in element (defaults to false)

Returns
  True on success

## ◆ setMultipleRows()

virtual bool setMultipleRows | ( | const String & | name,
|  | const NamedList & | data,
|  | const String & | prefix = String::empty() )
| virtual

Append or update several table rows at once

Parameters

  name | Name of the element
  data | Parameters to initialize the rows with
  prefix | Prefix to match (and remove) in parameter names

Returns
  True if all the operations were successfull

References String::empty().

## ◆ setOver()

virtual void setOver | ( | const Window * | parent | ) |
| pure virtual

Force this window on top of another one which becomes its parent

Parameters

  parent | Window to force as parent of this one

References Window().

## ◆ setParams()

virtual bool setParams | ( | const NamedList & | params | ) |
| virtual

Set window parameters or widget contents

Parameters

  params | List of parameters to set in the window and its widgets

Returns
  True if all parameters could be set

## ◆ setProperty()

virtual bool setProperty | ( | const String & | name,
|  | const String & | item,
|  | const String & | value )
| inlinevirtual

Set a property for this window or for a widget owned by it

Parameters

  name | Name of the element
  item | Property's name
  value | Property's value

Returns
  True on success

## ◆ setSelect()

virtual bool setSelect | ( | const String & | name,
|  | const String & | item )
| pure virtual

Set the selection of an item in an element in the window

Parameters

  name | Name of the element
  item | Name of the item that should be selected

Returns
  True if the operation was successfull

## ◆ setShow()

virtual bool setShow | ( | const String & | name,
|  | bool | visible )
| pure virtual

Set the visibility of an element in the window

Parameters

  name | Name of the element
  visible | True to make element visible, false to hide it

Returns
  True if the operation was successfull

References visible().

## ◆ setTableRow()

virtual bool setTableRow | ( | const String & | name,
|  | const String & | item,
|  | const NamedList * | data )
| virtual

Update a row from a table owned by this window

Parameters

  name | Name of the element
  item | Name of the item to update
  data | Data to update

Returns
  True if the operation was successfull

## ◆ setText()

virtual bool setText | ( | const String & | name,
|  | const String & | text,
|  | bool | richText = false )
| pure virtual

Set the displayed text of an element in the window

Parameters

  name | Name of the element
  text | Text value to set in the element
  richText | True if the text contains format data

Returns
  True if the operation was successfull

## ◆ setUrgent()

virtual bool setUrgent | ( | const String & | name,
|  | bool | urgent )
| pure virtual

Flag an element as requiring immediate attention

Parameters

  name | Name of the element
  urgent | True if the element requires immediate attention

Returns
  True if the operation was successfull

## ◆ show()

virtual void show | ( |  | ) |
| pure virtual

Show this window

Referenced by visible().

## ◆ size()

virtual void size | ( | int | width,
|  | int | height )
| pure virtual

Resize this window

Parameters

  width | The new width
  height | The new width

## ◆ toString()

virtual const String & toString | ( |  | ) | const
| virtual

Retrieve the standard name of this Window, used to search in lists

Returns
  Identifier of this window

Reimplemented from GenObject.

Referenced by ClientContact::isChatWnd().

## ◆ updateTableRow()

virtual bool updateTableRow | ( | const String & | name,
|  | const String & | item,
|  | const NamedList * | data = 0,
|  | bool | atStart = false )
| virtual

Set a table row or add a new one if not found

Parameters

  name | Name of the element
  item | Table item to set/add
  data | Optional list of parameters used to set row data
  atStart | True to add item at start, false to add them to the end

Returns
  True if the operation was successfull

## ◆ updateTableRows()

virtual bool updateTableRows | ( | const String & | name,
|  | const NamedList * | data,
|  | bool | atStart = false )
| virtual

Add or set one or more table row(s). Screen update is locked while changing the table. Each data list element is a NamedPointer carrying a NamedList with item parameters. The name of an element is the item to update. Set element's value to boolean value 'true' to add a new item if not found or 'false' to set an existing one. Set it to empty string to delete the item

Parameters

  name | Name of the table
  data | The list of items to add/set/delete
  atStart | True to add new items at start, false to add them to the end

Returns
  True if the operation was successfull

## ◆ visible() [1/2]

bool visible | ( |  | ) | const
| inline

Get the visibility status of this window

Returns
  True if window is visible, false if it's hidden

Referenced by setShow().

## ◆ visible() [2/2]

void visible | ( | bool | yes | ) |
| inline

Set the visibility status of this window

Parameters

  yes | True if window should be visible

References hide(), and show().

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

- yatecbase.h