diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-02 21:10:16 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-02 21:10:16 +0000 |
commit | 990f961261d92fccadb16b495171bb619c0183f0 (patch) | |
tree | e2c2d4110b437c40c78b2d2d1ad7dc697b6b3eb0 /plugins/TopToolBar/ttbopt.cpp | |
parent | 86d99d06faff75e498f2d41bb9af49280e2b6ebb (diff) |
compilation fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@729 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TopToolBar/ttbopt.cpp')
-rw-r--r-- | plugins/TopToolBar/ttbopt.cpp | 81 |
1 files changed, 42 insertions, 39 deletions
diff --git a/plugins/TopToolBar/ttbopt.cpp b/plugins/TopToolBar/ttbopt.cpp index 6f9565896b..f2baa430d5 100644 --- a/plugins/TopToolBar/ttbopt.cpp +++ b/plugins/TopToolBar/ttbopt.cpp @@ -2,42 +2,6 @@ static HWND OptionshWnd;
-void AddToOptions(TopButtonInt* b)
-{
- if (OptionshWnd) {
- HWND hTree = GetDlgItem(OptionshWnd, IDC_BUTTONORDERTREE);
- OrderData *dat = (struct OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA);
- AddLine(hTree, b, TVI_LAST, dat->himlButtonIcons);
- }
-}
-
-void RemoveFromOptions(int id)
-{
- if (OptionshWnd) {
- HWND hTree = GetDlgItem(OptionshWnd, IDC_BUTTONORDERTREE);
- TVITEM tvi = { 0 };
- tvi.hItem = TreeView_GetRoot(hTree);
- tvi.mask = TVIF_PARAM | TVIF_HANDLE;
-
- TopButtonInt* btn;
- while(tvi.hItem != NULL) {
- TreeView_GetItem(hTree, &tvi);
- btn = (TopButtonInt*)tvi.lParam;
- if (btn->id == id) {
- // delete if was changed
- if (btn->dwFlags & TTBBF_OPTIONAL)
- delete btn;
- TreeView_DeleteItem(hTree,tvi.hItem);
- break;
- }
-
- tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
- }
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
struct OrderData
{
int dragging;
@@ -45,6 +9,8 @@ struct OrderData HIMAGELIST himlButtonIcons;
};
+/////////////////////////////////////////////////////////////////////////////////////////
+
static HTREEITEM AddLine(HWND hTree,TopButtonInt *b, HTREEITEM hItem, HIMAGELIST il)
{
TVINSERTSTRUCT tvis = { 0 };
@@ -85,7 +51,7 @@ static HTREEITEM AddLine(HWND hTree,TopButtonInt *b, HTREEITEM hItem, HIMAGELIST static int BuildTree(HWND hwndDlg)
{
HWND hTree = GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE);
- OrderData *dat = (struct OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA);
+ OrderData *dat = (OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA);
dat->himlButtonIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 2, 2);
TreeView_SetImageList(hTree, dat->himlButtonIcons, TVSIL_NORMAL);
@@ -172,17 +138,54 @@ static void RecreateWindows() }
/////////////////////////////////////////////////////////////////////////////////////////
+// external functions
+
+void AddToOptions(TopButtonInt* b)
+{
+ if (OptionshWnd) {
+ HWND hTree = GetDlgItem(OptionshWnd, IDC_BUTTONORDERTREE);
+ OrderData *dat = (OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA);
+ AddLine(hTree, b, TVI_LAST, dat->himlButtonIcons);
+ }
+}
+
+void RemoveFromOptions(int id)
+{
+ if (OptionshWnd) {
+ HWND hTree = GetDlgItem(OptionshWnd, IDC_BUTTONORDERTREE);
+ TVITEM tvi = { 0 };
+ tvi.hItem = TreeView_GetRoot(hTree);
+ tvi.mask = TVIF_PARAM | TVIF_HANDLE;
+
+ TopButtonInt* btn;
+ while(tvi.hItem != NULL) {
+ TreeView_GetItem(hTree, &tvi);
+ btn = (TopButtonInt*)tvi.lParam;
+ if (btn->id == id) {
+ // delete if was changed
+ if (btn->dwFlags & TTBBF_OPTIONAL)
+ delete btn;
+ TreeView_DeleteItem(hTree,tvi.hItem);
+ break;
+ }
+
+ tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
+ }
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Options window: main
static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND hTree = GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE);
- struct OrderData *dat = (struct OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA);
+ OrderData *dat = (OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- dat = (struct OrderData*)malloc(sizeof(struct OrderData));
+ dat = (OrderData*)malloc( sizeof(OrderData));
SetWindowLongPtr(hTree, GWLP_USERDATA, (LONG)dat);
dat->dragging = 0;
|