diff options
author | George Hazan <ghazan@miranda.im> | 2018-01-17 23:14:12 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-01-17 23:14:32 +0300 |
commit | dcfb8826d85930581d179164afb1522c88074b2d (patch) | |
tree | e2b57adef41bcfbed8038b3f8844e6edbbea736d | |
parent | fc14cd04c3894702603bb4db7e56258608c5c8d7 (diff) |
no need to copy that stuff each time
-rw-r--r-- | include/m_gui.h | 1 | ||||
-rw-r--r-- | src/mir_app/src/menu_options.cpp | 8 | ||||
-rw-r--r-- | src/mir_app/src/proto_order.cpp | 14 | ||||
-rw-r--r-- | src/mir_core/src/CCtrlTreeView.cpp | 23 |
4 files changed, 27 insertions, 19 deletions
diff --git a/include/m_gui.h b/include/m_gui.h index 5ff03a72f1..746cb66ff7 100644 --- a/include/m_gui.h +++ b/include/m_gui.h @@ -1248,6 +1248,7 @@ public: protected:
virtual void OnInit() override;
+ virtual void OnDestroy() override;
virtual BOOL OnNotify(int idCtrl, NMHDR *pnmh) override;
virtual LRESULT CustomWndProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp index 750fe1fd8a..93e4422902 100644 --- a/src/mir_app/src/menu_options.cpp +++ b/src/mir_app/src/menu_options.cpp @@ -293,7 +293,7 @@ public: m_menuObjects.OnSelChange = Callback(this, &CGenMenuOptionsPage::onMenuObjectChanged); - m_menuItems.SetFlags(MTREE_CHECKBOX | MTREE_DND /*| MTREE_MULTISELECT*/); + m_menuItems.SetFlags(MTREE_CHECKBOX | MTREE_DND); m_menuItems.OnSelChanged = Callback(this, &CGenMenuOptionsPage::onMenuItemChanged); m_menuItems.OnBeginDrag = Callback(this, &CGenMenuOptionsPage::onMenuItemBeginDrag); @@ -307,11 +307,6 @@ public: { iInitMenuValue = db_get_b(0, "CList", "MoveProtoMenus", TRUE); - HIMAGELIST himlCheckBoxes = ImageList_Create(g_iIconSX, g_iIconSY, ILC_COLOR32 | ILC_MASK, 2, 2); - ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_NOTICK); - ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_TICK); - m_menuItems.SetImageList(himlCheckBoxes, TVSIL_NORMAL); - if (iInitMenuValue) m_radio2.SetState(true); else @@ -348,7 +343,6 @@ public: virtual void OnDestroy() { - ImageList_Destroy(m_menuItems.GetImageList(TVSIL_NORMAL)); FreeTreeData(); } diff --git a/src/mir_app/src/proto_order.cpp b/src/mir_app/src/proto_order.cpp index b72b6ff049..c1b971b185 100644 --- a/src/mir_app/src/proto_order.cpp +++ b/src/mir_app/src/proto_order.cpp @@ -153,17 +153,12 @@ public: m_order.OnDeleteItem = Callback(this, &CProtocolOrderOpts::onOrder_DeleteItem);
}
- virtual void OnInitDialog()
+ virtual void OnInitDialog() override
{
- HIMAGELIST himlCheckBoxes = ImageList_Create(g_iIconSX, g_iIconSY, ILC_COLOR32 | ILC_MASK, 2, 2);
- ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_NOTICK);
- ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_TICK);
- m_order.SetImageList(himlCheckBoxes, TVSIL_NORMAL);
-
FillTree();
}
- virtual void OnApply()
+ virtual void OnApply() override
{
int idx = 0;
@@ -195,11 +190,6 @@ public: Clist_Broadcast(INTM_INVALIDATE, 0, 0);
}
- virtual void OnDestroy()
- {
- ImageList_Destroy(m_order.GetImageList(TVSIL_NORMAL));
- }
-
void onReset_Click(CCtrlButton*)
{
for (int i = 0; i < accounts.getCount(); i++)
diff --git a/src/mir_core/src/CCtrlTreeView.cpp b/src/mir_core/src/CCtrlTreeView.cpp index 0a8ba4e8b2..52c7df846b 100644 --- a/src/mir_core/src/CCtrlTreeView.cpp +++ b/src/mir_core/src/CCtrlTreeView.cpp @@ -22,6 +22,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" +int ImageList_AddIcon_IconLibLoaded(HIMAGELIST hIml, int iconId) +{ + HICON hIcon = Skin_LoadIcon(iconId); + int res = ImageList_AddIcon(hIml, hIcon); + IcoLib_ReleaseIcon(hIcon); + return res; +} + ///////////////////////////////////////////////////////////////////////////////////////// // CCtrlTreeView @@ -51,6 +59,21 @@ void CCtrlTreeView::OnInit() if (m_bDndEnabled) Subclass(); + + if (m_bCheckBox) { + HIMAGELIST himlCheckBoxes = ::ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 2, 2); + ::ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_NOTICK); + ::ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_TICK); + SetImageList(himlCheckBoxes, TVSIL_NORMAL); + } +} + +void CCtrlTreeView::OnDestroy() +{ + if (m_bCheckBox) + ::ImageList_Destroy(GetImageList(TVSIL_NORMAL)); + + CSuper::OnDestroy(); } HTREEITEM CCtrlTreeView::MoveItemAbove(HTREEITEM hItem, HTREEITEM hInsertAfter, HTREEITEM hParent) |