diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-07-17 23:34:51 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-07-17 23:34:51 +0300 |
commit | 0c99b116f722a4609c29a4fbda986cd1e2c6790a (patch) | |
tree | 15fe0c83f5bcd81b4036c097b24b85666d8f3930 | |
parent | d9a35471323e0d41b6a0cb80e543214bfc297e5f (diff) |
modified: commonheaders.h
modified: init.cpp
new file: m_msg_buttonsbar.h
modified: ui.cpp
-rw-r--r-- | commonheaders.h | 1 | ||||
-rw-r--r-- | init.cpp | 11 | ||||
-rw-r--r-- | m_msg_buttonsbar.h | 120 | ||||
-rw-r--r-- | ui.cpp | 11 |
4 files changed, 133 insertions, 10 deletions
diff --git a/commonheaders.h b/commonheaders.h index 8c01fb2..0fd971d 100644 --- a/commonheaders.h +++ b/commonheaders.h @@ -39,4 +39,5 @@ using std::list; #include "globals.h" #include "main.h" #include "utilities.h" +#include "m_msg_buttonsbar.h" #endif @@ -23,11 +23,10 @@ PLUGINLINK *pluginLink; static int OnModulesLoaded(WPARAM wParam,LPARAM lParam); extern char *date(); list <JabberAccount*> Accounts; -XML_API xi; -NETLIBUSER nu; - -struct MM_INTERFACE mmi; -struct UTF8_INTERFACE utfi; +XML_API xi = {0}; +NETLIBUSER nu = {0}; +MM_INTERFACE mmi = {0}; +UTF8_INTERFACE utfi = {0}; @@ -94,6 +93,7 @@ extern int GetJabberInterface(WPARAM, LPARAM); extern int HandleDbNewContact(WPARAM w, LPARAM l); extern int HandleDbContactDeleted(WPARAM w, LPARAM l); extern void FindJuickAccounts(); +extern int CreateButtons(); static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) { GetJabberInterface(0,0); @@ -102,6 +102,7 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) hDbContactAdded = HookEvent(ME_DB_CONTACT_ADDED, HandleDbNewContact); hDbContactAdded = HookEvent(ME_DB_CONTACT_DELETED, HandleDbContactDeleted); FindJuickAccounts(); + CreateButtons(); return 0; } diff --git a/m_msg_buttonsbar.h b/m_msg_buttonsbar.h new file mode 100644 index 0000000..31735f8 --- /dev/null +++ b/m_msg_buttonsbar.h @@ -0,0 +1,120 @@ +#ifndef M_MSG_BUTTONSBAR_H__
+#define M_MSG_BUTTONSBAR_H__
+
+//////////////////////////////////////////////////////////////////////////
+// Services
+//
+//////////////////////////////////////////////////////////////////////////
+// Adding a button
+//
+// wParam = 0
+// lParam = (BBButton *) &description
+#define MS_BB_ADDBUTTON "TabSRMM/ButtonsBar/AddButton"
+
+//////////////////////////////////////////////////////////////////////////
+// Remove button
+//
+// wParam = 0
+// lParam = (BBButton *) &description, only button ID and ModuleName used
+#define MS_BB_REMOVEBUTTON "TabSRMM/ButtonsBar/RemoveButton"
+
+//////////////////////////////////////////////////////////////////////////
+// ModifyButton(global)
+//
+// wParam = 0
+// lParam = (BBButton *) &description
+#define MS_BB_MODIFYBUTTON "TabSRMM/ButtonsBar/ModifyButton"
+
+
+#define BBSF_HIDDEN (1<<0)
+#define BBSF_DISABLED (1<<1)
+#define BBSF_PUSHED (1<<2)
+#define BBSF_RELEASED (1<<3)
+
+//////////////////////////////////////////////////////////////////////////
+// GetButtonState(local)
+//
+// wParam = hContact
+// lParam = (BBButton *) &description , only ModuleName and ID used
+// Returns BBButton struct with BBSF_ bbbFlags:
+#define MS_BB_GETBUTTONSTATE "TabSRMM/ButtonsBar/GetButtonState"
+
+//////////////////////////////////////////////////////////////////////////
+// SetButtonState (local)
+//
+// wParam = hContact
+// lParam = (BBButton *) &description , ModuleName, ID,hIcon,Tooltip, and BBSF_ bbbFlags are used
+#define MS_BB_SETBUTTONSTATE "TabSRMM/ButtonsBar/SetButtonState"
+
+
+////////////////////////////////////////////////////////////////
+//Events
+//
+///////////////////////////////////////////////////
+// ToolBar loaded event
+// wParam = 0;
+// lParam = 0;
+// This event will be send after module loaded and after each toolbar reset
+// You should add your buttons on this event
+#define ME_MSG_TOOLBARLOADED "TabSRMM/ButtonsBar/ModuleLoaded"
+
+///////////////////////////////////////////////////
+// ButtonClicked event
+// wParam = (HANDLE)hContact;
+// lParam = (CustomButtonClickData *)&CustomButtonClickData;
+// catch to show a popup menu, etc.
+#define ME_MSG_BUTTONPRESSED "TabSRMM/ButtonsBar/ButtonPressed"
+
+
+//event flags
+#define BBCF_RIGHTBUTTON (1<<0)
+#define BBCF_SHIFTPRESSED (1<<1)
+#define BBCF_CONTROLPRESSED (1<<2)
+#define BBCF_ARROWCLICKED (1<<3)
+
+typedef struct {
+ int cbSize;
+ POINT pt; // screen coordinates for menus
+ char* pszModule; // button owners name
+ DWORD dwButtonId; // registered button ID
+ HWND hwndFrom; // button parents HWND
+ HANDLE hContact; //
+ DWORD flags; // BBCF_ flags
+ } CustomButtonClickData;
+
+
+//button flags
+#define BBBF_DISABLED (1<<0)
+#define BBBF_HIDDEN (1<<1)
+#define BBBF_ISPUSHBUTTON (1<<2)
+#define BBBF_ISARROWBUTTON (1<<3)
+#define BBBF_ISCHATBUTTON (1<<4)
+#define BBBF_ISIMBUTTON (1<<5)
+#define BBBF_ISLSIDEBUTTON (1<<6)
+#define BBBF_ISRSIDEBUTTON (1<<7)
+#define BBBF_CANBEHIDDEN (1<<8)
+#define BBBF_ISDUMMYBUTTON (1<<9)
+#define BBBF_ANSITOOLTIP (1<<10)
+
+#define BBBF_CREATEBYID (1<<11) //only for tabsrmm internal use
+
+typedef struct _tagBBButton
+ {
+ int cbSize; // size of structure
+
+ DWORD dwButtonID; // your button ID, will be combined with pszModuleName for storing settings, etc...
+
+ char* pszModuleName; //module name without spaces and underline symbols (e.g. "tabsrmm")
+ union{
+ char* pszTooltip; //button's tooltip
+ TCHAR* ptszTooltip;
+ };
+ DWORD dwDefPos; // default order pos of button, counted from window edge (left or right)
+ // use value >100, because internal buttons using 10,20,30... 80, etc
+ int iButtonWidth; // must be 0
+ DWORD bbbFlags; // combine of BBBF_ flags above
+ HANDLE hIcon; //Handle to icolib registered icon, it's better to register with pszSection = "TabSRMM/Toolbar"
+ }BBButton;
+
+
+#endif //M_MSG_BUTTONSBAR_H__
@@ -18,11 +18,12 @@ int CreateButtons() { -/* CustomButtonData button; - button.bIMButton = TRUE; + BBButton button = {0}; + button.cbSize = sizeof(button); button.pszModuleName = szModuleName; - button.ptszTooltip = _T("Test button"); - CB_AddButton(0, (LPARAM)&button); - CB_InitCustomButtons();*/ + button.pszTooltip = "Test button"; + button.bbbFlags = BBBF_ISPUSHBUTTON |BBBF_ISIMBUTTON; + button.dwDefPos = 100; + CallService(MS_BB_ADDBUTTON, 0, (WPARAM)&button); return 0; }
\ No newline at end of file |