1 #ifdef PLATFORM_POSIX 2 #include <CtrlCore/stdids.h> 3 #endif 4 5 namespace Upp { 6 7 #define IMAGECLASS FBImg 8 #define IMAGEFILE <VirtualGui/FB.iml> 9 #include <Draw/iml_header.h> 10 11 class SystemDraw : public DrawProxy { 12 public: CanSetSurface()13 bool CanSetSurface() { return false; } Flush()14 static void Flush() {} 15 }; 16 17 enum KM { 18 KM_NONE = 0x00, 19 20 KM_LSHIFT= 0x01, 21 KM_RSHIFT= 0x02, 22 KM_LCTRL = 0x04, 23 KM_RCTRL = 0x08, 24 KM_LALT = 0x10, 25 KM_RALT = 0x20, 26 27 KM_CAPS = 0x40, 28 KM_NUM = 0x80, 29 30 KM_CTRL = KM_LCTRL | KM_RCTRL, 31 KM_SHIFT = KM_LSHIFT | KM_RSHIFT, 32 KM_ALT = KM_LALT | KM_RALT, 33 }; 34 35 enum GUI_OPTIONS { 36 GUI_SETMOUSECURSOR = 0x01, 37 GUI_SETCARET = 0x02, 38 }; 39 40 struct VirtualGui { 41 virtual dword GetOptions(); 42 virtual Size GetSize() = 0; 43 virtual dword GetMouseButtons() = 0; 44 virtual dword GetModKeys() = 0; 45 virtual bool IsMouseIn() = 0; 46 virtual bool ProcessEvent(bool *quit) = 0; 47 virtual void WaitEvent(int ms) = 0; 48 virtual void WakeUpGuiThread() = 0; 49 virtual void SetMouseCursor(const Image& image); 50 virtual void SetCaret(const Rect& caret); 51 virtual void Quit() = 0; 52 virtual bool IsWaitingEvent() = 0; 53 virtual SystemDraw& BeginDraw() = 0; 54 virtual void CommitDraw() = 0; 55 }; 56 57 void RunVirtualGui(VirtualGui& gui, Event<> app_main); 58 59 struct BackDraw__ : public SystemDraw { BackDraw__BackDraw__60 BackDraw__() : SystemDraw() {} 61 }; 62 63 class BackDraw : public BackDraw__ { // Dummy only, as we are running in GlobalBackBuffer mode 64 Size size; 65 Draw *painting; 66 Point painting_offset; 67 ImageBuffer ib; 68 69 public: 70 virtual bool IsPaintingOp(const Rect& r) const; 71 72 public: Put(SystemDraw & w,int x,int y)73 void Put(SystemDraw& w, int x, int y) {} Put(SystemDraw & w,Point p)74 void Put(SystemDraw& w, Point p) { Put(w, p.x, p.y); } 75 Create(SystemDraw & w,int cx,int cy)76 void Create(SystemDraw& w, int cx, int cy) {} Create(SystemDraw & w,Size sz)77 void Create(SystemDraw& w, Size sz) { Create(w, sz.cx, sz.cy); } Destroy()78 void Destroy() {} 79 SetPaintingDraw(Draw & w,Point off)80 void SetPaintingDraw(Draw& w, Point off) { painting = &w; painting_offset = off; } 81 GetOffset()82 Point GetOffset() const { return Point(0, 0); } 83 84 BackDraw(); 85 ~BackDraw(); 86 }; 87 88 class ImageDraw : public SImageDraw { // using software renderer 89 public: ImageDraw(Size sz)90 ImageDraw(Size sz) : SImageDraw(sz) {} ImageDraw(int cx,int cy)91 ImageDraw(int cx, int cy) : SImageDraw(cx, cy) {} 92 }; 93 94 void DrawDragRect(SystemDraw& w, const Rect& rect1, const Rect& rect2, const Rect& clip, int n, 95 Color color, uint64 pattern); 96 97 class TopWindowFrame; 98 99 #define GUIPLATFORM_CTRL_TOP_DECLS Ctrl *owner_window; 100 101 #define GUIPLATFORM_CTRL_DECLS_INCLUDE <VirtualGui/Ctrl.h> 102 103 #define GUIPLATFORM_PASTECLIP_DECLS \ 104 bool dnd; \ 105 friend struct DnDLoop; \ 106 107 #define GUIPLATFORM_TOPWINDOW_DECLS_INCLUDE <VirtualGui/Top.h> 108 109 class PrinterJob { // Dummy only... 110 NilDraw nil; 111 Vector<int> pages; 112 113 public: GetDraw()114 Draw& GetDraw() { return nil; } 115 operator Draw&() { return GetDraw(); } GetPages()116 const Vector<int>& GetPages() const { return pages; } 117 int operator[](int i) const { return 0; } GetPageCount()118 int GetPageCount() const { return 0; } 119 Execute()120 bool Execute() { return false; } 121 122 PrinterJob& Landscape(bool b = true) { return *this; } MinMaxPage(int minpage,int maxpage)123 PrinterJob& MinMaxPage(int minpage, int maxpage) { return *this; } PageCount(int n)124 PrinterJob& PageCount(int n) { return *this; } CurrentPage(int currentpage)125 PrinterJob& CurrentPage(int currentpage) { return *this; } Name(const char * _name)126 PrinterJob& Name(const char *_name) { return *this; } 127 128 PrinterJob(const char *name = NULL) {} ~PrinterJob()129 ~PrinterJob() {} 130 }; 131 132 } 133 134 #define GUIPLATFORM_INCLUDE_AFTER <VirtualGui/After.h> 135