[TVScrollBar] [Index] [TWindow]

Class TWindow


File: <toad/window.hh>

TWindow is the super class of all windows. A window is a rectangle area on the screen which receives input events, eg. from the mouse pointer, the keyboard, displays graphics and can contain other windows.

Super Classes

TOADBase

Attributes

public static const ulong TMMM_ALL
public static const ulong TMMM_ANYBUTTON
public static const ulong TMMM_FIRST
public static const ulong TMMM_LBUTTON
public static const ulong TMMM_MBUTTON
public static const ulong TMMM_NONE
public static const ulong TMMM_PREVIOUS
public static const ulong TMMM_RBUTTON
protected int _b
protected unsigned char _cursor
protected int _dx
protected int _dy
protected int _h
protected int _w
protected int _x
protected int _y
public bool bBackingStore
public bool bDialogEditRequest
public bool bExplicitCreate
public bool bFocusManager
public bool bFocusTraversal
public bool bNoBackground
public bool bNoFocus
public bool bPopup
public bool bSaveUnder
public bool bShell
public bool bStaticFrame
public bool bTabKey
public bool bVisible
public bool bX11GC
public TColor background
public TWindow *child
public TWindow *next_sibling
public TWindow *parent
public TWindow *prev_sibling
public string title
public _TOAD_WINDOW window

Methods

AddChild
public void AddChild(TWindow * child)
ClearWindow
public void ClearWindow()
ClrMouseMoveMessages
public void ClrMouseMoveMessages(ulong)
Create
public void Create()
Create the X11 window.
Destroy
public void Destroy()
Destroy and remove all children that have been added since Create().
FirstChild
public TWindow * FirstChild()
GetDropArea
public TDropContext * GetDropArea(int, int)
GetRootPos
public void GetRootPos(int*, int*)
GetShape
public void GetShape(TRect*)
GrabMouse
public void GrabMouse(ulong ulMouseMessages=TMMM_PREVIOUS, TWindow * confine_window= ((void *)0))
GrabPopupMouse
public void GrabPopupMouse(ulong ulMouseMessages=TMMM_PREVIOUS)
Same as GrabMouse but window will receive a 'closeRequest' when button is pressed outside the window and the other window will get the mouse event.
Height
public int Height()
Invalidate
public void Invalidate(bool bClrBG=true)
public void Invalidate(int, int, int, int, bool bClrBG=true)
public void Invalidate(const TRect&, bool bClrBG=true)
public void Invalidate(const TRegion &, bool bClrBG=true)
public void Invalidate(const TRegion&, bool bClrBG=true)
Invalidate an area of the window. This will generate a paint event when all other events in the message queue have been processed. Multiple calls to ´Invalidate´ sum up into a single paint event. Before ´paint´ is called, the background of the invalidated area is cleared with the current background color.

IsChildOf
public bool IsChildOf(TWindow *wnd)
IsFocus
public bool IsFocus()
Returns 'true' when the window owns the keyboard focus.
IsRealized
public bool IsRealized()
IsSuppressMessages
public bool IsSuppressMessages()
LastChild
public TWindow * LastChild()
LowerWindow
public void LowerWindow()
NextSibling
public static TWindow * NextSibling(TWindow *ptr)
OriginX
public int OriginX()
OriginY
public int OriginY()
PaintNow
public void PaintNow()
Update the whole invalidated window region right now. The normal behaviour is to wait until no other events than paint events are left in the message queue.
Parent
public TWindow * Parent()
PrevSibling
public static TWindow * PrevSibling(TWindow *ptr)
RaiseWindow
public void RaiseWindow()
RegisterDrop
public void RegisterDrop(TDropContext*)
RemoveChild
public void RemoveChild(TWindow *child)
Run
public int Run(int argc=0, char** argv= ((void *)0), char** envv= ((void *)0))
ScrollRectangle
public void ScrollRectangle(const TRect &rect, int x, int y, bool bClrBG=true)
Scroll area within the given rectangle.

No scrolling occures, when dx or dy are >= the size of the rectangle.

ScrollTo
public void ScrollTo(int x, int y)
Set the origin for all drawing operations and scroll the windows content to the new position.
Attention: Child windows will not be moved!
ScrollWindow
public void ScrollWindow(int x, int y, bool bClrBG=true)
Scroll window contents:
dy>0down
dy<0up
dx>0right
dx<0left
SetBackground
public void SetBackground(const TColor &)
public void SetBackground(byte r, byte g, byte b)
public void SetBackground(const TRGB &c)
public void SetBackground(TColor ::ESystemColor c)
public void SetBackground(TColor ::EColor16 c)
public void SetBackground(TBitmap *)
Select a background bitmap for the window.
SetBorder
public void SetBorder(bool b)
SetCursor
public void SetCursor(TCursor ::EType)
SetFocus
public bool SetFocus()
Requests the keyboard focus for the window.
SetIcon
public void SetIcon(TBitmap *)
SetMouseMoveMessages
public void SetMouseMoveMessages(ulong)
Before a 'mouseMove(int,int,unsigned)' message is called you must select the desired event types. TOAD will deliver a warning when 'mouseMove' is implemented but no messages have been selected. The following values define mode and can be joined by the '|' operator:
TMMM_NONE Don't select any messages now but GrabMouse or GrabPopupMouse might select some messages later.
TMMM_ALL Get all mouse move event types.
TMMM_LBUTTON Enable mouseMove when the left mouse button is held down.
TMMM_MBUTTON Enable mouseMove when the middle mouse button is held down.
(Attention: This might be reserved for drag and drop.)
TMMM_RBUTTON Enable mouseMove when the right mouse button is held down.
TMMM_ANYBUTTON
TMMM_FIRST Get only the first event. (I've never tried that [MAH])
TMMM_LAST Not available yet.
Only deliver the last mouseMove, skip previous events.
TMMM_PREVIOUS Don't make any changes.
The reason why mouseMove is so complicated to handle is performance.
SetOrigin
public void SetOrigin(int x, int y)
Set the origin for all drawing operations.
SetPosition
public void SetPosition(int x, int y)
SetShape
public void SetShape(int, int, int, int)
public void SetShape(const TRect &r)
public void SetShape(const TRect *r)
SetSize
public void SetSize(int x, int y)
SetSuppressMessages
public void SetSuppressMessages(bool)
BEWARE: OLD DESCRIPTION
Some action methods like SetPostion or SetSize call reaction methods, e.g. when calling SetSize it will call resize() and the parents childResize method. Calling SetSuppressMessages(true) will avoid this for some methods. Please don't use this method until you know what you're doing. See also IsSuppressMessages.
SetTitle
public void SetTitle(const string &title)
SetToolTip
public void SetToolTip(const string&)
SetVisible
public void SetVisible(bool)
Show or hide the window.
StartDrag
public void StartDrag(TDragContext*)
Starts the drag operation. dc contains the data to be send.
TWindow
public TWindow(TWindow *parent, const string &title)
public ~TWindow()
Title
public const string & Title()
UngrabMouse
public void UngrabMouse()
UpdateWindow
public void UpdateWindow(bool bEraseBackground=false)
Obsolete, use 'Invalidate' instead.
Visible
public bool Visible()
Returns `true' when the window is visible.
Width
public int Width()
XPos
public int XPos()
YPos
public int YPos()
adjust
public virtual void adjust()
childNotify
public virtual void childNotify(TWindow *, EChildNotify)
closeRequest
public virtual void closeRequest()
create
public virtual void create()
The are two ways to initialize a window:
  • in the constructor, which is usually the best way
  • in create()
create() is invoked after a call to Create() or Run(), right before the actual window is mapped on the desktop.

When you have a window needing some sophisticated configuration and you've decided not to do it all in the constructor but after you've created the object, then you might need a method being called after this configuration is done and before the window will be created.
And this method is create().

When you've decided to use create() you will have to keep some things in mind:

  • Child windows created after Create() will be removed during Destroy().
  • Other objects than child windows you've created during create() should be removed during destroy(), otherwise multiple Create(), Destroy() would result in memory leaks.
    Another good thing you can do is to set pointers to child windows to NULL during destroy. This won't modify the behaviour of your program but it's easier to see during debugging that a window is actually gone.
Otherwise you will get into some fine mess.
createX11Window
public virtual void createX11Window(TX11CreateWindow*)
created
public virtual void created()
Called after the window was created.
debug_check_realized
public void debug_check_realized(const char *txt)
destroy
public virtual void destroy()
focus
public virtual void focus()
Notifies the window that the focus has changed.
getShape
public virtual void getShape(TRect*)
keyDown
public virtual void keyDown(TKey key, char *string, unsigned modifier)
keyUp
public virtual void keyUp(TKey key, char *string, unsigned modifier)
mouseEnter
public virtual void mouseEnter(int x, int y, unsigned modifier)
mouseLDown
public virtual void mouseLDown(int x, int y, unsigned modifier)
mouseLUp
public virtual void mouseLUp(int x, int y, unsigned modifier)
mouseLeave
public virtual void mouseLeave(int x, int y, unsigned modifier)
mouseMDown
public virtual void mouseMDown(int x, int y, unsigned modifier)
mouseMUp
public virtual void mouseMUp(int x, int y, unsigned modifier)
mouseMove
public virtual void mouseMove(int x, int y, unsigned modifier)
mouseRDown
public virtual void mouseRDown(int x, int y, unsigned modifier)
mouseRUp
public virtual void mouseRUp(int x, int y, unsigned modifier)
paint
public virtual void paint()
Called when parts of the window must be redrawn.
resize
public virtual void resize()
saveYourself
public virtual void saveYourself()
setShape
public virtual void setShape(TRect*)

This page was generated with Stupid -- Another stupid C++ to HTML generator
Written 1998,99 by The Wizards of Zilog
Copyright © 1998,99 by the TOAD Project