ubit::UWin Class Reference

Base class for windows and menus (abstract class). More...

#include <uwin.hpp>

Inheritance diagram for ubit::UWin:

ubit::UBox ubit::UGroup ubit::UControl ubit::UBrick ubit::UObject ubit::UDialog ubit::UMenu ubit::UFrame ubit::UPopmenu ubit::UPiemenu ubit::UCtlmenu ubit::UCtlmenu3d List of all members.

Public Member Functions

 UWin (const UArgs &=UArgs::none)
 constructor; see class UWin.
virtual ~UWin ()
 recursive destructor.
virtual class UWinwinCast ()
UWinaddlist (const UArgs &a)
 adds a list of arguments to the end the child list.
virtual UWinsetTitle (const UStr &, UDisp *=null)
 changes the title of the window.
virtual void setPos (UMouseEvent &, float x=0, float y=0)
 moves the upper left corner of the window to the event location.
virtual void setPos (const UWin &win, const UPoint &, UDisp *=null)
 moves the upper left corner of the window relatively to this position in 'win'.
virtual void setPos (const UView &view, const UPoint &)
 moves the upper left corner of the window relatively to this position in 'view'.
virtual void setPos (const UView &view, const UPlacement &)
 moves the window according to this UPlacement and relatively to 'view' .
virtual void setPosOnScreen (const UPoint &, UDisp *=null)
 moves the upper left corner of the window to this position on the screen.
virtual void centerOnScreen (UDisp *=null)
virtual UPoint getPos (const UWin &win, UDisp *=null) const
 returns the position of the upper left corner of the window relatively to 'win'.
virtual UPoint getPos (const UView &view) const
 returns the position of the upper left corner of the window relatively to 'view'.
virtual UPoint getPosOnScreen (UDisp *=null) const
 returns the position of the upper left corner of the window on the screen.
virtual float getWidth (UDisp *=null) const
 returns the window width.
virtual float getHeight (UDisp *=null) const
 returns the window height.
virtual UDimension getSize (UDisp *=null) const
 returns the window size on this display.
virtual void setSize (const UDimension &, UDisp *=null)
 changes the window size on this display.
virtual void adjustSize ()
 adjusts the size of the window according to its content.
virtual void setFullScreen (bool state, UDisp *=null)
 set full screen mode on or off.
virtual void toBack (UDisp *=null)
 sends this window to the back on this display.
virtual void toFront (UDisp *=null)
 brings this window to the front on this display.
virtual bool isShown () const
 returns true if this object is shown.
virtual bool isShown (UDisp *) const
 is the window currently shown ?
virtual void show (bool state, UDisp *)
virtual void show (bool state=true)
 shows/hides the window.
virtual bool isModal () const
 is this dialog modal?.
virtual void setModal (bool=true)
 sets this dialog in modal or non modal mode.
virtual int showModal (UDisp *=null)
 shows a window in modal mode and returns its closing status.
virtual void close (int status=0)
 closes the window.
virtual void repaint ()
 specifies that this object must be repainted.
virtual void update ()
 specifies that the layout and the paint of this object must be updated.
virtual void update (const UUpdate &mode)
 specifies that the layout and/or the paint of this object must be updated.
virtual void update (const UUpdate &, UDisp *)
 specifies that the layout and/or the paint of this window must be updated on this display.
bool isHardWin () const
bool isSoftWin () const
 is this window a "hard window" or a "soft window" ?.
virtual UWinsetSoftWin (bool=true)
 sets the "soft window" mode if arg is true.
virtual bool realize ()
 [impl] initializes the window and its children.
UNatWingetNatWin (UDisp *=null) const
 [impl] returns the Native Window that is used for drawing this window
UViewgetWinView (UDisp *) const
 [impl] returns the corresponding view.
virtual void highlight (bool state)
 [impl].

Static Public Member Functions

static UStylecreateStyle ()
 < important: all subclasses MUST contain this declaration. static function that returns the UStyle of this class (see details!).

Detailed Description

Base class for windows and menus (abstract class).

UWin is an abstract class for creating toplevel windows:

A UWin can be added as a child: of the UAppli; of a given UDisp (if the application is displayed on several machines); or of any UBox Note that, as other UBricks, windows can have several parents.

Layout: The size of windows is computed the first time they appear on the screen (this is typically done by calling UWin::show()). By default, the size won't change when children are added or removed. Hence, children should be added before the first call to show(). It can be changed afterward by calling adjustSize() or setSize() or through user interaction.

Implicit hehaviors: if a parent of a window is a UButton (or a subclass), clicking on this button will open the window automatically


Constructor & Destructor Documentation

ubit::UWin::~UWin (  )  [virtual]

recursive destructor.

children are automatically destroyed if not pointed elsewhere (in the instance graph or by a uptr<>). see class UBrick for details.


Member Function Documentation

UWin& ubit::UWin::addlist ( const UArgs a  )  [virtual]

adds a list of arguments to the end the child list.

Exemple:

   UBox* b = new UBox(); 
   b->addlist( UColor::red + UFont::bold + "abcd" );
 

Reimplemented from ubit::UBox.

void ubit::UWin::adjustSize (  )  [virtual]

adjusts the size of the window according to its content.

By default, the size of a window does not change when children are added or removed. This function adjusts the size of a window to the size of its children

void ubit::UWin::close ( int  status = 0  )  [virtual]

closes the window.

This function is called when the "Close" button of the window decoration is clicked. Its default behavior is to call show(false). It can be redefined by subclasses for more specific behaviors (eg. for saving data or for closing the application)

'status' is returned by showModal() if it was used to open the menu. `status' must be >= 0 (0 is the default value:

See also:
showModal())

Reimplemented from ubit::UGroup.

Reimplemented in ubit::UFrame.

UStyle * ubit::UWin::createStyle (  )  [static]

< important: all subclasses MUST contain this declaration. static function that returns the UStyle of this class (see details!).

this macro defines the UClass that corresponds to this class and:

Reimplemented from ubit::UBox.

Reimplemented in ubit::UCtlmenu, ubit::UMenu, ubit::UPopmenu, ubit::UPiemenu, ubit::UDialog, and ubit::UFrame.

bool ubit::UWin::isShown (  )  const [virtual]

returns true if this object is shown.

isShown() returns true if this object is "showable" (see isShowable()) and all its parents are also "showable". Note that "shown" objects are not always visible on the screen as they may be hidden or clipped by other objects such as scroll panes.

See also:
: isShowable(), UGroup::show()

Reimplemented from ubit::UControl.

bool ubit::UWin::isSoftWin (  )  const

is this window a "hard window" or a "soft window" ?.

Notes:

bool ubit::UWin::realize (  )  [virtual]

[impl] initializes the window and its children.

this function called when the window is shown for the first time

Reimplemented in ubit::UMenu, ubit::UDialog, and ubit::UFrame.

virtual void ubit::UWin::repaint (  )  [virtual]

specifies that this object must be repainted.

note that actual painting is generally delayed (

See also:
UUpdate). this function is a shortcut for: update(UUpdate::paint)

Reimplemented from ubit::UBox.

void ubit::UWin::setPos ( UMouseEvent ,
float  x = 0,
float  y = 0 
) [virtual]

moves the upper left corner of the window to the event location.

(x, y) are added to the event location.

void ubit::UWin::setPosOnScreen ( const UPoint &  ,
UDisp = null 
) [virtual]

moves the upper left corner of the window to this position on the screen.

!!COMPLETER

UWin & ubit::UWin::setSoftWin ( bool  = true  )  [virtual]

sets the "soft window" mode if arg is true.

this mode can only be set *before* window initialization (ie. before the window is added to a visible object) see isSoftwin() for details.

virtual void ubit::UWin::show ( bool  state = true  )  [virtual]

shows/hides the window.

windows are not shown by default; show() must be called to make them visible. Note that the window size will not change after the first call to show(). setSize() or updateSize() must be called to change its size.

See also:
also: showModal() to open a modal window.

Reimplemented from ubit::UGroup.

Reimplemented in ubit::UMenu, ubit::UPiemenu, ubit::UDialog, and ubit::UFrame.

int ubit::UWin::showModal ( UDisp = null  )  [virtual]

shows a window in modal mode and returns its closing status.

showModal() returns when the window is closed (through user interaction or programmatically by calling close()). The returned value is :

void ubit::UWin::update ( const UUpdate ,
UDisp  
) [virtual]

specifies that the layout and/or the paint of this window must be updated on this display.

the specific actions that will take place depend on the UUpdate argument. Note that these actions are generally delayed:

See also:
UUpdate for details.
This function does not change the size of the window. adjustSize() or setSize() must be called to change the window size

void ubit::UWin::update ( const UUpdate mode  )  [virtual]

specifies that the layout and/or the paint of this object must be updated.

the specific actions that will take place depend on the UUpdate argument. Note that these actions are generally delayed:

See also:
UUpdate for details.

Reimplemented from ubit::UBox.

virtual void ubit::UWin::update (  )  [virtual]

specifies that the layout and the paint of this object must be updated.

note that these actions are generally delayed (

See also:
UUpdate). this function is a shortcut for: update(UUpdate::layoutAndPaint)

Reimplemented from ubit::UBox.


The documentation for this class was generated from the following files:
Generated on Mon Jan 29 00:20:57 2007 for Ubit by  doxygen 1.4.7