source: trunk/src/HaliteListView.hpp @ 657

Revision 657, 10.0 KB checked in by Eoin, 12 years ago (diff)

Classic sorting and external sorting not playing nice together.

RevLine 
[384]1
2//         Copyright Eóin O'Callaghan 2006 - 2008.
3// Distributed under the Boost Software License, Version 1.0.
4//    (See accompanying file LICENSE_1_0.txt or copy at
5//          http://www.boost.org/LICENSE_1_0.txt)
6
7#pragma once
8
9#define HAL_MAIN_LISTVIEW_BEGIN                 30000
10#define ID_LVM_DOWNLOAD_FOLDER          HAL_MAIN_LISTVIEW_BEGIN + 1
11#define ID_LVM_RECHECK                                  HAL_MAIN_LISTVIEW_BEGIN + 2
12#define ID_LVM_EDIT_FOLDERS                             HAL_MAIN_LISTVIEW_BEGIN + 3
13#define HAL_LISTVIEW_CONFIRMDELETE              HAL_MAIN_LISTVIEW_BEGIN + 4
14#define HAL_LVM_QUEUE_VIEW                              HAL_MAIN_LISTVIEW_BEGIN + 5
15#define HAL_AUTO_MANAGED                                HAL_MAIN_LISTVIEW_BEGIN + 6
16#define HAL_UNMANAGED                                   HAL_MAIN_LISTVIEW_BEGIN + 7
[436]17#define HAL_MANAGED_DOWNLOADING                 HAL_MAIN_LISTVIEW_BEGIN + 8
[384]18#define HAL_MANAGED_SEEDING                             HAL_MAIN_LISTVIEW_BEGIN + 9
[436]19#define HAL_QUEUE_MOVE_TOP                              HAL_MAIN_LISTVIEW_BEGIN + 10
[384]20#define HAL_QUEUE_MOVE_UP                               HAL_MAIN_LISTVIEW_BEGIN + 11
[436]21#define HAL_QUEUE_MOVE_DOWN                             HAL_MAIN_LISTVIEW_BEGIN + 12
[403]22#define HAL_QUEUE_MOVE_BOTTOM                   HAL_MAIN_LISTVIEW_BEGIN + 13
[437]23
24#ifndef RC_INVOKED
[459]25
26#include "Halite.hpp"
[616]27
28#include <boost/array.hpp>
29#include <boost/signals.hpp>
30
31#include "global/string_conv.hpp"
32
33#include "halIni.hpp"
34#include "HaliteListViewCtrl.hpp"
35#include "HaliteSortListViewCtrl.hpp"
36
37class HaliteWindow;
38
39class HaliteListViewCtrl :
40        public CHaliteSortListViewCtrl<HaliteListViewCtrl, const hal::torrent_details_ptr>,
41        public WTL::CCustomDraw<HaliteListViewCtrl>,
42        private hal::IniBase<HaliteListViewCtrl>,
43        private boost::noncopyable
44{
[384]45protected:
46        typedef HaliteListViewCtrl thisClass;
47        typedef hal::IniBase<thisClass> iniClass;
48        typedef CHaliteSortListViewCtrl<thisClass, const hal::torrent_details_ptr> listClass;
49        typedef WTL::CCustomDraw<thisClass> ownDrawClass;
50
[392]51        friend class listClass;
[384]52
53public:
54        enum { 
55                LISTVIEW_ID_MENU = HAL_LISTVIEW_MENU,
56                LISTVIEW_ID_COLUMNNAMES = HAL_LISTVIEW_COLUMNS,
57                LISTVIEW_ID_COLUMNWIDTHS = HAL_LISTVIEW_DEFAULTS
58        };
59
60        HaliteListViewCtrl(HaliteWindow& HalWindow);
[392]61
62        BEGIN_MSG_MAP_EX(HaliteListViewCtrl)
63                MSG_WM_SHOWWINDOW(OnShowWindow)
64                MSG_WM_DESTROY(OnDestroy)
[384]65
66                COMMAND_ID_HANDLER(ID__LVM_PAUSE, OnPause)
67                COMMAND_ID_HANDLER(ID_LVM_STOP, OnStop)
68                COMMAND_ID_HANDLER(ID_LVM_RESUME, OnResume)
69                COMMAND_ID_HANDLER(ID_LVM_RECHECK, OnRecheck)
70                COMMAND_ID_HANDLER(ID_LVM_REMOVE_T, OnRemove)
71                COMMAND_ID_HANDLER(ID_LVM_REMOVE_TD, OnRemoveWipeFiles)
72                COMMAND_ID_HANDLER(ID_LVM_DOWNLOAD_FOLDER, OnDownloadFolder)
73                COMMAND_ID_HANDLER(ID_LVM_EDIT_FOLDERS, OnEditFolders)
74
75                COMMAND_ID_HANDLER(HAL_AUTO_MANAGED, OnSetManaged)
76                COMMAND_ID_HANDLER(HAL_UNMANAGED, OnSetUnmanaged)
77                COMMAND_RANGE_HANDLER(HAL_QUEUE_MOVE_TOP, HAL_QUEUE_MOVE_BOTTOM, OnAdjustQueuePosition)
78                COMMAND_ID_HANDLER(HAL_LVM_QUEUE_VIEW, OnQueueView)
[507]79
[384]80                REFLECTED_NOTIFY_CODE_HANDLER(SLVN_SORTCHANGED, OnSortChanged)
[519]81
82        CHAIN_MSG_MAP_ALT(ownDrawClass, 1)
[384]83                CHAIN_MSG_MAP(listClass)
84                DEFAULT_REFLECTION_HANDLER()
85        END_MSG_MAP()
86
87        void OnShowWindow(UINT, INT);
88        void OnDestroy();
89        void SaveSettings();
90        void uiUpdate(const hal::torrent_details_manager& allTorrents); 
[519]91
[384]92        DWORD OnPrePaint(int idCtrl, LPNMCUSTOMDRAW lpNMCD);
[519]93        DWORD OnItemPrePaint(int idCtrl, LPNMCUSTOMDRAW lpNMCD);
[384]94
[519]95        LRESULT OnPause(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
96        LRESULT OnStop(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
97        LRESULT OnResume(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
98        LRESULT OnRecheck(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
[384]99        LRESULT OnRemoveFocused(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
100        LRESULT OnRemove(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
101        LRESULT OnRemoveWipeFiles(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
102        LRESULT OnDownloadFolder(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
103        LRESULT OnEditFolders(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
104
105        LRESULT OnSetManaged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
106        LRESULT OnSetUnmanaged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
107        LRESULT OnAdjustQueuePosition(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
108        LRESULT OnQueueView(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
[495]109        LRESULT OnSortChanged(int, LPNMHDR pnmh, BOOL&);
[384]110
111    friend class boost::serialization::access;
112    template<class Archive>
113    void serialize(Archive& ar, const unsigned int version)
114    {
115                using boost::serialization::make_nvp;
116
117                if (version > 2)
118                        ar & boost::serialization::make_nvp("listview", 
119                                boost::serialization::base_object<listClass>(*this));
120               
121                ar & make_nvp("queue_view", queue_view_);
122    }
123
124private:
125        void queue_view_mode();
126        bool queue_view_;
127       
128        enum { NumberOfColumns_s = 23 };
129        std::vector<const hal::torrent_details_ptr> data_elements_;
130       
131        HaliteWindow& halite_window_;
132};
133
134BOOST_CLASS_VERSION(HaliteListViewCtrl, 3)
135typedef HaliteListViewCtrl::SelectionManager ListViewManager;
136
[403]137#endif // RC_INVOKED
Note: See TracBrowser for help on using the repository browser.