GWindow Class Reference

A top level window. More...

#include <LgiClasses.h>

Inheritance diagram for GWindow:

GView GDragDropTarget GDialog GDocApp< OptionsFmt > GAbout GAlert GFindReplaceCommon GFontSelect GInput GProgressDlg GFindDlg GReplaceDlg

List of all members.

Public Member Functions

char * GetClass ()
virtual void Pour ()
 Lays out the child views into the client area.
GMenuGetMenu ()
 Returns the current menu object.
void SetMenu (GMenu *m)
 Set the menu object.
bool GetQuitOnClose ()
 Gets the "quit on close" setting.
void SetQuitOnClose (bool i)
 Sets the "quit on close" setting.
GWindowZoom GetZoom ()
 Gets the current zoom setting.
void SetZoom (GWindowZoom i)
 Sets the current zoom.
void Raise ()
 Raises the window to the top of the stack.
void OnPosChange ()
 Called when the view position changes.
int OnEvent (GMessage *Msg)
 Called to process every message received by this window.
void OnPaint (GSurface *pDC)
 Called to paint the onscreen representation of the view.
bool OnRequestClose (bool OsShuttingDown)
 Called on a top level window when something requests to close the window.
bool Visible ()
 true if the view is visible
void Visible (bool i)
 Hides/Shows the view.
GRectGetPos ()
 Get the position of the view relitive to it's parent.
bool RegisterHook (GView *Target, int EventType, int Priority=0)
bool UnregisterHook (GView *Target)
 Unregisters a hook target.
virtual void OnZoom (GWindowZoom Action)
 Called when the window zoom state changes.
virtual void OnTrayClick (GMouse &m)
 Called when the tray icon is clicked. (if present).
virtual void OnReceiveFiles (GArray< char * > &Files)
 Called when files are dropped on the window.
bool Attach (GViewI *p)
 Attaches the view to a parent view.
OsWindow WindowHandle ()
 Returns the OS handle of the top level window.
bool Name (char *n)
 Sets the utf-8 text associated with this view.
char * Name ()
 Returns the utf-8 text associated with this view.
bool SetPos (GRect &p, bool Repaint=false)
 Set the position of the view in terms of it's parent.
GRectGetClient (bool InClientSpace=true)
 Get the client region of the window relitive to itself (ie always 0,0-x,y).
int WillAccept (List< char > &Formats, GdcPt2 Pt, int KeyState)
int OnDrop (char *Format, GVariant *Data, GdcPt2 Pt, int KeyState)
void OnChildrenChanged (GViewI *Wnd, bool Attaching)
 Called when the contents of the Children list have changed.
void OnCreate ()
 The view is attached.
GViewI * GetDefault ()
 Gets the default view.
void SetDefault (GViewI *v)
 Sets the default view.
bool SerializeState (GDom *Store, char *FieldName, bool Load)
 Saves/loads the window's state, e.g. position, minimized/maximized etc.

Protected Attributes

GViewI * _Default
 The default button.
GMenuMenu
 The menu on the window.
int VirtualFocusId
 Focus when in virtual control.

Friends

class GView
class GButton
class GDialog


Detailed Description

A top level window.

Member Function Documentation

bool GWindow::Attach ( GViewI *  p  )  [virtual]

Attaches the view to a parent view.

Each GView starts in an un-attached state. When you attach it to a Parent GView the view gains a OS-specific handle and becomes visible on the screen (if the Visible() property is TRUE). However if a view is inserted into the Children list of a GView and it's parent pointer is set correctly it will still paint on the screen without the OS knowing about it. This is known in Lgi as a "virtual window" and is primarily used to cut down on windowing resources. Mouse clicks are handled by the parent window and passed down to the virtual children. Virtual children are somewhat limited. They can't receive focus, or participate in drag and drop operations. If you want to see an example have a look at the GToolBar code.

Reimplemented from GView.

References _Default, GView::FindControl(), IDOK, OnCreate(), and Pour().

Referenced by GDocApp< OptionsFmt >::_Create(), and GDialog::DoModeless().

char* GWindow::GetClass (  )  [inline]

The class' name. Should be overriden in child classes to return the right class name. Mostly used for debugging, but in the win32 port it is also the default WIN32 class name passed to RegisterClass() in GView::CreateClass().

Returns:
the Class' name for debugging

Reimplemented from GView.

bool GWindow::Name ( char *  n  ) 

Sets the utf-8 text associated with this view.

Name and NameW are interchangable. Using them in any order will convert the text between utf-8 and wide to satify any requirement. Generally once the opposing version of the string is required both the utf-8 and wide copies of the string remain cached in RAM until the Name is changed.

Reimplemented from GView.

References Name().

int GWindow::OnDrop ( char *  Format,
GVariant Data,
GdcPt2  Pt,
int  KeyState 
) [virtual]

'OnDrop' is called when the user releases the data over your window. The data is going to be a binary GVariant in the format you accepted earlier.

Returns:
DROPEFFECT_NONE for failure or DROPEFFECT_COPY, DROPEFFECT_MOVE, DROPEFFECT_LINK

Reimplemented from GDragDropTarget.

References GArray< Type >::Add(), GArray< Type >::DeleteArrays(), GArray< Type >::Length(), LGI_FileDropFormat, OnReceiveFiles(), and GToken::Parse().

bool GWindow::RegisterHook ( GView Target,
int  EventType,
int  Priority = 0 
)

Registers a watcher to receive OnView... messages before they are passed through to the intended recipient.

Parameters:
Target  The target view.
EventType  Combination of GMouseEvents and GKeyEvents OR'd together.
Priority  Not implemented

bool GWindow::SerializeState ( GDom Store,
char *  FieldName,
bool  Load 
)

Saves/loads the window's state, e.g. position, minimized/maximized etc.

Parameters:
Store  The data store for reading/writing
FieldName  The field name to use for storing settings under
Load  TRUE if loading the settings into the window, FALSE if saving to the store.

References GetPos(), GDom::GetValue(), GetZoom(), GZoomNormal, SetPos(), GRect::SetStr(), GDom::SetValue(), SetZoom(), GRect::Valid(), and GView::Value().

void GWindow::SetQuitOnClose ( bool  i  )  [inline]

Sets the "quit on close" setting.

When this is switched on the application will quit the main message loop when this GWindow is closed. This is really useful for your main application window. Otherwise the UI will disappear but the application is still running.

Referenced by GDocApp< OptionsFmt >::GDocApp().

int GWindow::WillAccept ( List< char > &  Formats,
GdcPt2  Pt,
int  KeyState 
) [virtual]

'WillAccept' is called to see whether this target can cope with any of the data types being passed to it. Once you have decided what format you want the data in clear all the other formats from the list. The first format left in the list will be passed to the 'OnDrop' function.

Returns:
DROPEFFECT_NONE for failure or DROPEFFECT_COPY, DROPEFFECT_MOVE, DROPEFFECT_LINK

Reimplemented from GDragDropTarget.

References List< Type >::Current(), List< Type >::Delete(), List< Type >::First(), LGI_FileDropFormat, and List< Type >::Next().


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

Generated on Wed Dec 1 15:41:05 2010 for Lgi by  doxygen 1.5.7.1