diff options
author | George Hazan <ghazan@miranda.im> | 2022-05-10 17:33:31 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-05-10 17:33:31 +0300 |
commit | 940717baac9f354399003342e19985ef8dc7c3eb (patch) | |
tree | 7309b7faad1325f70c220e284be41d2749b3413e | |
parent | 62df0036431a1d507cf7749f639c86d0cbf9b2fb (diff) |
mir_core: added header files for Enlightenment
-rw-r--r-- | include/m_gui.h | 236 | ||||
-rw-r--r-- | src/mir_core/mir_core.mk | 4 | ||||
-rw-r--r-- | src/mir_core/mir_core.project | 9 | ||||
-rw-r--r-- | src/mir_core/src/Linux/CCtrlBase.cpp | 1 | ||||
-rw-r--r-- | src/mir_core/src/stdafx.h | 30 |
5 files changed, 144 insertions, 136 deletions
diff --git a/include/m_gui.h b/include/m_gui.h index 6ff14548d7..e8a04b861e 100644 --- a/include/m_gui.h +++ b/include/m_gui.h @@ -325,6 +325,124 @@ public: }; ///////////////////////////////////////////////////////////////////////////////////////// +// CCtrlBase + +struct CContextMenuPos +{ + const class CCtrlBase *pCtrl; + POINT pt; + union { + int iCurr; // int for list boxes + HTREEITEM hItem; + }; +}; + +class MIR_CORE_EXPORT CCtrlBase +{ + friend class CDlgBase; + + __forceinline CCtrlBase(const CCtrlBase&) = delete; + __forceinline CCtrlBase& operator=(const CCtrlBase&) = delete; + +public: + CCtrlBase(CDlgBase *wnd, int idCtrl); + virtual ~CCtrlBase(); + + __forceinline HWND GetHwnd() const { return m_hwnd; } + __forceinline int GetCtrlId() const { return m_idCtrl; } + __forceinline CDlgBase *GetParent() const { return m_parentWnd; } + __forceinline bool IsChanged() const { return m_bChanged; } + __forceinline void SetSilent(bool bSilent = true) { m_bSilent = bSilent; } + __forceinline void UseSystemColors() { m_bUseSystemColors = true; } + + void Show(bool bShow = true); + __forceinline void Hide() { Show(false); } + + void Enable(bool bIsEnable = true); + __forceinline void Disable() { Enable(false); } + bool Enabled(void) const; + + void NotifyChange(); + void SetDraw(bool bEnable); + + LRESULT SendMsg(UINT Msg, WPARAM wParam, LPARAM lParam) const; + + void SetText(const wchar_t *text); + void SetTextA(const char *text); + void SetInt(int value); + + wchar_t* GetText() const; + char* GetTextA() const; + char* GetTextU() const; + + wchar_t* GetText(wchar_t *buf, size_t size) const; + char* GetTextA(char *buf, size_t size) const; + char* GetTextU(char *buf, size_t size) const; + + int GetInt() const; + + virtual BOOL OnCommand(HWND /*hwndCtrl*/, uint16_t /*idCtrl*/, uint16_t /*idCode*/) { return FALSE; } + virtual BOOL OnNotify(int /*idCtrl*/, NMHDR* /*pnmh*/) { return FALSE; } + + virtual BOOL OnMeasureItem(MEASUREITEMSTRUCT*) { return FALSE; } + virtual BOOL OnDrawItem(DRAWITEMSTRUCT*) { return FALSE; } + virtual BOOL OnDeleteItem(DELETEITEMSTRUCT*) { return FALSE; } + + virtual void OnInit(); + virtual void OnDestroy(); + + virtual bool OnApply(); + virtual void OnReset(); + +protected: + HWND m_hwnd = nullptr; // must be the first data item + int m_idCtrl; + CDlgBase* m_parentWnd; + bool m_bChanged = false, m_bSilent = false, m_bUseSystemColors = false, m_bNotifiable = false; + +public: + CCallback<CCtrlBase> OnChange; + CCallback<CContextMenuPos> OnBuildMenu; + +protected: + virtual void GetCaretPos(CContextMenuPos&) const; + virtual LRESULT CustomWndProc(UINT msg, WPARAM wParam, LPARAM lParam); + + void Subclass(); + void Unsubclass(); + +private: + static LRESULT CALLBACK GlobalSubclassWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); +}; + +///////////////////////////////////////////////////////////////////////////////////////// +// CCtrlData - data access controls base class + +class MIR_CORE_EXPORT CCtrlData : public CCtrlBase +{ + typedef CCtrlBase CSuper; + +public: + CCtrlData(CDlgBase *dlg, int ctrlId); + ~CCtrlData(); + + void CreateDbLink(const char* szModuleName, const char* szSetting, uint8_t type, uint32_t iValue); + void CreateDbLink(const char* szModuleName, const char* szSetting, wchar_t* szValue); + void CreateDbLink(CDataLink *link) { m_dbLink = link; } + + void OnInit() override; + +protected: + CDataLink *m_dbLink; + + __inline uint8_t GetDataType() { return m_dbLink ? m_dbLink->GetDataType() : DBVT_DELETED; } + __inline uint32_t LoadInt() { return m_dbLink ? m_dbLink->LoadInt() : 0; } + __inline void SaveInt(uint32_t value) { if (m_dbLink) m_dbLink->SaveInt(value); } + __inline const wchar_t *LoadText() { return m_dbLink ? m_dbLink->LoadText() : L""; } + __inline void SaveText(wchar_t *value) { if (m_dbLink) m_dbLink->SaveText(value); } +}; + +///////////////////////////////////////////////////////////////////////////////////////// // CDlgBase - base dialog class class MIR_CORE_EXPORT CDlgBase @@ -465,97 +583,6 @@ protected: }; ///////////////////////////////////////////////////////////////////////////////////////// -// CCtrlBase - -struct CContextMenuPos -{ - const CCtrlBase *pCtrl; - POINT pt; - union { - int iCurr; // int for list boxes - HTREEITEM hItem; - }; -}; - -class MIR_CORE_EXPORT CCtrlBase -{ - friend class CDlgBase; - - __forceinline CCtrlBase(const CCtrlBase&) = delete; - __forceinline CCtrlBase& operator=(const CCtrlBase&) = delete; - -public: - CCtrlBase(CDlgBase *wnd, int idCtrl); - virtual ~CCtrlBase(); - - __forceinline HWND GetHwnd() const { return m_hwnd; } - __forceinline int GetCtrlId() const { return m_idCtrl; } - __forceinline CDlgBase *GetParent() const { return m_parentWnd; } - __forceinline bool IsChanged() const { return m_bChanged; } - __forceinline void SetSilent(bool bSilent = true) { m_bSilent = bSilent; } - __forceinline void UseSystemColors() { m_bUseSystemColors = true; } - - void Show(bool bShow = true); - __forceinline void Hide() { Show(false); } - - void Enable(bool bIsEnable = true); - __forceinline void Disable() { Enable(false); } - bool Enabled(void) const; - - void NotifyChange(); - void SetDraw(bool bEnable); - - LRESULT SendMsg(UINT Msg, WPARAM wParam, LPARAM lParam) const; - - void SetText(const wchar_t *text); - void SetTextA(const char *text); - void SetInt(int value); - - wchar_t* GetText() const; - char* GetTextA() const; - char* GetTextU() const; - - wchar_t* GetText(wchar_t *buf, size_t size) const; - char* GetTextA(char *buf, size_t size) const; - char* GetTextU(char *buf, size_t size) const; - - int GetInt() const; - - virtual BOOL OnCommand(HWND /*hwndCtrl*/, uint16_t /*idCtrl*/, uint16_t /*idCode*/) { return FALSE; } - virtual BOOL OnNotify(int /*idCtrl*/, NMHDR* /*pnmh*/) { return FALSE; } - - virtual BOOL OnMeasureItem(MEASUREITEMSTRUCT*) { return FALSE; } - virtual BOOL OnDrawItem(DRAWITEMSTRUCT*) { return FALSE; } - virtual BOOL OnDeleteItem(DELETEITEMSTRUCT*) { return FALSE; } - - virtual void OnInit(); - virtual void OnDestroy(); - - virtual bool OnApply(); - virtual void OnReset(); - -protected: - HWND m_hwnd = nullptr; // must be the first data item - int m_idCtrl; - CDlgBase* m_parentWnd; - bool m_bChanged = false, m_bSilent = false, m_bUseSystemColors = false, m_bNotifiable = false; - -public: - CCallback<CCtrlBase> OnChange; - CCallback<CContextMenuPos> OnBuildMenu; - -protected: - virtual void GetCaretPos(CContextMenuPos&) const; - virtual LRESULT CustomWndProc(UINT msg, WPARAM wParam, LPARAM lParam); - - void Subclass(); - void Unsubclass(); - -private: - static LRESULT CALLBACK GlobalSubclassWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -}; - -///////////////////////////////////////////////////////////////////////////////////////// // CCtrlLabel class MIR_CORE_EXPORT CCtrlLabel : public CCtrlBase @@ -741,33 +768,6 @@ protected: }; ///////////////////////////////////////////////////////////////////////////////////////// -// CCtrlData - data access controls base class - -class MIR_CORE_EXPORT CCtrlData : public CCtrlBase -{ - typedef CCtrlBase CSuper; - -public: - CCtrlData(CDlgBase *dlg, int ctrlId); - ~CCtrlData(); - - void CreateDbLink(const char* szModuleName, const char* szSetting, uint8_t type, uint32_t iValue); - void CreateDbLink(const char* szModuleName, const char* szSetting, wchar_t* szValue); - void CreateDbLink(CDataLink *link) { m_dbLink = link; } - - void OnInit() override; - -protected: - CDataLink *m_dbLink; - - __inline uint8_t GetDataType() { return m_dbLink ? m_dbLink->GetDataType() : DBVT_DELETED; } - __inline uint32_t LoadInt() { return m_dbLink ? m_dbLink->LoadInt() : 0; } - __inline void SaveInt(uint32_t value) { if (m_dbLink) m_dbLink->SaveInt(value); } - __inline const wchar_t *LoadText() { return m_dbLink ? m_dbLink->LoadText() : L""; } - __inline void SaveText(wchar_t *value) { if (m_dbLink) m_dbLink->SaveText(value); } -}; - -///////////////////////////////////////////////////////////////////////////////////////// // CCtrlCheck class MIR_CORE_EXPORT CCtrlCheck : public CCtrlData diff --git a/src/mir_core/mir_core.mk b/src/mir_core/mir_core.mk index fa62392e26..f6186ffec1 100644 --- a/src/mir_core/mir_core.mk +++ b/src/mir_core/mir_core.mk @@ -52,8 +52,8 @@ LibPath := $(LibraryPathSwitch). AR := ar rcus CXX := g++ CC := gcc -CXXFLAGS := -g $(pkg-config --cflags --libs elementary) -fPIC $(Preprocessors) -CFLAGS := -g $(pkg-config --cflags --libs elementary) -fPIC $(Preprocessors) +CXXFLAGS := -g $(shell pkg-config --cflags --libs elementary) -fPIC $(Preprocessors) +CFLAGS := -g $(shell pkg-config --cflags --libs elementary) -fPIC $(Preprocessors) ASFLAGS := AS := as diff --git a/src/mir_core/mir_core.project b/src/mir_core/mir_core.project index 5b379a7eb1..4a24b8ce91 100644 --- a/src/mir_core/mir_core.project +++ b/src/mir_core/mir_core.project @@ -28,6 +28,11 @@ <File Name="src/binbuffer.cpp"/> </VirtualDirectory> <VirtualDirectory Name="include"> + <File Name="../../include/m_gui.h"/> + <File Name="../../include/m_utils.h"/> + <File Name="../../include/m_types.h"/> + <File Name="../../include/m_system.h"/> + <File Name="../../include/m_string.h"/> <File Name="src/stdafx.h"/> <File Name="src/tinyxml2.h"/> <File Name="src/miranda.h"/> @@ -43,7 +48,7 @@ <ResourceCompiler Options=""/> </GlobalSettings> <Configuration Name="Debug" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append"> - <Compiler Options="-g;$(pkg-config --cflags --libs elementary) -fPIC" C_Options="-g;$(pkg-config --cflags --libs elementary) -fPIC" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"> + <Compiler Options="-g $(shell pkg-config --cflags --libs elementary) -fPIC" C_Options="-g $(shell pkg-config --cflags --libs elementary) -fPIC" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"> <IncludePath Value="."/> <IncludePath Value="../../include"/> </Compiler> @@ -83,7 +88,7 @@ </Completion> </Configuration> <Configuration Name="Release" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append"> - <Compiler Options="-O2;$(pkg-config --cflags --libs elementary) -fPIC" C_Options="-O2;$(pkg-config --cflags --libs elementary) -fPIC" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"> + <Compiler Options="-O2 $(shell pkg-config --cflags --libs elementary) -fPIC" C_Options="-O2 $(shell pkg-config --cflags --libs elementary) -fPIC" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"> <IncludePath Value="."/> <IncludePath Value="../../include"/> <IncludePath Value="`pkg-config --cflags --libs elementary`"/> diff --git a/src/mir_core/src/Linux/CCtrlBase.cpp b/src/mir_core/src/Linux/CCtrlBase.cpp index bfb7d7e7fc..61d03c99af 100644 --- a/src/mir_core/src/Linux/CCtrlBase.cpp +++ b/src/mir_core/src/Linux/CCtrlBase.cpp @@ -105,6 +105,7 @@ void CCtrlBase::NotifyChange() LRESULT CCtrlBase::SendMsg(UINT Msg, WPARAM wParam, LPARAM lParam) const { // return ::SendMessage(m_hwnd, Msg, wParam, lParam); + return 0; } void CCtrlBase::SetText(const wchar_t *text) diff --git a/src/mir_core/src/stdafx.h b/src/mir_core/src/stdafx.h index 86a8f5681b..f053907693 100644 --- a/src/mir_core/src/stdafx.h +++ b/src/mir_core/src/stdafx.h @@ -27,21 +27,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define INCL_WINSOCK_API_TYPEDEFS 1 #ifdef _MSC_VER -#include <winsock2.h> -#include <ws2tcpip.h> -#include <windows.h> -#include <windowsx.h> -#include <shlobj.h> -#include <commctrl.h> -#include <ShellAPI.h> -#include <vssym32.h> -#include <Uxtheme.h> -#include <Richedit.h> -#include <Wtsapi32.h> + #include <winsock2.h> + #include <ws2tcpip.h> + #include <windows.h> + #include <windowsx.h> + #include <shlobj.h> + #include <commctrl.h> + #include <ShellAPI.h> + #include <vssym32.h> + #include <Uxtheme.h> + #include <Richedit.h> + #include <Wtsapi32.h> -#include <process.h> -#include <io.h> -#include <direct.h> + #include <process.h> + #include <io.h> + #include <direct.h> +#else + #include <Elementary.h> #endif // _WINDOWS #include <malloc.h> |