#include <LgiClasses.h>
Inheritance diagram for GView:
Public Member Functions | |
GView (OsView wnd=0) | |
Creates a view/window. | |
virtual | ~GView () |
Destructor. | |
OsView | Handle () |
Returns the OS handle of the view. | |
virtual OsWindow | WindowHandle () |
Returns the OS handle of the top level window. | |
virtual bool | Attach (GView *p) |
Attaches the view to a parent view. | |
virtual bool | AttachChildren () |
Attachs all the views in the Children list if not already attached. | |
virtual bool | Detach () |
Detachs a window from it's parent. | |
virtual bool | IsAttached () |
Returns true if the window is attached. | |
virtual void | Quit (bool DontDelete=false) |
Destroys the window async. | |
GWindow * | GetWindow () |
Gets the top level window that this view belongs to. | |
GView * | GetParent () |
Gets the parent view. | |
virtual void | SetParent (GView *p) |
Sets the parent view. | |
void | SendNotify (int Data=0) |
Sends a notification to the notify target or the parent chain. | |
GView * | GetNotify () |
Gets the window that receives event notifications. | |
virtual void | SetNotify (GView *n) |
Sets the view to receive event notifications. | |
bool | Lock (int TimeOut=-1) |
Each top level window (GWindow) has a lock. By calling this function you lock the whole GWindow and all it's children. | |
void | Unlock () |
Unlocks the GWindow and that this view belongs to. | |
int | OnEvent (GMessage *Msg) |
Called to process every message received by this window. | |
bool | Enabled () |
true if the view is enabled | |
void | Enabled (bool e) |
Sets the enabled state. | |
bool | Visible () |
true if the view is visible | |
void | Visible (bool v) |
Hides/Shows the view. | |
bool | Focus () |
true if the view has keyboard focus | |
void | Focus (bool f) |
Sets the keyboard focus state on the view. | |
bool | DropTarget () |
true if this view is a drop target | |
bool | DropTarget (bool t) |
Sets the drop target state of this view. | |
bool | Sunken () |
Gives this view a 1 or 2 px sunken border. | |
void | Sunken (bool i) |
Sets a sunken border around the control. | |
bool | Flat () |
true if the view has a flat border | |
void | Flat (bool i) |
Sets the flat border state. | |
bool | Raised () |
true if the view has a raised border | |
void | Raised (bool i) |
Sets the raised border state. | |
bool | InThread () |
true if the control is currently executing in the GUI thread | |
bool | PostEvent (int Cmd, int a=0, int b=0) |
Asyncronously posts an event to be received by this 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. | |
virtual bool | NameW (char16 *n) |
Sets the wide char text associated with this view. | |
virtual char16 * | NameW () |
Returns the wide char text associated with this view. | |
virtual GFont * | GetFont () |
Gets the font this control should draw with. | |
virtual void | SetFont (GFont *Fnt, bool OwnIt=false) |
Sets the font for this control. | |
bool | SetCursor (int Cursor) |
Sets the mouse cursor to display when the mouse is over this control. | |
virtual GRect & | GetPos () |
Get the position of the view relitive to it's parent. | |
virtual GRect & | GetClient () |
Get the client region of the window relitive to itself (ie always 0,0-x,y). | |
virtual bool | SetPos (GRect &p, bool Repaint=false) |
Set the position of the view in terms of it's parent. | |
int | X () |
Gets the width of the view in pixels. | |
int | Y () |
Gets the height of the view in pixels. | |
GdcPt2 | GetMinimumSize () |
Gets the minimum size of the view. | |
void | SetMinimumSize (GdcPt2 Size) |
Set the minimum size of the view. | |
void | MoveOnScreen () |
Moves a top level window on screen. | |
void | MoveToCenter () |
Moves a top level to the center of the screen. | |
void | MoveToMouse () |
Moves a top level window to where the mouse is. | |
bool | Capture (bool c) |
Captures all mouse events to this view. | |
bool | IsCapturing () |
true if this view is capturing mouse events. | |
bool | GetMouse (GMouse &m, bool ScreenCoords=false) |
Gets the current mouse location. | |
int | GetId () |
Gets the ID associated with the view. | |
void | SetId (int i) |
Sets the view's ID. | |
bool | GetTabStop () |
true if this control is a tab stop. | |
void | SetTabStop (bool b) |
Sets whether this control is a tab stop. | |
virtual int | Value () |
Gets the integer representation of the view's contents. | |
virtual void | Value (int i) |
Sets the integer representation of the view's contents. | |
virtual GView * | FindControl (OsView hnd) |
Find a view by it's os handle. | |
virtual GView * | FindControl (int Id) |
Returns the view by it's ID. | |
int | GetCtrlValue (int Id) |
Gets the value of the control identified by the ID. | |
void | SetCtrlValue (int Id, int i) |
Sets the value of the control identified by the ID. | |
char * | GetCtrlName (int Id) |
Gets the name (text) of the control identified by the ID. | |
void | SetCtrlName (int Id, char *s) |
Sets the name (text) of the control identified by the ID. | |
bool | GetCtrlEnabled (int Id) |
Gets the enabled state of the control identified by the ID. | |
void | SetCtrlEnabled (int Id, bool Enabled) |
Sets the enabled state of the control identified by the ID. | |
bool | GetCtrlVisible (int Id) |
Gets the visible state of the control identified by the ID. | |
void | SetCtrlVisible (int Id, bool Visible) |
Sets the visible state of the control identified by the ID. | |
bool | Invalidate (GRect *r=NULL, bool Repaint=false, bool NonClient=false) |
Causes the given area of the view to be repainted to update the screen. | |
bool | Invalidate (GRegion *r, bool Repaint=false, bool NonClient=false) |
Causes the given area of the view to be repainted to update the screen. | |
bool | IsOver (GMouse &m) |
true if the mouse event is over the view | |
GView * | WindowFromPoint (int x, int y) |
returns the sub window located at the point x,y | |
void | SetPulse (int Ms=-1) |
Sets a timer to call the OnPulse() event. | |
void | PointToScreen (GdcPt2 &p) |
Convert a point form view coordinates to screen coordinates. | |
void | PointToView (GdcPt2 &p) |
Convert a point form screen coordinates to view coordinates. | |
bool | WindowVirtualOffset (GdcPt2 *Offset) |
Get the x,y offset from the virtual window to the first real view in the parent chain. | |
GdcPt2 & | GetWindowBorderSize () |
Get the size of the window borders. | |
virtual bool | Pour (GRegion &r) |
Layout all the child views. | |
void | OnMouseClick (GMouse &m) |
The mouse was clicked over this view. | |
void | OnMouseEnter (GMouse &m) |
Mouse moves into the area over the control. | |
void | OnMouseExit (GMouse &m) |
Mouse leaves the area over the control. | |
void | OnMouseMove (GMouse &m) |
The mouse moves over the control. | |
void | OnMouseWheel (double Lines) |
The mouse wheel was scrolled. | |
bool | OnKey (GKey &k) |
A key was pressed while this view has focus. | |
void | OnCreate () |
The view is attached. | |
void | OnDestroy () |
The view is detached. | |
void | OnFocus (bool f) |
The view gains or loses the keyboard focus. | |
void | OnPulse () |
Called every so often by the timer system. | |
void | OnPosChange () |
Called when the view position changes. | |
bool | OnRequestClose (bool OsShuttingDown) |
Called on a top level window when something requests to close the window. | |
int | OnHitTest (int x, int y) |
Return the type of cursor that should be visible when the mouse is at x,y. | |
void | OnChildrenChanged (GView *Wnd, bool Attaching) |
Called when the contents of the Children list have changed. | |
void | OnPaint (GSurface *pDC) |
Called to paint the onscreen representation of the view. | |
int | OnNotify (GView *Ctrl, int Flags) |
Called when a child view or view with it's SetNotify() set to this window changes. | |
int | OnCommand (int Cmd, int Event, OsView Wnd) |
Called when a menu command is activated by the user. | |
Public Attributes | |
List< GView > | Children |
List of children views. | |
GEvent * | Script |
Script handler to receive UI events. | |
Protected Member Functions | |
GRect * | FindLargest (GRegion &r) |
Finds the largest rectangle in the region. | |
GRect * | FindSmallestFit (GRegion &r, int Sx, int Sy) |
Finds the smallest rectangle that would fit a window 'Sx' by 'Sy'. | |
GRect * | FindLargestEdge (GRegion &r, int Edge) |
Finds the largest rectangle on the specified. | |
Friends | |
class | GWindow |
class | GLayout |
class | GControl |
class | GMenu |
class | GSubMenu |
class | GScrollBar |
class | GDialog |
class | GPopup |
This is the core object that all on screen windows inherit from. It encapsulates a HWND on Win32, a BView on BeOS and a Window on X11. Used by itself it's not a top level window, for that see the GWindow class.
To create a top level window see GWindow or GDialog.
For a GView with scroll bars use GLayout.
|
Creates a view/window. On non-Win32 platforms the default argument is the class that redirects the C++ virtual event handlers to the GView handlers. Which is usually the 'DefaultOsView' class. If you pass NULL in a DefaultOsView will be created to do the job. On BeOS you can subclass the native controls by passing in an instance of the BView based class.
|
|
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 in GPopup, GScrollBar, GTabView, GLayout, GWindow, GToolTip, and GSplitter. |
|
Captures all mouse events to this view. Once you have mouse capture all mouse events will be passed to this view. i.e. during a mouse click. |
|
Finds the largest rectangle on the specified.
|
|
Gets the font this control should draw with. The default font is the system font, owned by the GApp object. Reimplemented in GProgressPane, GTextView3, and GToolBar. |
|
Gets the ID associated with the view. The ID of a view is designed to associate controls defined in resource files with a object at runtime via a C header file define. |
|
Gets the current mouse location.
|
|
true if the control is currently executing in the GUI thread Some OS functions are not thread safe, and can only be called in the GUI thread. In the Linux implementation the GUI thread can change from time to time. On Win32 it stays the same. In any case if this function returns true it's safe to do just about anything. |
|
Causes the given area of the view to be repainted to update the screen.
|
|
Causes the given area of the view to be repainted to update the screen.
|
|
Each top level window (GWindow) has a lock. By calling this function you lock the whole GWindow and all it's children.
|
|
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 in GButton, GCheckBox, GCombo, GEdit, GHtml, GRadioGroup, GRadioButton, GText, GTextView3, and GWindow. |
|
Returns the wide char text associated with this view. On Win32 the wide characters are 16 bits, on unix systems they are 32-bit characters. Reimplemented in GButton, GCheckBox, GEdit, GRadioGroup, GRadioButton, GText, and GTextView3. |
|
The view gains or loses the keyboard focus.
Reimplemented from GEvent. Reimplemented in GButton, GCheckBox, GCombo, GList, GDropDown, GRadioButton, GTabView, GTextView3, and GTree. |
|
Return the type of cursor that should be visible when the mouse is at x,y.
Reimplemented from GEvent. Reimplemented in GList, GTextView3, and GSplitter. |
|
The mouse was clicked over this view.
Reimplemented from GEvent. Reimplemented in GBitmap, GButton, GCheckBox, GCombo, GTimePopup, GDatePopup, GHtml, GList, GDropDown, GRadioButton, GScrollBar, GTabView, GTextView3, GToolButton, GToolBar, GTree, and GSplitter. |
|
Mouse moves into the area over the control.
Reimplemented from GEvent. Reimplemented in GButton, GCheckBox, GRadioButton, GToolButton, and GToolBar. |
|
Mouse leaves the area over the control.
Reimplemented from GEvent. Reimplemented in GButton, GCheckBox, GRadioButton, GToolButton, GToolBar, and GSplitter. |
|
The mouse moves over the control.
Reimplemented from GEvent. Reimplemented in GHtml, GList, GScrollBar, GTextView3, GToolButton, GToolBar, GTree, and GSplitter. |
|
The mouse wheel was scrolled.
Reimplemented from GEvent. Reimplemented in GHtml, GList, GScrollBar, GTextView3, and GTree. |
|
Called when a child view or view with it's SetNotify() set to this window changes. The event by default will bubble up to the GWindow at the top of the window heirarchy visiting each GView on the way. If it reaches a GView that processes it then the event stops propergating up the heirarchy. Reimplemented from GEvent. Reimplemented in GTimeDrop, GAbout, GEdit, GFindDlg, GReplaceDlg, GFontSelect, GHtml, GInput, GItemEdit, GList, GDropDown, GProgressPane, GRadioGroup, GTabView, GTextView3, GTree, GLayout, and GAlert. |
|
Called every so often by the timer system.
Reimplemented from GEvent. Reimplemented in GHtml, GList, GScrollBar, and GTextView3. |
|
Called on a top level window when something requests to close the window.
Reimplemented from GEvent. |
|
Asyncronously posts an event to be received by this window. This calls PostMessage on Win32 and XSendEvent on X11. XSendEvent is called with a ClientMessage with the a and b parameters in the data section.
|
|
Layout all the child views.
Reimplemented in GProgressPane, GToolBar, GLayout, and GSplitter. |
|
true if the view has a raised border The size is set by the _BorderSize member variable. This border is not considered part of the client area. Mouse and drawing coordinates do not take it into account. Reimplemented from GFlags. |
|
Sets the mouse cursor to display when the mouse is over this control. This currently only works on Win32, as I can't get the X11 cursor functions to work. They seem horribly broken. (Surprise surprise)
|
|
Sets the font for this control. The lifetime of the font passed in is the responsibility of the caller. The GView object assumes the pointer will be valid at all times. Reimplemented in GButton, GCheckBox, GCombo, GRadioGroup, GRadioButton, GText, and GTextView3. |
|
Set the minimum size of the view. Only works for top level windows. |
|
Sets the view to receive event notifications. The notify window will receive events when this view changes. By default the parent view receives the events. |
|
Sets the parent view. This doesn't attach the window so that it will display. You should use GView::Attach for that. |
|
Sets a timer to call the OnPulse() event.
|
|
Sets whether this control is a tab stop. A top stop is a control that receives focus if the user scrolls through the controls with the tab key. |
|
Gives this view a 1 or 2 px sunken border. The size is set by the _BorderSize member variable. This border is not considered part of the client area. Mouse and drawing coordinates do not take it into account. Reimplemented from GFlags. |
|
Hides/Shows the view.
Reimplemented from GFlags. |