Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

LgiClasses.h

Go to the documentation of this file.
00001 
00009 
00010 // Includes
00011 #ifndef __GUI_H
00012 #define __GUI_H
00013 
00014 #if defined BEOS
00015 #include <string.h>
00016 #endif
00017 
00018 #include "GSemaphore.h"
00019 #include "GLibrary.h"
00020 #include "LgiOsClasses.h"
00021 #include "GArray.h"
00022 #include "LgiCommon.h"
00023 #include "GXmlTree.h"
00024 
00025 #ifndef WIN32
00026 #include "GDragAndDrop.h"
00027 #endif
00028 
00030 // Externs
00031 extern long MouseWatcher(void *Ptr);
00032 extern bool _lgi_check_file(char *Path);
00033 LgiFunc bool LgiPostEvent(OsView Wnd, int Event, int a = 0, int b = 0);
00034 
00036 class LgiClass GTarget
00037 {
00038 public:
00039     virtual int OnEvent(GMessage *Msg) { return 0; }
00040 };
00041 
00043 enum GViewFillFlags
00044 {
00045     GViewFillReferenceBitmap = 0x0001,
00046     GViewFillCopyBitmap = 0x0002
00047 };
00048 
00050 class LgiClass GViewFill
00051 {
00052     class GViewFillPriv *d;
00053 
00054 public:
00055     GViewFill(COLOUR c, int Bits = -1);
00056     GViewFill(GSurface *dc, GViewFillFlags Flags = GViewFillCopyBitmap);
00057     GViewFill(GViewFill &f);
00058     virtual ~GViewFill();
00059 
00060     void Fill(GSurface *pDC, GRect *r = 0, GdcPt2 *Origin = 0);
00061 };
00062 
00064 #ifdef WIN32
00065 typedef DWORD                       OsProcessId;
00066 #define LgiProcessInst()            (LgiApp->GetInstance())
00067 #else
00068 typedef int                         OsProcessId;
00069 #endif
00070 
00072 #define LgiProcessId()              (LgiApp->GetProcessId())
00073 
00078 #define LgiApp                      (GApp::ObjInstance())
00079 
00084 #define SysFont                     (LgiApp->SystemNormal)
00085 
00090 #define SysBold                     (LgiApp->SystemBold)
00091 
00095 LgiFunc void LgiExitApp();
00096 
00100 #define LgiCloseApp()               LgiApp->Exit(false)
00101 
00103 struct GAppArguments
00104 {
00106     bool NoSkin;
00107 };
00108 
00115 class LgiClass GApp : virtual public GAppI, public OsApplication
00116 {
00117     friend class GView;
00118 
00119 protected:
00120     // private member vars
00121     class GAppPrivate *d;
00122     
00123     #if defined WIN32
00124 
00125     CRITICAL_SECTION StackTraceSync;
00126     friend LONG __stdcall _ExceptionFilter_Redir(LPEXCEPTION_POINTERS e);
00127     LONG __stdcall _ExceptionFilter(LPEXCEPTION_POINTERS e);
00128     friend class GWin32Class;
00129     List<GWin32Class> *GetClasses();
00130 
00131     #elif defined ATHEOS
00132 
00133     char *_AppFile;
00134 
00135     #elif defined BEOS
00136 
00137     void RefsReceived(BMessage *Msg);
00138     
00139     #endif
00140 
00141     friend class GMouseHook;
00142     static GMouseHook *MouseHook;
00143 
00144 public:
00145     // Static publics
00146     
00148     static GApp *ObjInstance();
00149     static class GSkinEngine *SkinEngine;
00150 
00151     // public member vars
00152     
00154     GFont *SystemNormal;
00155     
00157     GFont *SystemBold;
00158     
00160     GWindow *AppWnd;
00161 
00163     bool IsOk();
00164     
00166     OsProcessId GetProcessId();
00167     
00169     OsThreadId GetGuiThread();
00170 
00172     GApp
00173     (
00176         char *MimeType,
00178         OsAppArguments &AppArgs,
00180         GAppArguments *ObjArgs = 0
00181     );
00182 
00184     virtual ~GApp();
00185 
00187     void SetAppArgs(OsAppArguments &AppArgs);
00188     
00190     OsAppArguments *GetAppArgs();
00191 
00193     char *GetArgumentAt(int n);
00194     
00196     bool Run
00197     (
00200         bool Loop = true
00201     );
00202     
00204     void OnCommandLine();
00205     
00207     void OnReceiveFiles(GArray<char*> &Files);
00208     
00210     void Exit
00211     (
00213         int Code = 0
00214     );
00215     
00218     bool GetOption
00219     (
00221         char *Option,
00223         GArray<char> &Buf
00224     );
00225 
00228     bool GetOption
00229     (
00231         char *Option,
00233         char *Dst = 0,
00235         int DstSize = 0
00236     );
00237     
00239     GXmlTag *GetConfig(char *Tag);
00240 
00242     void SetConfig(GXmlTag *Tag);
00243     
00245     GViewI *GetFocus();
00246     
00248     bool GetFileMimeType
00249     (
00251         char *File,
00253         char *Mime,
00255         int BufLen
00256     );
00257         
00259     int32 GetMetric
00260     (
00262         int Metric
00263     );
00264 
00266     GMouseHook *GetMouseHook();
00267 
00268     // OS Specific
00269     #if defined WIN32
00270 
00271     static bool IsWin9x;
00272     HINSTANCE GetInstance();
00273     int GetShow();
00274 
00275     #else
00276     
00277     bool GetAppsForMimeType(char *Mime, GArray<GAppInfo*> &Apps);
00278 
00279     #endif
00280 };
00281 
00292 class LgiClass GView : virtual public GViewI, public GObject
00293 {
00294     friend      class GWindow;
00295     friend      class GLayout;
00296     friend      class GControl;
00297     friend      class GMenu;
00298     friend      class GSubMenu;
00299     friend      class GWnd;
00300     friend      class GScrollBar;
00301     friend      class GFileTarget;
00302     friend      class GDialog;
00303     friend      class GDragDropTarget;
00304     friend      class GPopup;
00305 
00306     friend      bool SysOnKey(GView *w, GMessage *m);
00307     friend      GViewI *GetNextTabStop(GViewI *Wnd, bool Back);
00308 
00309     #if defined WIN32
00310 
00311     friend      LRESULT CALLBACK GWin32Class::Redir(OsView hWnd, UINT m, WPARAM a, LPARAM b);
00312     friend      LRESULT CALLBACK GWin32Class::SubClassRedir(OsView hWnd, UINT m, WPARAM a, LPARAM b);
00313     friend      LRESULT CALLBACK DlgRedir(OsView hWnd, UINT m, WPARAM a, LPARAM b);
00314     static      void CALLBACK TimerProc(OsView hwnd, UINT uMsg, UINT idEvent, uint32 dwTime);
00315 
00316     #elif defined MAC
00317     
00318     friend OSStatus CarbonWindowProc(EventHandlerCallRef, EventRef, void *);
00319     friend OSStatus CarbonControlProc(EventHandlerCallRef, EventRef, void *);
00320     friend OSStatus GViewProc(EventHandlerCallRef, EventRef, void *);
00321 
00322     #elif defined BEOS
00323 
00324     friend      class GButtonRedir;
00325     friend      class _OsEditFrame;
00326     friend      class BViewRedir;
00327     friend      long _lgi_pulse_thread(void *ptr);
00328 
00329     #elif defined XWIN
00330 
00331     friend      class QView<QWidget>;
00332     friend      class QView<class QScrollBar>;
00333     friend      class QView<class QPopup>;
00334     friend      class QWindow;
00335     
00336     #elif defined YWIN
00337     
00338     friend      class YView;
00339     friend      class YWindow;
00340 
00341     #endif
00342 
00343     GRect           Pos;
00344     class GDragDropTarget *&DropTargetPtr();
00345 
00346 protected:
00347     class GViewPrivate  *d;
00348 
00349     OsView              _View; // OS specific handle to view object
00350     GView               *_Window;
00351     GSemaphore          *_Lock;
00352     int                 _BorderSize;
00353     int                 WndFlags;
00354 
00355     static GViewI       *_Capturing;
00356     static GViewI       *_Over;
00357     
00358     #if defined WIN32
00359 
00360     uint32 GetStyle();
00361     void SetStyle(uint32 i);
00362     uint32 GetExStyle();
00363     void SetExStyle(uint32 i);
00364     uint32 GetDlgCode();
00365     void SetDlgCode(uint32 i);
00366     char *GetClass();
00367     void SetClass(char *s);
00368     GWin32Class *CreateClass(char *Class = 0, HICON Icon = 0, int AddStyles = 0);
00369 
00370     virtual int     SysOnNotify(int Code) { return 0; }
00371 
00372     #elif defined BEOS
00373 
00374     struct OsMouseInfo;
00375     friend long _lgi_mouse_thread(OsMouseInfo *Info);
00376 
00377     OsMouseInfo     *_MouseInfo;
00378     OsThread        _CaptureThread;
00379     OsThread        _PulseThread;
00380     int             _PulseRate;
00381     BWindow         *_QuitMe;
00382 
00383     void Sys_KeyDown(const char *bytes, int32 numBytes);
00384     void Sys_KeyUp(const char *bytes, int32 numBytes);
00385     void Sys_MouseDown(BPoint point);
00386     void Sys_MouseMoved(BPoint point, uint32 transit, const BMessage *message);
00387     void Sys_FrameMoved(BPoint p);
00388     virtual bool QuitRequested() {}
00389 
00390     #endif
00391 
00392     // Complex Region searches
00393     
00395     GRect *FindLargest(GRegion &r);
00396 
00398     GRect *FindSmallestFit(GRegion &r, int Sx, int Sy);
00399 
00401     GRect *FindLargestEdge
00402     (
00404         GRegion &r,
00407         int Edge
00408     );
00409 
00410     void _Delete();
00411     GViewI *FindReal(GdcPt2 *Offset = 0);
00412     bool HandleCapture(GView *Wnd, bool c);
00413     
00414     virtual void    _Paint(GSurface *pDC = 0);
00415 
00416     #ifndef WIN32
00417 
00418     GView *&PopupChild();
00419     virtual void    _Mouse(GMouse &m, bool Move);
00420     virtual void    OnNcPaint(GSurface *pDC, GRect &r);
00421 
00422     #endif
00423 
00424     bool AddView(GViewI *v, int Where = -1);
00425     bool DelView(GViewI *v);
00426     bool HasView(GViewI *v);
00427     GViewIterator *IterateViews();
00428     void OnAttach() {}
00429     virtual bool OnViewMouse(GView *v, GMouse &m) { return true; }
00430     virtual bool OnViewKey(GView *v, GKey &k) { return false; }
00431 
00432 public:
00434     List<GViewI>    Children;
00435     
00437     GEventsI *Script;
00438     bool OnScriptEvent(GViewI *Ctrl) { return false; }
00439 
00447     GView
00448     (
00450         OsView wnd = 0
00451     );
00452 
00454     virtual ~GView();
00455 
00457     OsView Handle() { return _View; }
00458     
00460     virtual OsWindow WindowHandle();
00461 
00462     // Attaching windows / heirarchy
00463     
00475     virtual bool Attach
00476     (
00478         GViewI *p
00479     );
00480     
00482     virtual bool AttachChildren();
00483     
00485     virtual bool Detach();
00486     
00488     virtual bool IsAttached();
00489     
00491     virtual void Quit(bool DontDelete = false);
00492     
00493     // Properties
00494     
00496     GWindow *GetWindow();
00497     
00499     GViewI *GetParent();
00500 
00504     virtual void SetParent(GViewI *p);
00505 
00507     void SendNotify(int Data = 0);
00508     
00510     GViewI *GetNotify();
00511 
00516     virtual void SetNotify(GViewI *n);
00517 
00520     bool Lock
00521     (
00523         int TimeOut = -1
00524     );
00525     
00527     void Unlock();
00528 
00530     int OnEvent(GMessage *Msg);
00531 
00533     bool Enabled();
00534     
00536     void Enabled(bool e);
00537     
00539     bool Visible();
00540     
00542     void Visible
00543     (
00545         bool v
00546     );
00547 
00549     bool Focus();
00550     
00552     void Focus(bool f);
00553     
00555     bool DropTarget();
00556     
00558     bool DropTarget(bool t);
00559 
00565     bool Sunken();
00566     
00568     void Sunken(bool i);
00569 
00571     bool Flat();
00572     
00574     void Flat(bool i);
00575     
00581     bool Raised();
00582     
00584     void Raised(bool i);
00585 
00587     GViewFill *GetBackgroundFill();
00588 
00592     bool SetBackgroundFill(GViewFill *Fill);
00593 
00600     bool InThread();
00601     
00606     bool PostEvent
00607     (
00610         int Cmd,
00612         int a = 0,
00614         int b = 0
00615     );
00616 
00623     bool Name(char *n);
00624     
00626     char *Name();
00627     
00629     virtual bool NameW(char16 *n);
00630 
00635     virtual char16 *NameW();
00636 
00640     virtual GFont *GetFont();
00641     
00646     virtual void SetFont(GFont *Fnt, bool OwnIt = false);
00647     
00652     bool SetCursor
00653     (
00656         int Cursor
00657     );
00658 
00660     virtual GRect &GetPos() { return Pos; }
00662     virtual GRect &GetClient();
00664     virtual bool SetPos(GRect &p, bool Repaint = false);
00666     int X() { return Pos.X(); }
00668     int Y() { return Pos.Y(); }
00670     GdcPt2 GetMinimumSize();
00674     void SetMinimumSize(GdcPt2 Size);   
00675 
00677     void MoveOnScreen();
00679     void MoveToCenter();
00681     void MoveToMouse();
00682 
00687     bool Capture(bool c);
00689     bool IsCapturing();
00692     bool GetMouse
00693     (
00695         GMouse &m,
00697         bool ScreenCoords = false
00698     );
00699 
00704     int GetId();
00706     void SetId(int i);
00708     bool GetTabStop();
00713     void SetTabStop(bool b);
00715     virtual int Value() { return 0; }
00717     virtual void Value(int i) {}
00719     virtual GViewI *FindControl(OsView hnd);
00721     virtual GViewI *FindControl
00722     (
00723         // The ID to look for
00724         int Id
00725     );
00726 
00728     int GetCtrlValue(int Id);
00730     void SetCtrlValue(int Id, int i);
00732     char *GetCtrlName(int Id);
00734     void SetCtrlName(int Id, char *s);
00736     bool GetCtrlEnabled(int Id);
00738     void SetCtrlEnabled(int Id, bool Enabled);
00740     bool GetCtrlVisible(int Id);
00742     void SetCtrlVisible(int Id, bool Visible);
00743 
00745     bool Invalidate
00746     (
00748         GRect *r = NULL,
00750         bool Repaint = false,
00752         bool NonClient = false
00753     );
00754 
00756     bool Invalidate
00757     (
00759         GRegion *r,
00761         bool Repaint = false,
00763         bool NonClient = false
00764     );
00765 
00767     bool IsOver(GMouse &m);
00769     GViewI *WindowFromPoint(int x, int y);
00771     void SetPulse
00772     (
00774         int Ms = -1
00775     );
00777     void PointToScreen(GdcPt2 &p);
00779     void PointToView(GdcPt2 &p);
00781     bool WindowVirtualOffset(GdcPt2 *Offset);   
00783     GdcPt2 &GetWindowBorderSize();
00785     virtual bool Pour
00786     (
00788         GRegion &r
00789     ) { return false; }
00790 
00792     void OnMouseClick
00793     (
00795         GMouse &m
00796     );
00798     void OnMouseEnter
00799     (
00801         GMouse &m
00802     );
00804     void OnMouseExit
00805     (
00807         GMouse &m
00808     );
00810     void OnMouseMove
00811     (
00813         GMouse &m
00814     );
00816     void OnMouseWheel
00817     (
00819         double Lines
00820     );
00822     bool OnKey(GKey &k);
00824     void OnCreate();
00826     void OnDestroy();
00828     void OnFocus
00829     (
00831         bool f
00832     );
00835     void OnPulse();
00837     void OnPosChange();
00839     bool OnRequestClose
00840     (
00842         bool OsShuttingDown
00843     );
00845     int OnHitTest
00846     (
00848         int x,
00850         int y
00851     );
00853     void OnChildrenChanged(GViewI *Wnd, bool Attaching);
00855     void OnPaint(GSurface *pDC);
00861     int OnNotify(GViewI *Ctrl, int Flags);
00863     int OnCommand(int Cmd, int Event, OsView Wnd);
00864 };
00865 
00867 // Control or View window
00868 
00871 #define GV_EDGE_TOP             0x0001
00874 #define GV_EDGE_RIGHT           0x0002
00877 #define GV_EDGE_BOTTOM          0x0004
00880 #define GV_EDGE_LEFT            0x0008
00881 
00883 #define IDC_VSCROLL             14000
00884 
00885 #define IDC_HSCROLL             14001
00886 
00895 class LgiClass GLayout : public GView
00896 {
00897     friend class GScroll;
00898 
00899     // Private variables
00900     bool            _SettingScrollBars;
00901     bool            _PourLargest;
00902 
00903 protected:
00905     GScrollBar      *VScroll;
00906 
00908     GScrollBar      *HScroll;
00909 
00911     virtual bool SetScrollBars
00912     (
00914         bool x,
00916         bool y
00917     );
00918     
00919     #ifndef WIN32
00920     void AttachScrollBars();
00921     #endif
00922 
00923 public:
00924     GLayout();
00925     ~GLayout();
00926 
00928     virtual void GetScrollPos(int &x, int &y);
00930     virtual void SetScrollPos(int x, int y);
00931 
00933     bool GetPourLargest();
00940     void SetPourLargest(bool i);
00941 
00943     int OnEvent(GMessage *Msg);
00944 
00947     bool Pour(GRegion &r);
00948 
00949     // Impl
00950     #ifndef WIN32
00951     bool Attach(GViewI *p);
00952     GRect &GetClient();
00953     void OnPosChange();
00954     int OnNotify(GViewI *c, int f);
00955     void OnNcPaint(GSurface *pDC, GRect &r);
00956     #endif
00957 };
00958 
00960 #define GIC_OWNER_DRAW              0x0001
00961 
00962 #define GIC_ASK_TEXT                0x0002
00963 
00964 #define GIC_ASK_IMAGE               0x0004
00965 
00966 #define GIC_OWN_LIST                0x0008
00967 
00968 class LgiClass GItemContainer
00969 {
00970 protected:
00971     int Flags;
00972     GImageList *ImageList;
00973 
00974 public:
00975     GItemContainer();
00976     ~GItemContainer();
00977 
00978     // Props
00979     bool OwnerDraw() { return TestFlag(Flags, GIC_OWNER_DRAW); }
00980     void OwnerDraw(bool b) { if (b) SetFlag(Flags, GIC_OWNER_DRAW); else ClearFlag(Flags, GIC_OWNER_DRAW); }
00981     bool AskText() { return TestFlag(Flags, GIC_ASK_TEXT); }
00982     void AskText(bool b) { if (b) SetFlag(Flags, GIC_ASK_TEXT); else ClearFlag(Flags, GIC_ASK_TEXT); }
00983     bool AskImage() { return TestFlag(Flags, GIC_ASK_IMAGE); }
00984     void AskImage(bool b) { if (b) SetFlag(Flags, GIC_ASK_IMAGE); else ClearFlag(Flags, GIC_ASK_IMAGE); }
00985 
00986     // Image List
00987     GImageList *GetImageList() { return ImageList; }
00988     bool SetImageList(GImageList *List, bool Own = true);
00989     bool LoadImageList(char *File, int x, int y);
00990     bool OwnList() { return TestFlag(Flags, GIC_OWN_LIST); }
00991     void OwnList(bool b) { if (b) SetFlag(Flags, GIC_OWN_LIST); else ClearFlag(Flags, GIC_OWN_LIST); }
00992 };
00993 
00995 // Menus
00996 #include "GMenu.h"
00997 
00999 
01001 enum GWindowZoom
01002 {
01004     GZoomMin,
01006     GZoomNormal,
01008     GZoomMax
01009 };
01010 
01012 #define GMouseEvents                0x01
01013 
01014 #define GKeyEvents                  0x02
01015 
01017 class LgiClass GWindow :
01018     public GView
01019 #ifndef WIN32
01020     , public GDragDropTarget
01021 #endif
01022 {
01023     friend class BViewRedir;
01024     friend class GView;
01025     friend class GButton;
01026     friend class QWindow;
01027     friend class YWindow;
01028 
01029     bool _QuitOnClose;
01030 
01031 protected:
01032     #ifdef WIN32
01033 
01034     GRect OldPos;
01035     HWND LastFocus;
01036 
01037     #else
01038 
01039     OsWindow Wnd;
01040     void _OnViewDelete();
01041     void _SetDynamic(bool i);
01042 
01043     #endif
01044 
01045     #if defined BEOS
01046 
01047     friend class GMenu;
01048     friend class GView;
01049 
01050     #elif defined LINUX
01051     
01052     void _Paint(GSurface *pDC = 0);
01053     
01054     #endif
01055 
01057     GViewI *_Default;
01058 
01060     GMenu *Menu;
01061 
01062     class GWindowPrivate *d;
01063 
01064 public:
01065     GWindow();
01066     ~GWindow();
01067 
01069     virtual void Pour();
01070 
01072     GMenu *GetMenu() { return Menu; }
01073     
01075     void SetMenu(GMenu *m) { Menu = m; }
01076     
01078     bool GetQuitOnClose() { return _QuitOnClose; }
01079 
01086     void SetQuitOnClose(bool i) { _QuitOnClose = i; }
01087 
01088     bool GetSnapToEdge();
01089     void SetSnapToEdge(bool b);
01090     
01092     GWindowZoom GetZoom();
01093     
01095     void SetZoom(GWindowZoom i);
01096     
01098     void Raise();
01099 
01100     void OnPosChange();
01101     int OnEvent(GMessage *Msg);
01102     void OnPaint(GSurface *pDC);
01103     bool HandleViewMouse(GView *v, GMouse &m);
01104     bool HandleViewKey(GView *v, GKey &k);
01105     bool OnRequestClose(bool OsShuttingDown);
01106     bool Visible();
01107     void Visible(bool i);
01108     
01111     bool RegisterHook
01112     (
01114         GView *Target,
01116         int EventType,
01118         int Priority = 0
01119     );
01120 
01122     bool UnregisterHook(GView *Target);
01123     
01125     virtual void OnZoom(GWindowZoom Action) {}
01126     
01128     virtual void OnTrayClick(GMouse &m) {}
01129     
01131     virtual void OnReceiveFiles(GArray<char*> &Files) {}
01132 
01133     #ifndef WIN32
01134 
01135     bool Attach(GViewI *p);
01136 
01137     // Props
01138     OsWindow WindowHandle() { return Wnd; }
01139     bool Name(char *n);
01140     char *Name();
01141     GRect &GetPos();
01142     bool SetPos(GRect &p, bool Repaint = false);
01143     GRect &GetClient();
01144     
01145     // D'n'd
01146     int WillAccept(List<char> &Formats, GdcPt2 Pt, int KeyState);
01147     int OnDrop(char *Format, GVariant *Data, GdcPt2 Pt, int KeyState);
01148 
01149     // Events
01150     void OnChildrenChanged(GViewI *Wnd, bool Attaching);
01151     void OnCreate();
01152 
01153     #endif
01154 
01156     GViewI *GetDefault();
01157     
01159     void SetDefault(GViewI *v);
01160 };
01161 
01163 
01165 class LgiClass GToolTip : public GView
01166 {
01167     class GToolTipPrivate *d;
01168 
01169 public:
01170     GToolTip();
01171     ~GToolTip();
01172 
01174     int NewTip
01175     (
01177         char *Name,
01179         GRect &Pos
01180     );
01181     
01183     void DeleteTip(int Id);
01184 
01185     bool Attach(GViewI *p);
01186 };
01187 
01189 // Dialog stuff
01190 #include "LgiWidgets.h"
01191 
01193 // Progress meters stuff
01194 #include "Progress.h"
01195 #include "GProgress.h"
01196 
01198 #include "GFileSelect.h"
01199 #include "GFindReplaceDlg.h"
01200 #include "GToolBar.h"
01201 #include "GThread.h"
01202 
01204 
01206 class LgiClass GSplitter : public GLayout
01207 {
01208     class GSplitterPrivate *d;
01209 
01210     void        CalcRegions(bool Follow = false);
01211     bool        OverSplit(int x, int y);
01212 
01213 public:
01214     GSplitter();
01215     ~GSplitter();
01216 
01218     int Value(); // Use to set/get the split position
01219     
01221     void Value(int i);
01222 
01224     bool IsVertical();
01225     
01227     void IsVertical(bool v);
01228 
01230     bool DoesSplitFollow();
01231     
01233     void DoesSplitFollow(bool i);
01234 
01236     GView *GetViewA();
01237 
01239     void DetachViewA();
01240 
01242     void SetViewA(GView *a, bool Border = true);
01243 
01245     GView *GetViewB();
01246 
01248     void DetachViewB();
01249 
01251     void SetViewB(GView *b, bool Border = true);
01252 
01253     bool Border();
01254     void Border(bool i);
01255     GViewI *FindControl(OsView hCtrl);
01256 
01257     bool Attach(GViewI *p);
01258     bool Pour(GRegion &r);
01259     void OnPaint(GSurface *pDC);
01260     void OnPosChange();
01261     void OnMouseClick(GMouse &m);
01262     void OnMouseMove(GMouse &m);
01263     void OnMouseExit(GMouse &m);
01264     int OnHitTest(int x, int y);
01265     void OnChildrenChanged(GViewI *Wnd, bool Attaching);
01266 };
01267 
01269 #define STATUSBAR_SEPARATOR         4
01270 #define GSP_SUNKEN                  0x0001
01271 
01272 class LgiClass GStatusBar : public GLayout
01273 {
01274     friend class GStatusPane;
01275 
01276 protected:
01277     void RePour();
01278 
01279 public:
01280     GStatusBar();
01281     ~GStatusBar();
01282 
01283     bool Pour(GRegion &r);
01284     void OnPaint(GSurface *pDC);
01285 
01286     GStatusPane *AppendPane(char *Text, int Width);
01287     bool AppendPane(GStatusPane *Pane);
01288 };
01289 
01290 class LgiClass GStatusPane :
01291     public GView
01292 {
01293     friend class GStatusBar;
01294 
01295 protected:
01296     int     Flags;
01297     int     Width;
01298     GSurface *pDC;
01299 
01300 public:
01301     GStatusPane();
01302     ~GStatusPane();
01303 
01304     char *Name() { return GObject::Name(); }
01305     bool Name(char *n);
01306     void OnPaint(GSurface *pDC);
01307 
01308     int GetWidth();
01309     void SetWidth(int x);
01310     bool Sunken();
01311     void Sunken(bool i);
01312     GSurface *Bitmap();
01313     void Bitmap(GSurface *pdc);
01314 };
01315 
01317 class LgiClass GCommand : public GObject //, public GFlags
01318 {
01319     int         Flags;
01320     bool        PrevValue;
01321 
01322 public:
01323     int         Id;
01324     GToolButton *ToolButton;
01325     GMenuItem   *MenuItem;
01326     GKey        *Accelerator;
01327     char        *TipHelp;
01328     
01329     GCommand();
01330     ~GCommand();
01331 
01332     bool Enabled();
01333     void Enabled(bool e);
01334     bool Value();
01335     void Value(bool v);
01336 };
01337 
01339 #include "GClipBoard.h"
01340 
01342 
01344 class LgiClass GTrayIcon :
01345     public GObject
01346     // public GFlags
01347 {
01348     friend class GTrayWnd;
01349     class GTrayIconPrivate *d;
01350 
01351 public:
01353     GTrayIcon
01354     (
01356         GWindow *p
01357     );
01358     
01359     ~GTrayIcon();
01360 
01362     bool LoadIcon(char *Str);
01363     
01365     bool Visible();
01366 
01368     void Visible(bool v);
01369 
01371     int Value();
01372 
01374     void Value(int v);
01375 
01377     virtual int OnEvent(GMessage *Msg);
01378 };
01379 
01381 #include "GInput.h"
01382 #include "GPrinter.h"
01383 
01385 
01395 class LgiClass GAlert : public GDialog
01396 {
01397 public:
01399     GAlert
01400     (
01402         GViewI *parent,
01404         char *Title,
01406         char *Text,
01408         char *Btn1,
01410         char *Btn2 = 0,
01412         char *Btn3 = 0
01413     );
01414 
01415     int OnNotify(GViewI *Ctrl, int Flags);
01416 };
01417 
01419 class LgiClass DoEvery
01420 {
01421     int64 LastTime;
01422     int64 Period;
01423 
01424 public:
01426     DoEvery
01427     (
01429         int p = 1000
01430     );
01431     
01433     void Init
01434     (
01436         int p = -1
01437     );
01438 
01440     bool DoNow();
01441 };
01442 
01447 class LgiClass GViewFactory
01448 {
01449     static List<GViewFactory> *Factories;
01450 
01460     virtual GView *NewView
01461     (
01463         char *Class,
01465         GRect *Pos,
01467         char *Text
01468     ) = 0;
01469 
01470 public:
01471     GViewFactory();
01472     virtual ~GViewFactory();
01473 
01475     static GView *Create(char *Class, GRect *Pos = 0, char *Text = 0);
01476 };
01477 
01479 
01480 // Colour
01481 LgiFunc void LgiInitColours();
01482 LgiFunc COLOUR LgiColour(int Colour);
01483 
01484 // Graphics
01485 LgiFunc void LgiDrawBox(GSurface *pDC, GRect &r, bool Sunken, bool Fill);
01486 LgiFunc void LgiWideBorder(GSurface *pDC, GRect &r, int Type);
01487 LgiFunc void LgiThinBorder(GSurface *pDC, GRect &r, int Type);
01488 LgiFunc void LgiFlatBorder(GSurface *pDC, GRect &r, int Width = -1);
01489 
01490 // Helpers
01491 
01494 LgiFunc int LgiMsg
01495 (
01497     GViewI *Parent,
01499     char *Msg,
01501     char *Title = 0,
01504     int Type = MB_OK,
01505     ...
01506 );
01507 
01508 #endif
01509 
01510 

Generated on Tue May 2 10:24:43 2006 for Lgi by  doxygen 1.4.1