From 6aaa6071f01590d9a74e64f4df75f300b2364324 Mon Sep 17 00:00:00 2001 From: cxl Date: Fri, 10 Jun 2011 16:10:48 +0000 Subject: [PATCH] .developing rainbow git-svn-id: svn://ultimatepp.org/upp/trunk@3510 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlCore/CtrlCore.h | 167 +---------- uppsrc/CtrlCore/CtrlCore.upp | 2 + uppsrc/CtrlCore/Win32Gui.h | 2 + uppsrc/CtrlCore/Win32GuiA.h | 93 ++++++ uppsrc/CtrlCore/X11Gui.h | 537 ++++++++++++++++++----------------- uppsrc/CtrlCore/X11GuiA.h | 64 +++++ uppsrc/CtrlCore/init | 2 +- 7 files changed, 432 insertions(+), 435 deletions(-) create mode 100644 uppsrc/CtrlCore/Win32GuiA.h create mode 100644 uppsrc/CtrlCore/X11GuiA.h diff --git a/uppsrc/CtrlCore/CtrlCore.h b/uppsrc/CtrlCore/CtrlCore.h index 64f7cf763..4fef35200 100644 --- a/uppsrc/CtrlCore/CtrlCore.h +++ b/uppsrc/CtrlCore/CtrlCore.h @@ -1543,172 +1543,7 @@ String EncodeRTF(const RichText& richtext, byte charset, int dot_page_width) String EncodeRTF(const RichText& richtext); RichText ParseRTF(const char *rtf); -#ifdef PLATFORM_WIN32 - -Vector& coreCmdLine__(); -Vector SplitCmdLine__(const char *cmd); - -#ifdef PLATFORM_WINCE - -#define GUI_APP_MAIN \ -void GuiMainFn_();\ -\ -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int nCmdShow) \ -{ \ - UPP::Ctrl::InitWin32(hInstance); \ - UPP::coreCmdLine__() = UPP::SplitCmdLine__(UPP::FromSystemCharset(lpCmdLine)); \ - UPP::AppInitEnvironment__(); \ - GuiMainFn_(); \ - UPP::Ctrl::CloseTopCtrls(); \ - UPP::UsrLog("---------- About to delete this log..."); \ - UPP::DeleteUsrLog(); \ - UPP::Ctrl::ExitWin32(); \ - UPP::AppExit__(); \ - return UPP::GetExitCode(); \ -} \ -\ -void GuiMainFn_() - -#else - -#define GUI_APP_MAIN \ -void GuiMainFn_();\ -\ -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nCmdShow) \ -{ \ - UPP::Ctrl::InitWin32(hInstance); \ - UPP::coreCmdLine__() = UPP::SplitCmdLine__(UPP::FromSystemCharset(lpCmdLine)); \ - UPP::AppInitEnvironment__(); \ - GuiMainFn_(); \ - UPP::Ctrl::CloseTopCtrls(); \ - UPP::UsrLog("---------- About to delete this log..."); \ - UPP::DeleteUsrLog(); \ - UPP::Ctrl::ExitWin32(); \ - UPP::AppExit__(); \ - return UPP::GetExitCode(); \ -} \ -\ -void GuiMainFn_() - -#define DLL_APP_MAIN \ -void _DllMainAppInit(); \ -\ -BOOL WINAPI DllMain(HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpReserved) \ -{ \ - if(fdwReason == DLL_PROCESS_ATTACH) { \ - Ctrl::InitWin32(AppGetHandle()); \ - AppInitEnvironment__(); \ - _DllMainAppInit(); \ - } \ - else \ - if(fdwReason == DLL_PROCESS_DETACH) { \ - Ctrl::ExitWin32(); \ - } \ - return true; \ -} \ -\ -void _DllMainAppInit() - -#endif -#endif - -#ifdef PLATFORM_POSIX - -#define GUI_APP_MAIN \ -void GuiMainFn_(); \ -\ -int main(int argc, const char **argv, const char **envptr) { \ - UPP::AppInit__(argc, argv, envptr); \ - UPP::Ctrl::InitX11(NULL); \ - GuiMainFn_(); \ - UPP::Ctrl::CloseTopCtrls(); \ - UPP::UsrLog("---------- About to delete this log..."); \ - UPP::DeleteUsrLog(); \ - UPP::Ctrl::ExitX11(); \ - UPP::AppExit__(); \ - return UPP::GetExitCode(); \ -} \ - \ -void GuiMainFn_() - -#endif - -#ifdef PLATFORM_WIN32 -#ifndef PLATFORM_WINCE - -class DHCtrl : public Ctrl { -public: - virtual void State(int reason); - virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); - virtual void NcCreate(HWND hwnd); - virtual void NcDestroy(); - -private: - void OpenHWND(); - void SyncHWND(); - -protected: - void CloseHWND(); - HWND hwnd; - -public: - HWND GetHWND() { return hwnd; } -// void Refresh() { InvalidateRect(GetHWND(), NULL, false); } - - DHCtrl(); - ~DHCtrl(); -}; - -#endif -#endif - -#ifdef PLATFORM_X11 - -class DHCtrl : public Ctrl { - int isError; - bool isMapped; - Size CurrentSize; - XVisualInfo* UserVisualInfo; - String ErrorMessage; - - void MapWindow(bool map); - bool Init(void); - void Terminate(void); - -protected: - Visual *GetVisual(void); - XVisualInfo GetVisualInfo(void); - - virtual XVisualInfo *CreateVisual(void) {return 0;} - virtual void SetAttributes(unsigned long &ValueMask, XSetWindowAttributes &attr) {} - virtual void Paint(Draw &draw) {} - virtual void BeforeInit(void) {} - virtual void AfterInit(bool Error) {} - virtual void BeforeTerminate(void) {} - virtual void AfterTerminate(void) {} - virtual void Resize(int w, int h) {} - - void SetError(bool err) { isError = err; } - void SetErrorMessage(String const &msg) { ErrorMessage = msg; } - - virtual void State(int reason); - - Window hwnd; - bool isInitialized; - -public: - typedef DHCtrl CLASSNAME; - - bool IsInitialized(void) { return isInitialized; } - - bool GetError(void) { return isError; } - String GetErrorMessage(void) { return ErrorMessage; } - - DHCtrl(); - ~DHCtrl(); -}; - -#endif +#include GUIPLATFORM_INCLUDE_AFTER END_UPP_NAMESPACE diff --git a/uppsrc/CtrlCore/CtrlCore.upp b/uppsrc/CtrlCore/CtrlCore.upp index f9efcea69..d5b010281 100644 --- a/uppsrc/CtrlCore/CtrlCore.upp +++ b/uppsrc/CtrlCore/CtrlCore.upp @@ -57,6 +57,7 @@ file llay.h, Win32 readonly separator, Win32Gui.h, + Win32GuiA.h, Win32Keys.h, DrawWin32.cpp, DrawOpWin32.cpp, @@ -77,6 +78,7 @@ file Win32Msg.i, X11 readonly separator, X11Gui.h, + X11GuiA.h, X11Keys.h, DrawX11.cpp, DrawOpX11.cpp, diff --git a/uppsrc/CtrlCore/Win32Gui.h b/uppsrc/CtrlCore/Win32Gui.h index 519dd2dc2..6fe2002e4 100644 --- a/uppsrc/CtrlCore/Win32Gui.h +++ b/uppsrc/CtrlCore/Win32Gui.h @@ -357,3 +357,5 @@ END_UPP_NAMESPACE #endif #endif + +#define GUIPLATFORM_INCLUDE_AFTER "Win32GuiA.h" diff --git a/uppsrc/CtrlCore/Win32GuiA.h b/uppsrc/CtrlCore/Win32GuiA.h new file mode 100644 index 000000000..b1fd5c621 --- /dev/null +++ b/uppsrc/CtrlCore/Win32GuiA.h @@ -0,0 +1,93 @@ +Vector& coreCmdLine__(); +Vector SplitCmdLine__(const char *cmd); + +#ifdef PLATFORM_WINCE + +#define GUI_APP_MAIN \ +void GuiMainFn_();\ +\ +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int nCmdShow) \ +{ \ + UPP::Ctrl::InitWin32(hInstance); \ + UPP::coreCmdLine__() = UPP::SplitCmdLine__(UPP::FromSystemCharset(lpCmdLine)); \ + UPP::AppInitEnvironment__(); \ + GuiMainFn_(); \ + UPP::Ctrl::CloseTopCtrls(); \ + UPP::UsrLog("---------- About to delete this log..."); \ + UPP::DeleteUsrLog(); \ + UPP::Ctrl::ExitWin32(); \ + UPP::AppExit__(); \ + return UPP::GetExitCode(); \ +} \ +\ +void GuiMainFn_() + +#else + +#define GUI_APP_MAIN \ +void GuiMainFn_();\ +\ +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nCmdShow) \ +{ \ + UPP::Ctrl::InitWin32(hInstance); \ + UPP::coreCmdLine__() = UPP::SplitCmdLine__(UPP::FromSystemCharset(lpCmdLine)); \ + UPP::AppInitEnvironment__(); \ + GuiMainFn_(); \ + UPP::Ctrl::CloseTopCtrls(); \ + UPP::UsrLog("---------- About to delete this log..."); \ + UPP::DeleteUsrLog(); \ + UPP::Ctrl::ExitWin32(); \ + UPP::AppExit__(); \ + return UPP::GetExitCode(); \ +} \ +\ +void GuiMainFn_() + +#define DLL_APP_MAIN \ +void _DllMainAppInit(); \ +\ +BOOL WINAPI DllMain(HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpReserved) \ +{ \ + if(fdwReason == DLL_PROCESS_ATTACH) { \ + Ctrl::InitWin32(AppGetHandle()); \ + AppInitEnvironment__(); \ + _DllMainAppInit(); \ + } \ + else \ + if(fdwReason == DLL_PROCESS_DETACH) { \ + Ctrl::ExitWin32(); \ + } \ + return true; \ +} \ +\ +void _DllMainAppInit() + +#endif + +#ifndef PLATFORM_WINCE + +class DHCtrl : public Ctrl { +public: + virtual void State(int reason); + virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); + virtual void NcCreate(HWND hwnd); + virtual void NcDestroy(); + +private: + void OpenHWND(); + void SyncHWND(); + +protected: + void CloseHWND(); + HWND hwnd; + +public: + HWND GetHWND() { return hwnd; } +// void Refresh() { InvalidateRect(GetHWND(), NULL, false); } + + DHCtrl(); + ~DHCtrl(); +}; + +#endif + diff --git a/uppsrc/CtrlCore/X11Gui.h b/uppsrc/CtrlCore/X11Gui.h index e478cbd0a..07952a397 100644 --- a/uppsrc/CtrlCore/X11Gui.h +++ b/uppsrc/CtrlCore/X11Gui.h @@ -1,268 +1,269 @@ -#ifdef PLATFORM_X11 - -#define Time XTime -#define Font XFont -#define Display XDisplay -#define Picture XPicture - -#include -#include -#include - -#include -#include - -#undef Picture -#undef Time -#undef Font -#undef Display - -#undef True -#undef False - -#define XFalse 0 -#define XTrue 1 - -NAMESPACE_UPP - -extern XDisplay *Xdisplay; -extern Visual *Xvisual; -extern int Xscreenno; -extern Window Xroot; -extern Screen *Xscreen; -extern Colormap Xcolormap; -extern int Xheight; -extern int Xwidth; -extern int XheightMM; -extern int XwidthMM; -extern int Xdepth; -extern dword Xblack; -extern dword Xwhite; -extern int Xconnection; - -extern dword (*Xgetpixel)(int r, int g, int b); - -void InitX11Draw(const char *dispname = NULL); -void InitX11Draw(XDisplay *display); - -void XError(); -void XError(const char *s); - -inline dword GetXPixel(int r, int g, int b) { return (*Xgetpixel)(r, g, b); } -inline dword GetXPixel(Color color) { return (*Xgetpixel)(color.GetR(), color.GetG(), color.GetB()); } - -enum { - X11_ROP2_ZERO, - X11_ROP2_AND, - X11_ROP2_AND_NOT, - X11_ROP2_COPY, - X11_ROP2_NOT_AND, - X11_ROP2_NOP, - X11_ROP2_XOR, - X11_ROP2_OR, - X11_ROP2_NOT_AND_NOT, - X11_ROP2_NOT_XOR, - X11_ROP2_INVERT, - X11_ROP2_OR_NOT, - X11_ROP2_NOT_COPY, - X11_ROP2_NOT_OR, - X11_ROP2_NOT_OR_NOT, - X11_ROP2_ONE, -}; - -void SetClip(GC gc, XftDraw *xftdraw, const Vector& cl); - -class SystemDraw : public Draw { -public: - virtual dword GetInfo() const; - virtual Size GetPageSize() const; - - virtual void BeginOp(); - virtual void EndOp(); - virtual void OffsetOp(Point p); - virtual bool ClipOp(const Rect& r); - virtual bool ClipoffOp(const Rect& r); - virtual bool ExcludeClipOp(const Rect& r); - virtual bool IntersectClipOp(const Rect& r); - virtual bool IsPaintingOp(const Rect& r) const; - virtual Rect GetPaintRect() const; - - virtual void DrawRectOp(int x, int y, int cx, int cy, Color color); - virtual void DrawImageOp(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color); - virtual void DrawLineOp(int x1, int y1, int x2, int y2, int width, Color color); - - virtual void DrawPolyPolylineOp(const Point *vertices, int vertex_count, - const int *counts, int count_count, - int width, Color color, Color doxor); - virtual void DrawPolyPolyPolygonOp(const Point *vertices, int vertex_count, - const int *subpolygon_counts, int scc, - const int *disjunct_polygon_counts, int dpcc, - Color color, int width, Color outline, - uint64 pattern, Color doxor); - virtual void DrawArcOp(const Rect& rc, Point start, Point end, int width, Color color); - - virtual void DrawEllipseOp(const Rect& r, Color color, int pen, Color pencolor); - virtual void DrawTextOp(int x, int y, int angle, const wchar *text, Font font, - Color ink, int n, const int *dx); - - virtual Size GetNativeDpi() const; - virtual void BeginNative(); - virtual void EndNative(); - - virtual int GetCloffLevel() const; - -private: - Size pageSize; - - SystemDraw(); - - friend class ImageDraw; - friend class FontInfo; - friend class Font; - friend class ViewDraw; - - friend void StaticExitDraw_(); - friend Font StdFont(); - - FontInfo lastFont; - - Point actual_offset; - Point actual_offset_bak; - struct Cloff : Moveable { - Point org; - int clipi; - int offseti; - }; - - Array cloff; - Rect drawingclip; - Vector< Vector > clip; - Vector offset; - - Drawable dw; - GC gc; - XftDraw *xftdraw; - - int foreground; - int linewidth; - - void Init(); - void Init(const Vector& clip, Point offset = Point(0, 0)); - void CloneClip(); - - friend class BackDraw; - friend class ScreenDraw; - -public: - static void Flush() { XSync(Xdisplay, false); } - - Point GetOffset() const { return actual_offset; } - - static XftFont *CreateXftFont(Font f, int angle); - XftDraw *GetXftDraw() const { return xftdraw; } - - Rect GetClip() const; - - void SetForeground(Color color); - void SetLineStyle(int width); - void SetClip(); - - Drawable GetDrawable() const { return dw; } - GC GetGC() const { return gc; } - const Vector& GetClipList() const { return clip.Top(); } - - SystemDraw(Drawable dw, GC gc, XftDraw *xftdraw, const Vector& clip); - - bool CanSetSurface() { return true; } -}; - -Image X11Cursor(int c); -void *CursorX11(const Image& img); - -class BackDraw : public SystemDraw { -public: - virtual bool IsPaintingOp(const Rect& r) const; - -protected: - Pixmap pixmap; - Size size; - Draw *painting; - Point painting_offset; - -public: - void Put(SystemDraw& w, int x, int y); - void Put(SystemDraw& w, Point p) { Put(w, p.x, p.y); } - - void Create(SystemDraw& w, int cx, int cy); - void Create(SystemDraw& w, Size sz) { Create(w, sz.cx, sz.cy); } - void Destroy(); - - void SetPaintingDraw(Draw& w, Point off) { painting = &w; painting_offset = off; } - - BackDraw(); - ~BackDraw(); -}; - -class ImageDraw : public SystemDraw { - Size size; - SystemDraw alpha; - bool has_alpha; - - void Init(); - Image Get(bool pm) const; - -public: - Draw& Alpha(); - - operator Image() const; - - Image GetStraight() const; - - ImageDraw(Size sz); - ImageDraw(int cx, int cy); - ~ImageDraw(); -}; - -END_UPP_NAMESPACE - -#endif - - -#ifdef PLATFORM_X11 -#include "X11/keysym.h" -#endif - - -#define GUIPLATFORM_KEYCODES_INCLUDE "X11Keys.h" - - -#define GUIPLATFORM_CTRL_TOP_DECLS \ - Window window; - - -#define GUIPLATFORM_CTRL_DECLS_INCLUDE "X11Ctrl.h" - -#define GUIPLATFORM_TOPWINDOW_DECLS_INCLUDE "X11Top.h" - -#define GUIPLATFORM_PASTECLIP_DECLS \ - int type; - - -#define GUIPLATFORM_VIEWDRAW_DECLS \ - bool caret; \ - - -NAMESPACE_UPP - -String XAtomName(Atom atom); -Atom XAtom(const char *name); - -String GetProperty(Window w, Atom property, Atom rtype = AnyPropertyType); -Vector GetPropertyInts(Window w, Atom property, Atom rtype = AnyPropertyType); -String ReadPropertyData(Window w, Atom property, Atom rtype = AnyPropertyType); - -Index& _NET_Supported(); - -#include "stdids.h" - -END_UPP_NAMESPACE +#ifdef PLATFORM_X11 + +#define Time XTime +#define Font XFont +#define Display XDisplay +#define Picture XPicture + +#include +#include +#include + +#include +#include + +#undef Picture +#undef Time +#undef Font +#undef Display + +#undef True +#undef False + +#define XFalse 0 +#define XTrue 1 + +NAMESPACE_UPP + +extern XDisplay *Xdisplay; +extern Visual *Xvisual; +extern int Xscreenno; +extern Window Xroot; +extern Screen *Xscreen; +extern Colormap Xcolormap; +extern int Xheight; +extern int Xwidth; +extern int XheightMM; +extern int XwidthMM; +extern int Xdepth; +extern dword Xblack; +extern dword Xwhite; +extern int Xconnection; + +extern dword (*Xgetpixel)(int r, int g, int b); + +void InitX11Draw(const char *dispname = NULL); +void InitX11Draw(XDisplay *display); + +void XError(); +void XError(const char *s); + +inline dword GetXPixel(int r, int g, int b) { return (*Xgetpixel)(r, g, b); } +inline dword GetXPixel(Color color) { return (*Xgetpixel)(color.GetR(), color.GetG(), color.GetB()); } + +enum { + X11_ROP2_ZERO, + X11_ROP2_AND, + X11_ROP2_AND_NOT, + X11_ROP2_COPY, + X11_ROP2_NOT_AND, + X11_ROP2_NOP, + X11_ROP2_XOR, + X11_ROP2_OR, + X11_ROP2_NOT_AND_NOT, + X11_ROP2_NOT_XOR, + X11_ROP2_INVERT, + X11_ROP2_OR_NOT, + X11_ROP2_NOT_COPY, + X11_ROP2_NOT_OR, + X11_ROP2_NOT_OR_NOT, + X11_ROP2_ONE, +}; + +void SetClip(GC gc, XftDraw *xftdraw, const Vector& cl); + +class SystemDraw : public Draw { +public: + virtual dword GetInfo() const; + virtual Size GetPageSize() const; + + virtual void BeginOp(); + virtual void EndOp(); + virtual void OffsetOp(Point p); + virtual bool ClipOp(const Rect& r); + virtual bool ClipoffOp(const Rect& r); + virtual bool ExcludeClipOp(const Rect& r); + virtual bool IntersectClipOp(const Rect& r); + virtual bool IsPaintingOp(const Rect& r) const; + virtual Rect GetPaintRect() const; + + virtual void DrawRectOp(int x, int y, int cx, int cy, Color color); + virtual void DrawImageOp(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color); + virtual void DrawLineOp(int x1, int y1, int x2, int y2, int width, Color color); + + virtual void DrawPolyPolylineOp(const Point *vertices, int vertex_count, + const int *counts, int count_count, + int width, Color color, Color doxor); + virtual void DrawPolyPolyPolygonOp(const Point *vertices, int vertex_count, + const int *subpolygon_counts, int scc, + const int *disjunct_polygon_counts, int dpcc, + Color color, int width, Color outline, + uint64 pattern, Color doxor); + virtual void DrawArcOp(const Rect& rc, Point start, Point end, int width, Color color); + + virtual void DrawEllipseOp(const Rect& r, Color color, int pen, Color pencolor); + virtual void DrawTextOp(int x, int y, int angle, const wchar *text, Font font, + Color ink, int n, const int *dx); + + virtual Size GetNativeDpi() const; + virtual void BeginNative(); + virtual void EndNative(); + + virtual int GetCloffLevel() const; + +private: + Size pageSize; + + SystemDraw(); + + friend class ImageDraw; + friend class FontInfo; + friend class Font; + friend class ViewDraw; + + friend void StaticExitDraw_(); + friend Font StdFont(); + + FontInfo lastFont; + + Point actual_offset; + Point actual_offset_bak; + struct Cloff : Moveable { + Point org; + int clipi; + int offseti; + }; + + Array cloff; + Rect drawingclip; + Vector< Vector > clip; + Vector offset; + + Drawable dw; + GC gc; + XftDraw *xftdraw; + + int foreground; + int linewidth; + + void Init(); + void Init(const Vector& clip, Point offset = Point(0, 0)); + void CloneClip(); + + friend class BackDraw; + friend class ScreenDraw; + +public: + static void Flush() { XSync(Xdisplay, false); } + + Point GetOffset() const { return actual_offset; } + + static XftFont *CreateXftFont(Font f, int angle); + XftDraw *GetXftDraw() const { return xftdraw; } + + Rect GetClip() const; + + void SetForeground(Color color); + void SetLineStyle(int width); + void SetClip(); + + Drawable GetDrawable() const { return dw; } + GC GetGC() const { return gc; } + const Vector& GetClipList() const { return clip.Top(); } + + SystemDraw(Drawable dw, GC gc, XftDraw *xftdraw, const Vector& clip); + + bool CanSetSurface() { return true; } +}; + +Image X11Cursor(int c); +void *CursorX11(const Image& img); + +class BackDraw : public SystemDraw { +public: + virtual bool IsPaintingOp(const Rect& r) const; + +protected: + Pixmap pixmap; + Size size; + Draw *painting; + Point painting_offset; + +public: + void Put(SystemDraw& w, int x, int y); + void Put(SystemDraw& w, Point p) { Put(w, p.x, p.y); } + + void Create(SystemDraw& w, int cx, int cy); + void Create(SystemDraw& w, Size sz) { Create(w, sz.cx, sz.cy); } + void Destroy(); + + void SetPaintingDraw(Draw& w, Point off) { painting = &w; painting_offset = off; } + + BackDraw(); + ~BackDraw(); +}; + +class ImageDraw : public SystemDraw { + Size size; + SystemDraw alpha; + bool has_alpha; + + void Init(); + Image Get(bool pm) const; + +public: + Draw& Alpha(); + + operator Image() const; + + Image GetStraight() const; + + ImageDraw(Size sz); + ImageDraw(int cx, int cy); + ~ImageDraw(); +}; + +END_UPP_NAMESPACE + +#endif + + +#ifdef PLATFORM_X11 +#include "X11/keysym.h" +#endif + + +#define GUIPLATFORM_KEYCODES_INCLUDE "X11Keys.h" + + +#define GUIPLATFORM_CTRL_TOP_DECLS \ + Window window; + + +#define GUIPLATFORM_CTRL_DECLS_INCLUDE "X11Ctrl.h" + +#define GUIPLATFORM_TOPWINDOW_DECLS_INCLUDE "X11Top.h" + +#define GUIPLATFORM_PASTECLIP_DECLS \ + int type; + + +#define GUIPLATFORM_VIEWDRAW_DECLS \ + bool caret; \ + +#define GUIPLATFORM_INCLUDE_AFTER "X11GuiA.h" + +NAMESPACE_UPP + +String XAtomName(Atom atom); +Atom XAtom(const char *name); + +String GetProperty(Window w, Atom property, Atom rtype = AnyPropertyType); +Vector GetPropertyInts(Window w, Atom property, Atom rtype = AnyPropertyType); +String ReadPropertyData(Window w, Atom property, Atom rtype = AnyPropertyType); + +Index& _NET_Supported(); + +#include "stdids.h" + +END_UPP_NAMESPACE diff --git a/uppsrc/CtrlCore/X11GuiA.h b/uppsrc/CtrlCore/X11GuiA.h new file mode 100644 index 000000000..0c464362b --- /dev/null +++ b/uppsrc/CtrlCore/X11GuiA.h @@ -0,0 +1,64 @@ +#define GUI_APP_MAIN \ +void GuiMainFn_(); \ +\ +int main(int argc, const char **argv, const char **envptr) { \ + UPP::AppInit__(argc, argv, envptr); \ + UPP::Ctrl::InitX11(NULL); \ + GuiMainFn_(); \ + UPP::Ctrl::CloseTopCtrls(); \ + UPP::UsrLog("---------- About to delete this log..."); \ + UPP::DeleteUsrLog(); \ + UPP::Ctrl::ExitX11(); \ + UPP::AppExit__(); \ + return UPP::GetExitCode(); \ +} \ + \ +void GuiMainFn_() + +#endif + +#ifdef PLATFORM_X11 + +class DHCtrl : public Ctrl { + int isError; + bool isMapped; + Size CurrentSize; + XVisualInfo* UserVisualInfo; + String ErrorMessage; + + void MapWindow(bool map); + bool Init(void); + void Terminate(void); + +protected: + Visual *GetVisual(void); + XVisualInfo GetVisualInfo(void); + + virtual XVisualInfo *CreateVisual(void) {return 0;} + virtual void SetAttributes(unsigned long &ValueMask, XSetWindowAttributes &attr) {} + virtual void Paint(Draw &draw) {} + virtual void BeforeInit(void) {} + virtual void AfterInit(bool Error) {} + virtual void BeforeTerminate(void) {} + virtual void AfterTerminate(void) {} + virtual void Resize(int w, int h) {} + + void SetError(bool err) { isError = err; } + void SetErrorMessage(String const &msg) { ErrorMessage = msg; } + + virtual void State(int reason); + + Window hwnd; + bool isInitialized; + +public: + typedef DHCtrl CLASSNAME; + + bool IsInitialized(void) { return isInitialized; } + + bool GetError(void) { return isError; } + String GetErrorMessage(void) { return ErrorMessage; } + + DHCtrl(); + ~DHCtrl(); +}; diff --git a/uppsrc/CtrlCore/init b/uppsrc/CtrlCore/init index 73ff12f43..7db760972 100644 --- a/uppsrc/CtrlCore/init +++ b/uppsrc/CtrlCore/init @@ -3,7 +3,7 @@ #include "Draw/init" #include "plugin\bmp/init" #include "RichText/init" -#define BLITZ_INDEX__ FAD522E48059537735D9D4570440139B2 +#define BLITZ_INDEX__ F478533DBF25E483F736FEAFEB9D9AEC8 #include "CtrlCore.icpp" #undef BLITZ_INDEX__ #endif