00001
00009
00010
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 "GXml.h"
00024
00025 #ifndef WIN32
00026 #include "GDragAndDrop.h"
00027 #endif
00028
00030
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
00038 class LgiClass GTarget
00039 {
00040 public:
00041 virtual int OnEvent(GMessage *Msg) { return 0; }
00042 };
00043
00045 class LgiClass GEvent
00046 {
00047 public:
00048 virtual ~GEvent() {}
00049
00050
00051 virtual bool OnScriptEvent(GView *Ctrl) { return false; }
00052
00053
00054 virtual void OnMouseClick(GMouse &m) {}
00055 virtual void OnMouseEnter(GMouse &m) {}
00056 virtual void OnMouseExit(GMouse &m) {}
00057 virtual void OnMouseMove(GMouse &m) {}
00058 virtual void OnMouseWheel(double Lines) {}
00059
00060
00061 virtual bool OnKey(GKey &k) { return false; }
00062 virtual bool OnViewMouse(GView *v, GMouse &m) { return true; }
00063 virtual bool OnViewKey(GView *v, GKey &k) { return false; }
00064
00065
00066 virtual void OnAttach() {}
00067 virtual void OnCreate() {}
00068 virtual void OnDestroy() {}
00069
00070
00071 virtual void OnFocus(bool f) {}
00072 virtual void OnPulse() {}
00073 virtual void OnPosChange() {}
00074 virtual bool OnRequestClose(bool OsShuttingDown);
00075 virtual int OnHitTest(int x, int y) { return -1; }
00076 virtual void OnChildrenChanged(GView *Wnd, bool Attaching) {}
00077 virtual void OnPaint(GSurface *pDC) {}
00078
00079
00080 virtual int OnNotify(GView *Ctrl, int Flags) { return -1; }
00081 virtual int OnCommand(int Cmd, int Event, OsView Wnd) { return 0; }
00082 };
00083
00085 class LgiClass GFlags
00086 {
00087 protected:
00088 int _BorderSize;
00089 int WndFlags;
00090
00091 public:
00092 GFlags();
00093
00094
00095 virtual bool Enabled();
00096 virtual void Enabled(bool i);
00097 virtual bool Visible();
00098 virtual void Visible(bool i);
00099 virtual bool Focus();
00100 virtual void Focus(bool i);
00101 virtual bool DropTarget();
00102 virtual bool DropTarget(bool t);
00103
00104 virtual void OnUpdateState() {}
00105
00106
00107 virtual bool Sunken();
00108 virtual void Sunken(bool i);
00109 virtual bool Flat();
00110 virtual void Flat(bool i);
00111 virtual bool Raised();
00112 virtual void Raised(bool i);
00113
00114 virtual void OnUpdateBorder() {}
00115 };
00116
00118 #ifdef WIN32
00119 typedef DWORD OsProcessId;
00120 #define LgiProcessInst() (LgiApp->GetInstance())
00121 extern p_vscprintf _vscprintf;
00122 #else
00123 typedef int OsProcessId;
00124 #endif
00125
00127 #define LgiProcessId() (LgiApp->GetProcessId())
00128
00133 #define LgiApp (GApp::ObjInstance())
00134
00139 #define SysFont (LgiApp->SystemNormal)
00140
00145 #define SysBold (LgiApp->SystemBold)
00146
00150 LgiFunc void LgiExitApp();
00151
00155 #define LgiCloseApp() LgiApp->Exit(false)
00156
00163 class LgiClass GApp : public OsApplication
00164 {
00165 friend class GView;
00166
00167 protected:
00168
00169 static GApp *TheApp;
00170 class GAppPrivate *d;
00171
00172 #if defined WIN32
00173
00174 CRITICAL_SECTION StackTraceSync;
00175 friend LONG __stdcall _ExceptionFilter_Redir(LPEXCEPTION_POINTERS e);
00176 LONG __stdcall _ExceptionFilter(LPEXCEPTION_POINTERS e);
00177 friend class GWin32Class;
00178 List<GWin32Class> *GetClasses();
00179
00180 #elif defined ATHEOS
00181
00182 char *_AppFile;
00183
00184 #elif defined BEOS
00185
00186 void RefsReceived(BMessage *Msg);
00187
00188 #endif
00189
00190 friend class GMouseHook;
00191 static GMouseHook *MouseHook;
00192
00193 public:
00194
00195
00197 static GApp *ObjInstance() { return TheApp; }
00198 static class GSkinEngine *SkinEngine;
00199
00200
00201
00203 GFont *SystemNormal;
00204
00206 GFont *SystemBold;
00207
00209 GWindow *AppWnd;
00210
00212 bool IsOk();
00213
00215 OsProcessId GetProcessId();
00216
00218 OsThreadId GetGuiThread();
00219
00221 GApp
00222 (
00225 char *MimeType,
00227 OsAppArguments &AppArgs
00228 );
00229
00231 virtual ~GApp();
00232
00234 virtual void SetAppArgs(OsAppArguments &AppArgs);
00235
00237 virtual OsAppArguments *GetAppArgs();
00238
00240 virtual char *GetArgumentAt(int n);
00241
00243 virtual bool Run
00244 (
00247 bool Loop = true
00248 );
00249
00251 virtual void OnCommandLine();
00252
00254 virtual void OnReceiveFiles(List<char> &Files);
00255
00257 virtual void Exit
00258 (
00260 int Code = 0
00261 );
00262
00265 bool GetOption
00266 (
00268 char *Option,
00270 GArray<char> &Buf
00271 );
00272
00275 bool GetOption
00276 (
00278 char *Option,
00280 char *Dst = 0,
00282 int DstSize = 0
00283 );
00284
00286 XmlTag *GetConfig(char *Tag);
00287
00289 void SetConfig(XmlTag *Tag);
00290
00292 GView *GetFocus();
00293
00295 bool GetFileMimeType
00296 (
00298 char *File,
00300 char *Mime,
00302 int BufLen
00303 );
00304
00306 int32 GetMetric
00307 (
00309 int Metric
00310 );
00311
00313 GMouseHook *GetMouseHook();
00314
00315
00316 #if defined WIN32
00317
00318 static bool IsWin9x;
00319 HINSTANCE GetInstance();
00320 int GetShow();
00321
00322 #elif defined LINUX
00323
00324 bool GetAppsForMimeType(char *Mime, GArray<GAppInfo*> &Apps);
00325
00326 #endif
00327 };
00328
00339 class LgiClass GView :
00340 public GObject,
00341 public GTarget,
00342 public GEvent,
00343 public GFlags
00344 {
00345 friend class GWindow;
00346 friend class GLayout;
00347 friend class GControl;
00348 friend class GMenu;
00349 friend class GSubMenu;
00350 friend class GWnd;
00351 friend class GScrollBar;
00352 friend class GFileTarget;
00353 friend class GDialog;
00354 friend class GDragDropTarget;
00355 friend class GPopup;
00356
00357 friend bool SysOnKey(GView *w, GMessage *m);
00358 friend GView *GetNextTabStop(GView *Wnd, bool Back);
00359
00360 #if defined WIN32
00361
00362 friend LRESULT CALLBACK GWin32Class::Redir(OsView hWnd, UINT m, WPARAM a, LPARAM b);
00363 friend LRESULT CALLBACK GWin32Class::SubClassRedir(OsView hWnd, UINT m, WPARAM a, LPARAM b);
00364 friend LRESULT CALLBACK DlgRedir(OsView hWnd, UINT m, WPARAM a, LPARAM b);
00365 static void CALLBACK TimerProc(OsView hwnd, UINT uMsg, UINT idEvent, uint32 dwTime);
00366
00367 #elif defined BEOS
00368
00369 friend class GButtonRedir;
00370 friend class _OsEditFrame;
00371 friend class BViewRedir;
00372 friend long _lgi_pulse_thread(void *ptr);
00373
00374 #elif defined XWIN
00375
00376 friend class QView<QWidget>;
00377 friend class QView<class QScrollBar>;
00378 friend class QView<class QPopup>;
00379 friend class QWindow;
00380
00381 #elif defined YWIN
00382
00383 friend class YView;
00384 friend class YWindow;
00385
00386 #endif
00387
00388 GRect Pos;
00389 class GDragDropTarget *&DropTargetPtr();
00390
00391 protected:
00392 class GViewPrivate *d;
00393
00394 OsView _View;
00395 GView *_Window;
00396 GSemaphore *_Lock;
00397
00398 static GView *_Capturing;
00399 static GView *_Over;
00400
00401 #if defined WIN32
00402
00403 uint32 GetStyle();
00404 void SetStyle(uint32 i);
00405 uint32 GetExStyle();
00406 void SetExStyle(uint32 i);
00407 uint32 GetDlgCode();
00408 void SetDlgCode(uint32 i);
00409 char *GetClass();
00410 void SetClass(char *s);
00411 GWin32Class *CreateClass(char *Class = 0, HICON Icon = 0, int AddStyles = 0);
00412
00413 virtual int SysOnNotify(int Code) { return 0; }
00414
00415 #elif defined BEOS
00416
00417 struct OsMouseInfo;
00418 friend long _lgi_mouse_thread(OsMouseInfo *Info);
00419
00420 OsMouseInfo *_MouseInfo;
00421 OsThread _CaptureThread;
00422 OsThread _PulseThread;
00423 int _PulseRate;
00424 BWindow *_QuitMe;
00425
00426 void Sys_KeyDown(const char *bytes, int32 numBytes);
00427 void Sys_KeyUp(const char *bytes, int32 numBytes);
00428 void Sys_MouseDown(BPoint point);
00429 void Sys_MouseMoved(BPoint point, uint32 transit, const BMessage *message);
00430 void Sys_FrameMoved(BPoint p);
00431 virtual bool QuitRequested() {}
00432
00433 #endif
00434
00435
00436
00438 GRect *FindLargest(GRegion &r);
00439
00441 GRect *FindSmallestFit(GRegion &r, int Sx, int Sy);
00442
00444 GRect *FindLargestEdge
00445 (
00447 GRegion &r,
00450 int Edge
00451 );
00452
00453 void _Delete();
00454 GView *FindReal(GdcPt2 *Offset = 0);
00455 bool HandleCapture(GView *Wnd, bool c);
00456
00457 virtual void _Paint(GSurface *pDC = 0);
00458
00459 #ifndef WIN32
00460
00461 GView *&PopupChild();
00462 virtual void _Mouse(GMouse &m, bool Move);
00463 virtual void OnNcPaint(GSurface *pDC, GRect &r);
00464
00465 #endif
00466
00467 public:
00469 List<GView> Children;
00470
00472 GEvent *Script;
00473
00481 GView
00482 (
00484 OsView wnd = 0
00485 );
00486
00488 virtual ~GView();
00489
00491 OsView Handle() { return _View; }
00492
00494 virtual OsWindow WindowHandle();
00495
00496
00497
00509 virtual bool Attach
00510 (
00512 GView *p
00513 );
00514
00516 virtual bool AttachChildren();
00517
00519 virtual bool Detach();
00520
00522 virtual bool IsAttached();
00523
00525 virtual void Quit(bool DontDelete = false);
00526
00527
00528
00530 GWindow *GetWindow();
00531
00533 GView *GetParent();
00534
00538 virtual void SetParent(GView *p);
00539
00541 void SendNotify(int Data = 0);
00542
00544 GView *GetNotify();
00545
00550 virtual void SetNotify(GView *n);
00551
00554 bool Lock
00555 (
00557 int TimeOut = -1
00558 );
00559
00561 void Unlock();
00562
00564 int OnEvent(GMessage *Msg);
00565
00567 bool Enabled();
00568
00570 void Enabled(bool e);
00571
00573 bool Visible();
00574
00576 void Visible
00577 (
00579 bool v
00580 );
00581
00583 bool Focus();
00584
00586 void Focus(bool f);
00587
00589 bool DropTarget();
00590
00592 bool DropTarget(bool t);
00593
00599 bool Sunken();
00600
00602 void Sunken(bool i);
00603
00605 bool Flat();
00606
00608 void Flat(bool i);
00609
00615 bool Raised();
00616
00618 void Raised(bool i);
00619
00626 bool InThread();
00627
00632 bool PostEvent
00633 (
00636 int Cmd,
00638 int a = 0,
00640 int b = 0
00641 );
00642
00649 bool Name(char *n);
00650
00652 char *Name();
00653
00655 virtual bool NameW(char16 *n);
00656
00661 virtual char16 *NameW();
00662
00666 virtual GFont *GetFont();
00667
00672 virtual void SetFont(GFont *Fnt, bool OwnIt = false);
00673
00678 bool SetCursor
00679 (
00682 int Cursor
00683 );
00684
00686 virtual GRect &GetPos() { return Pos; }
00688 virtual GRect &GetClient();
00690 virtual bool SetPos(GRect &p, bool Repaint = false);
00692 int X() { return Pos.X(); }
00694 int Y() { return Pos.Y(); }
00696 GdcPt2 GetMinimumSize();
00700 void SetMinimumSize(GdcPt2 Size);
00701
00703 void MoveOnScreen();
00705 void MoveToCenter();
00707 void MoveToMouse();
00708
00713 bool Capture(bool c);
00715 bool IsCapturing();
00718 bool GetMouse
00719 (
00721 GMouse &m,
00723 bool ScreenCoords = false
00724 );
00725
00730 int GetId();
00732 void SetId(int i);
00734 bool GetTabStop();
00739 void SetTabStop(bool b);
00741 virtual int Value() { return 0; }
00743 virtual void Value(int i) {}
00745 virtual GView *FindControl(OsView hnd);
00747 virtual GView *FindControl
00748 (
00749
00750 int Id
00751 );
00752
00754 int GetCtrlValue(int Id);
00756 void SetCtrlValue(int Id, int i);
00758 char *GetCtrlName(int Id);
00760 void SetCtrlName(int Id, char *s);
00762 bool GetCtrlEnabled(int Id);
00764 void SetCtrlEnabled(int Id, bool Enabled);
00766 bool GetCtrlVisible(int Id);
00768 void SetCtrlVisible(int Id, bool Visible);
00769
00771 bool Invalidate
00772 (
00774 GRect *r = NULL,
00776 bool Repaint = false,
00778 bool NonClient = false
00779 );
00780
00782 bool Invalidate
00783 (
00785 GRegion *r,
00787 bool Repaint = false,
00789 bool NonClient = false
00790 );
00791
00793 bool IsOver(GMouse &m);
00795 GView *WindowFromPoint(int x, int y);
00797 void SetPulse
00798 (
00800 int Ms = -1
00801 );
00803 void PointToScreen(GdcPt2 &p);
00805 void PointToView(GdcPt2 &p);
00807 bool WindowVirtualOffset(GdcPt2 *Offset);
00809 GdcPt2 &GetWindowBorderSize();
00811 virtual bool Pour
00812 (
00814 GRegion &r
00815 ) { return false; }
00816
00818 void OnMouseClick
00819 (
00821 GMouse &m
00822 );
00824 void OnMouseEnter
00825 (
00827 GMouse &m
00828 );
00830 void OnMouseExit
00831 (
00833 GMouse &m
00834 );
00836 void OnMouseMove
00837 (
00839 GMouse &m
00840 );
00842 void OnMouseWheel
00843 (
00845 double Lines
00846 );
00848 bool OnKey(GKey &k);
00850 void OnCreate();
00852 void OnDestroy();
00854 void OnFocus
00855 (
00857 bool f
00858 );
00861 void OnPulse();
00863 void OnPosChange();
00865 bool OnRequestClose
00866 (
00868 bool OsShuttingDown
00869 );
00871 int OnHitTest
00872 (
00874 int x,
00876 int y
00877 );
00879 void OnChildrenChanged(GView *Wnd, bool Attaching);
00881 void OnPaint(GSurface *pDC);
00887 int OnNotify(GView *Ctrl, int Flags);
00889 int OnCommand(int Cmd, int Event, OsView Wnd);
00890 };
00891
00893
00894
00897 #define GV_EDGE_TOP 0x0001
00900 #define GV_EDGE_RIGHT 0x0002
00903 #define GV_EDGE_BOTTOM 0x0004
00906 #define GV_EDGE_LEFT 0x0008
00907
00909 #define IDC_VSCROLL 14000
00910
00911 #define IDC_HSCROLL 14001
00912
00921 class LgiClass GLayout : public GView
00922 {
00923 friend class GScroll;
00924
00925
00926 bool _SettingScrollBars;
00927 bool _PourLargest;
00928
00929 protected:
00931 GScrollBar *VScroll;
00932
00934 GScrollBar *HScroll;
00935
00937 virtual bool SetScrollBars
00938 (
00940 bool x,
00942 bool y
00943 );
00944
00945 #ifndef WIN32
00946 void AttachScrollBars();
00947 #endif
00948
00949 public:
00950 GLayout();
00951 ~GLayout();
00952
00954 virtual void GetScrollPos(int &x, int &y);
00956 virtual void SetScrollPos(int x, int y);
00957
00959 bool GetPourLargest();
00966 void SetPourLargest(bool i);
00967
00969 int OnEvent(GMessage *Msg);
00970
00973 bool Pour(GRegion &r);
00974
00975
00976 #ifndef WIN32
00977 bool Attach(GView *p);
00978 GRect &GetClient();
00979 void OnPosChange();
00980 int OnNotify(GView *c, int f);
00981 void OnNcPaint(GSurface *pDC, GRect &r);
00982 #endif
00983 };
00984
00986 #define GIC_OWNER_DRAW 0x0001
00987
00988 #define GIC_ASK_TEXT 0x0002
00989
00990 #define GIC_ASK_IMAGE 0x0004
00991
00992 #define GIC_OWN_LIST 0x0008
00993
00994 class LgiClass GItemContainer
00995 {
00996 protected:
00997 int Flags;
00998 GImageList *ImageList;
00999
01000 public:
01001 GItemContainer();
01002 ~GItemContainer();
01003
01004
01005 bool OwnerDraw() { return TestFlag(Flags, GIC_OWNER_DRAW); }
01006 void OwnerDraw(bool b) { if (b) SetFlag(Flags, GIC_OWNER_DRAW); else ClearFlag(Flags, GIC_OWNER_DRAW); }
01007 bool AskText() { return TestFlag(Flags, GIC_ASK_TEXT); }
01008 void AskText(bool b) { if (b) SetFlag(Flags, GIC_ASK_TEXT); else ClearFlag(Flags, GIC_ASK_TEXT); }
01009 bool AskImage() { return TestFlag(Flags, GIC_ASK_IMAGE); }
01010 void AskImage(bool b) { if (b) SetFlag(Flags, GIC_ASK_IMAGE); else ClearFlag(Flags, GIC_ASK_IMAGE); }
01011
01012
01013 GImageList *GetImageList() { return ImageList; }
01014 bool SetImageList(GImageList *List, bool Own = true);
01015 bool LoadImageList(char *File, int x, int y);
01016 bool OwnList() { return TestFlag(Flags, GIC_OWN_LIST); }
01017 void OwnList(bool b) { if (b) SetFlag(Flags, GIC_OWN_LIST); else ClearFlag(Flags, GIC_OWN_LIST); }
01018 };
01019
01021
01022 #include "GMenu.h"
01023
01025
01027 enum GWindowZoom
01028 {
01030 GZoomMin,
01032 GZoomNormal,
01034 GZoomMax
01035 };
01036
01038 #define GMouseEvents 0x01
01039
01040 #define GKeyEvents 0x02
01041
01043 class LgiClass GWindow :
01044 public GView
01045 #ifndef WIN32
01046 , public GDragDropTarget
01047 #endif
01048 {
01049 friend class BViewRedir;
01050 friend class GView;
01051 friend class GButton;
01052 friend class QWindow;
01053 friend class YWindow;
01054
01055 bool _QuitOnClose;
01056
01057 protected:
01058 #ifdef WIN32
01059
01060 GRect OldPos;
01061 HWND LastFocus;
01062
01063 #else
01064
01065 OsWindow Wnd;
01066 void _OnViewDelete();
01067 void _SetDynamic(bool i);
01068
01069 #endif
01070
01071 #if defined BEOS
01072
01073 friend class GMenu;
01074 friend class GView;
01075
01076 #elif defined LINUX
01077
01078 void _Paint(GSurface *pDC = 0);
01079
01080 #endif
01081
01083 GView *_Default;
01084
01086 GMenu *Menu;
01087
01088 class GWindowPrivate *d;
01089
01090 public:
01091 GWindow();
01092 ~GWindow();
01093
01095 virtual void Pour();
01096
01098 GMenu *GetMenu() { return Menu; }
01099
01101 void SetMenu(GMenu *m) { Menu = m; }
01102
01104 bool GetQuitOnClose() { return _QuitOnClose; }
01105
01112 void SetQuitOnClose(bool i) { _QuitOnClose = i; }
01113
01114 bool GetSnapToEdge();
01115 void SetSnapToEdge(bool b);
01116
01118 GWindowZoom GetZoom();
01119
01121 void SetZoom(GWindowZoom i);
01122
01124 void Raise();
01125
01126 void OnPosChange();
01127 int OnEvent(GMessage *Msg);
01128 void OnPaint(GSurface *pDC);
01129 bool OnViewMouse(GView *v, GMouse &m);
01130 bool OnViewKey(GView *v, GKey &k);
01131 bool OnRequestClose(bool OsShuttingDown);
01132 bool Visible();
01133 void Visible(bool i);
01134
01137 bool RegisterHook
01138 (
01140 GView *Target,
01142 int EventType,
01144 int Priority = 0
01145 );
01146
01148 bool UnregisterHook(GView *Target);
01149
01151 virtual void OnZoom(GWindowZoom Action) {}
01152
01154 virtual void OnTrayClick(GMouse &m) {}
01155
01157 virtual void OnReceiveFiles(List<char> &Files) {}
01158
01159 #ifndef WIN32
01160
01161 bool Attach(GView *p);
01162
01163
01164 OsWindow WindowHandle() { return Wnd; }
01165 bool Name(char *n);
01166 char *Name();
01167 GRect &GetPos();
01168 bool SetPos(GRect &p, bool Repaint = false);
01169 GRect &GetClient();
01170
01171
01172 int WillAccept(List<char> &Formats, GdcPt2 Pt, int KeyState);
01173 int OnDrop(char *Format, GVariant *Data, GdcPt2 Pt, int KeyState);
01174
01175
01176 void OnChildrenChanged(GView *Wnd, bool Attaching);
01177 void OnCreate();
01178
01179 #endif
01180
01181 #if defined XP_CTRLS
01182
01183 GView *GetDefault();
01184
01186 void SetDefault(GView *v);
01187 #endif
01188 };
01189
01191
01193 class LgiClass GToolTip : public GView
01194 {
01195 class GToolTipPrivate *d;
01196
01197 public:
01198 GToolTip();
01199 ~GToolTip();
01200
01202 int NewTip
01203 (
01205 char *Name,
01207 GRect &Pos
01208 );
01209
01211 void DeleteTip(int Id);
01212
01213 bool Attach(GView *p);
01214 };
01215
01217
01218 #include "LgiWidgets.h"
01219
01221
01222 #include "Progress.h"
01223 #include "GProgress.h"
01224
01226 #include "GFileSelect.h"
01227 #include "GFindReplaceDlg.h"
01228 #include "GToolBar.h"
01229 #include "GThread.h"
01230
01232
01234 class LgiClass GSplitter : public GLayout
01235 {
01236 class GSplitterPrivate *d;
01237
01238 void CalcRegions(bool Follow = false);
01239 bool OverSplit(int x, int y);
01240
01241 public:
01242 GSplitter();
01243 ~GSplitter();
01244
01246 int Value();
01247
01249 void Value(int i);
01250
01252 bool IsVertical();
01253
01255 void IsVertical(bool v);
01256
01258 bool DoesSplitFollow();
01259
01261 void DoesSplitFollow(bool i);
01262
01264 GView *GetViewA();
01265
01267 void DetachViewA();
01268
01270 void SetViewA(GView *a, bool Border = true);
01271
01273 GView *GetViewB();
01274
01276 void DetachViewB();
01277
01279 void SetViewB(GView *b, bool Border = true);
01280
01281 bool Border();
01282 void Border(bool i);
01283 GView *FindControl(OsView hCtrl);
01284
01285 bool Attach(GView *p);
01286 bool Pour(GRegion &r);
01287 void OnPaint(GSurface *pDC);
01288 void OnPosChange();
01289 void OnMouseClick(GMouse &m);
01290 void OnMouseMove(GMouse &m);
01291 void OnMouseExit(GMouse &m);
01292 int OnHitTest(int x, int y);
01293 void OnChildrenChanged(GView *Wnd, bool Attaching);
01294 };
01295
01297 #define STATUSBAR_SEPARATOR 4
01298 #define GSP_SUNKEN 0x0001
01299
01300 class LgiClass GStatusBar : public GLayout
01301 {
01302 friend class GStatusPane;
01303
01304 protected:
01305 void RePour();
01306
01307 public:
01308 GStatusBar();
01309 ~GStatusBar();
01310
01311 bool Pour(GRegion &r);
01312 void OnPaint(GSurface *pDC);
01313
01314 GStatusPane *AppendPane(char *Text, int Width);
01315 bool AppendPane(GStatusPane *Pane);
01316 };
01317
01318 class LgiClass GStatusPane :
01319 public GView
01320 {
01321 friend class GStatusBar;
01322
01323 protected:
01324 int Flags;
01325 int Width;
01326 GSurface *pDC;
01327
01328 public:
01329 GStatusPane();
01330 ~GStatusPane();
01331
01332 char *Name() { return GObject::Name(); }
01333 bool Name(char *n);
01334 void OnPaint(GSurface *pDC);
01335
01336 int GetWidth();
01337 void SetWidth(int x);
01338 bool Sunken();
01339 void Sunken(bool i);
01340 GSurface *Bitmap();
01341 void Bitmap(GSurface *pdc);
01342 };
01343
01345 class LgiClass GCommand : public GObject, public GFlags
01346 {
01347 int Flags;
01348 bool PrevValue;
01349
01350 public:
01351 int Id;
01352 GToolButton *ToolButton;
01353 GMenuItem *MenuItem;
01354 GKey *Accelerator;
01355 char *TipHelp;
01356
01357 GCommand();
01358 ~GCommand();
01359
01360 bool Enabled();
01361 void Enabled(bool e);
01362 bool Value();
01363 void Value(bool v);
01364 };
01365
01367 #include "GClipBoard.h"
01368
01370
01372 class LgiClass GTrayIcon :
01373 public GObject,
01374 public GFlags
01375 {
01376 friend class GTrayWnd;
01377 class GTrayIconPrivate *d;
01378
01379 public:
01381 GTrayIcon
01382 (
01384 GWindow *p
01385 );
01386
01387 ~GTrayIcon();
01388
01390 bool LoadIcon(char *Str);
01391
01393 bool Visible();
01394
01396 void Visible(bool v);
01397
01399 int Value();
01400
01402 void Value(int v);
01403
01405 virtual int OnEvent(GMessage *Msg);
01406 };
01407
01409 #include "GInput.h"
01410 #include "GPrinter.h"
01411
01413
01423 class LgiClass GAlert : public GDialog
01424 {
01425 public:
01427 GAlert
01428 (
01430 GView *parent,
01432 char *Title,
01434 char *Text,
01436 char *Btn1,
01438 char *Btn2 = 0,
01440 char *Btn3 = 0
01441 );
01442
01443 int OnNotify(GView *Ctrl, int Flags);
01444 };
01445
01447 class LgiClass DoEvery
01448 {
01449 int64 LastTime;
01450 int64 Period;
01451
01452 public:
01454 DoEvery
01455 (
01457 int p = 1000
01458 );
01459
01461 void Init
01462 (
01464 int p = -1
01465 );
01466
01468 bool DoNow();
01469 };
01470
01475 class LgiClass GViewFactory
01476 {
01477 static List<GViewFactory> *Factories;
01478
01488 virtual GView *NewView
01489 (
01491 char *Class,
01493 GRect *Pos,
01495 char *Text
01496 ) = 0;
01497
01498 public:
01499 GViewFactory();
01500 virtual ~GViewFactory();
01501
01503 static GView *Create(char *Class, GRect *Pos = 0, char *Text = 0);
01504 };
01505
01507
01508
01509 LgiFunc void LgiInitColours();
01510 LgiFunc COLOUR LgiColour(int Colour);
01511
01512
01513 LgiFunc void LgiDrawBox(GSurface *pDC, GRect &r, bool Sunken, bool Fill);
01514 LgiFunc void LgiWideBorder(GSurface *pDC, GRect &r, int Type);
01515 LgiFunc void LgiThinBorder(GSurface *pDC, GRect &r, int Type);
01516 LgiFunc void LgiFlatBorder(GSurface *pDC, GRect &r, int Width = -1);
01517
01518
01519
01522 LgiFunc int LgiMsg
01523 (
01525 GView *Parent,
01527 char *Msg,
01529 char *Title = 0,
01532 int Type = MB_OK,
01533 ...
01534 );
01535
01536 #endif
01537
01538