Imported Upstream version 9.20
[platform/upstream/7zip.git] / CPP / 7zip / UI / FileManager / Panel.h
1 // Panel.h\r
2 \r
3 #ifndef __PANEL_H\r
4 #define __PANEL_H\r
5 \r
6 #include "../../../../C/Alloc.h"\r
7 \r
8 #include "Common/MyCom.h"\r
9 \r
10 #include "Windows/DLL.h"\r
11 #include "Windows/FileDir.h"\r
12 #include "Windows/FileFind.h"\r
13 #include "Windows/Handle.h"\r
14 #include "Windows/Synchronization.h"\r
15 \r
16 #include "Windows/Control/ComboBox.h"\r
17 #include "Windows/Control/Edit.h"\r
18 #include "Windows/Control/ListView.h"\r
19 #include "Windows/Control/ReBar.h"\r
20 #include "Windows/Control/Static.h"\r
21 #include "Windows/Control/StatusBar.h"\r
22 #include "Windows/Control/ToolBar.h"\r
23 #include "Windows/Control/Window2.h"\r
24 \r
25 #include "AppState.h"\r
26 #include "IFolder.h"\r
27 #include "MyCom2.h"\r
28 #include "ProgressDialog2.h"\r
29 #include "SysIconUtils.h"\r
30 \r
31 const int kParentFolderID = 100;\r
32 const int kPluginMenuStartID = 1000;\r
33 const int kToolbarStartID = 2000;\r
34 \r
35 const int kParentIndex = -1;\r
36 \r
37 #ifdef UNDER_CE\r
38 #define ROOT_FS_FOLDER L"\\"\r
39 #else\r
40 #define ROOT_FS_FOLDER L"C:\\\\"\r
41 #endif\r
42 \r
43 struct CPanelCallback\r
44 {\r
45   virtual void OnTab() = 0;\r
46   virtual void SetFocusToPath(int index) = 0;\r
47   virtual void OnCopy(bool move, bool copyToSame) = 0;\r
48   virtual void OnSetSameFolder() = 0;\r
49   virtual void OnSetSubFolder() = 0;\r
50   virtual void PanelWasFocused() = 0;\r
51   virtual void DragBegin() = 0;\r
52   virtual void DragEnd() = 0;\r
53   virtual void RefreshTitle(bool always) = 0;\r
54 };\r
55 \r
56 void PanelCopyItems();\r
57 \r
58 struct CItemProperty\r
59 {\r
60   UString Name;\r
61   PROPID ID;\r
62   VARTYPE Type;\r
63   int Order;\r
64   bool IsVisible;\r
65   UInt32 Width;\r
66 };\r
67 \r
68 inline bool operator<(const CItemProperty &a1, const CItemProperty &a2)\r
69   { return (a1.Order < a2.Order); }\r
70 \r
71 inline bool operator==(const CItemProperty &a1, const CItemProperty &a2)\r
72   { return (a1.Order == a2.Order); }\r
73 \r
74 class CItemProperties: public CObjectVector<CItemProperty>\r
75 {\r
76 public:\r
77   int FindItemWithID(PROPID id)\r
78   {\r
79     for (int i = 0; i < Size(); i++)\r
80       if ((*this)[i].ID == id)\r
81         return i;\r
82     return -1;\r
83   }\r
84 };\r
85 \r
86 struct CTempFileInfo\r
87 {\r
88   UString ItemName;\r
89   UString FolderPath;\r
90   UString FilePath;\r
91   NWindows::NFile::NFind::CFileInfoW FileInfo;\r
92   bool NeedDelete;\r
93 \r
94   CTempFileInfo(): NeedDelete(false) {}\r
95   void DeleteDirAndFile() const\r
96   {\r
97     if (NeedDelete)\r
98     {\r
99       NWindows::NFile::NDirectory::DeleteFileAlways(FilePath);\r
100       NWindows::NFile::NDirectory::MyRemoveDirectory(FolderPath);\r
101     }\r
102   }\r
103   bool WasChanged(const NWindows::NFile::NFind::CFileInfoW &newFileInfo) const\r
104   {\r
105     return newFileInfo.Size != FileInfo.Size ||\r
106         CompareFileTime(&newFileInfo.MTime, &FileInfo.MTime) != 0;\r
107   }\r
108 };\r
109 \r
110 struct CFolderLink: public CTempFileInfo\r
111 {\r
112   NWindows::NDLL::CLibrary Library;\r
113   CMyComPtr<IFolderFolder> ParentFolder;\r
114   bool UsePassword;\r
115   UString Password;\r
116   bool IsVirtual;\r
117 \r
118   UString VirtualPath;\r
119   CFolderLink(): UsePassword(false), IsVirtual(false) {}\r
120 \r
121   bool WasChanged(const NWindows::NFile::NFind::CFileInfoW &newFileInfo) const\r
122   {\r
123     return IsVirtual || CTempFileInfo::WasChanged(newFileInfo);\r
124   }\r
125 \r
126 };\r
127 \r
128 enum MyMessages\r
129 {\r
130   kShiftSelectMessage = WM_USER + 1,\r
131   kReLoadMessage,\r
132   kSetFocusToListView,\r
133   kOpenItemChanged,\r
134   kRefreshStatusBar,\r
135   kRefreshHeaderComboBox\r
136 };\r
137 \r
138 UString GetFolderPath(IFolderFolder * folder);\r
139 \r
140 class CPanel;\r
141 \r
142 class CMyListView: public NWindows::NControl::CListView\r
143 {\r
144 public:\r
145   WNDPROC _origWindowProc;\r
146   CPanel *_panel;\r
147   LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);\r
148 };\r
149 \r
150 /*\r
151 class CMyComboBox: public NWindows::NControl::CComboBoxEx\r
152 {\r
153 public:\r
154   WNDPROC _origWindowProc;\r
155   CPanel *_panel;\r
156   LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);\r
157 };\r
158 */\r
159 class CMyComboBoxEdit: public NWindows::NControl::CEdit\r
160 {\r
161 public:\r
162   WNDPROC _origWindowProc;\r
163   CPanel *_panel;\r
164   LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);\r
165 };\r
166 \r
167 struct CSelectedState\r
168 {\r
169   int FocusedItem;\r
170   UString FocusedName;\r
171   bool SelectFocused;\r
172   UStringVector SelectedNames;\r
173   CSelectedState(): FocusedItem(-1), SelectFocused(false) {}\r
174 };\r
175 \r
176 #ifdef UNDER_CE\r
177 #define MY_NMLISTVIEW_NMITEMACTIVATE NMLISTVIEW\r
178 #else\r
179 #define MY_NMLISTVIEW_NMITEMACTIVATE NMITEMACTIVATE\r
180 #endif\r
181 \r
182 class CPanel: public NWindows::NControl::CWindow2\r
183 {\r
184   CExtToIconMap _extToIconMap;\r
185   UINT _baseID;\r
186   int _comboBoxID;\r
187   UINT _statusBarID;\r
188 \r
189   CAppState *_appState;\r
190 \r
191   bool OnCommand(int code, int itemID, LPARAM lParam, LRESULT &result);\r
192   LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);\r
193   virtual bool OnCreate(CREATESTRUCT *createStruct);\r
194   virtual bool OnSize(WPARAM wParam, int xSize, int ySize);\r
195   virtual void OnDestroy();\r
196   virtual bool OnNotify(UINT controlID, LPNMHDR lParam, LRESULT &result);\r
197 \r
198   void AddComboBoxItem(const UString &name, int iconIndex, int indent, bool addToList);\r
199 \r
200   bool OnComboBoxCommand(UINT code, LPARAM param, LRESULT &result);\r
201   \r
202   #ifndef UNDER_CE\r
203   \r
204   LRESULT OnNotifyComboBoxEnter(const UString &s);\r
205   bool OnNotifyComboBoxEndEdit(PNMCBEENDEDITW info, LRESULT &result);\r
206   #ifndef _UNICODE\r
207   bool OnNotifyComboBoxEndEdit(PNMCBEENDEDIT info, LRESULT &result);\r
208   #endif\r
209 \r
210   #endif\r
211 \r
212   bool OnNotifyReBar(LPNMHDR lParam, LRESULT &result);\r
213   bool OnNotifyComboBox(LPNMHDR lParam, LRESULT &result);\r
214   void OnItemChanged(NMLISTVIEW *item);\r
215   void OnNotifyActivateItems();\r
216   bool OnNotifyList(LPNMHDR lParam, LRESULT &result);\r
217   void OnDrag(LPNMLISTVIEW nmListView);\r
218   bool OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result);\r
219   BOOL OnBeginLabelEdit(LV_DISPINFOW * lpnmh);\r
220   BOOL OnEndLabelEdit(LV_DISPINFOW * lpnmh);\r
221   void OnColumnClick(LPNMLISTVIEW info);\r
222   bool OnCustomDraw(LPNMLVCUSTOMDRAW lplvcd, LRESULT &result);\r
223 \r
224 public:\r
225   HWND _mainWindow;\r
226   CPanelCallback *_panelCallback;\r
227 \r
228   void SysIconsWereChanged() { _extToIconMap.Clear(); }\r
229 \r
230   void DeleteItems(bool toRecycleBin);\r
231   void DeleteItemsInternal(CRecordVector<UInt32> &indices);\r
232   void CreateFolder();\r
233   void CreateFile();\r
234 \r
235 private:\r
236 \r
237   void ChangeWindowSize(int xSize, int ySize);\r
238  \r
239   HRESULT InitColumns();\r
240   // void InitColumns2(PROPID sortID);\r
241   void InsertColumn(int index);\r
242 \r
243   void SetFocusedSelectedItem(int index, bool select);\r
244   HRESULT RefreshListCtrl(const UString &focusedName, int focusedPos, bool selectFocused,\r
245       const UStringVector &selectedNames);\r
246 \r
247   void OnShiftSelectMessage();\r
248   void OnArrowWithShift();\r
249 \r
250   void OnInsert();\r
251   // void OnUpWithShift();\r
252   // void OnDownWithShift();\r
253 public:\r
254   void UpdateSelection();\r
255   void SelectSpec(bool selectMode);\r
256   void SelectByType(bool selectMode);\r
257   void SelectAll(bool selectMode);\r
258   void InvertSelection();\r
259 private:\r
260 \r
261   // UString GetFileType(UInt32 index);\r
262   LRESULT SetItemText(LVITEMW &item);\r
263 \r
264   // CRecordVector<PROPID> m_ColumnsPropIDs;\r
265 \r
266 public:\r
267   NWindows::NControl::CReBar _headerReBar;\r
268   NWindows::NControl::CToolBar _headerToolBar;\r
269   NWindows::NControl::\r
270     #ifdef UNDER_CE\r
271     CComboBox\r
272     #else\r
273     CComboBoxEx\r
274     #endif\r
275     _headerComboBox;\r
276   UStringVector ComboBoxPaths;\r
277   // CMyComboBox _headerComboBox;\r
278   CMyComboBoxEdit _comboBoxEdit;\r
279   CMyListView _listView;\r
280   NWindows::NControl::CStatusBar _statusBar;\r
281   bool _lastFocusedIsList;\r
282   // NWindows::NControl::CStatusBar _statusBar2;\r
283 \r
284   DWORD _exStyle;\r
285   bool _showDots;\r
286   bool _showRealFileIcons;\r
287   // bool _virtualMode;\r
288   // CUIntVector _realIndices;\r
289   bool _enableItemChangeNotify;\r
290   bool _mySelectMode;\r
291   CBoolVector _selectedStatusVector;\r
292 \r
293   CSelectedState _selectedState;\r
294 \r
295   HWND GetParent();\r
296 \r
297   UInt32 GetRealIndex(const LVITEMW &item) const\r
298   {\r
299     /*\r
300     if (_virtualMode)\r
301       return _realIndices[item.iItem];\r
302     */\r
303     return (UInt32)item.lParam;\r
304   }\r
305   int GetRealItemIndex(int indexInListView) const\r
306   {\r
307     /*\r
308     if (_virtualMode)\r
309       return indexInListView;\r
310     */\r
311     LPARAM param;\r
312     if (!_listView.GetItemParam(indexInListView, param))\r
313       throw 1;\r
314     return (int)param;\r
315   }\r
316 \r
317   UInt32 _ListViewMode;\r
318   int _xSize;\r
319 \r
320   bool _flatMode;\r
321   bool _flatModeForDisk;\r
322   bool _flatModeForArc;\r
323 \r
324   bool _dontShowMode;\r
325 \r
326 \r
327   UString _currentFolderPrefix;\r
328   \r
329   CObjectVector<CFolderLink> _parentFolders;\r
330   NWindows::NDLL::CLibrary _library;\r
331   CMyComPtr<IFolderFolder> _folder;\r
332   // CMyComPtr<IFolderGetSystemIconIndex> _folderGetSystemIconIndex;\r
333 \r
334   UStringVector _fastFolders;\r
335 \r
336   void GetSelectedNames(UStringVector &selectedNames);\r
337   void SaveSelectedState(CSelectedState &s);\r
338   HRESULT RefreshListCtrl(const CSelectedState &s);\r
339   HRESULT RefreshListCtrlSaveFocused();\r
340 \r
341   UString GetItemName(int itemIndex) const;\r
342   UString GetItemPrefix(int itemIndex) const;\r
343   UString GetItemRelPath(int itemIndex) const;\r
344   UString GetItemFullPath(int itemIndex) const;\r
345   bool IsItemFolder(int itemIndex) const;\r
346   UInt64 GetItemSize(int itemIndex) const;\r
347 \r
348   ////////////////////////\r
349   // PanelFolderChange.cpp\r
350 \r
351   void SetToRootFolder();\r
352   HRESULT BindToPath(const UString &fullPath, const UString &arcFormat, bool &archiveIsOpened, bool &encrypted); // can be prefix\r
353   HRESULT BindToPathAndRefresh(const UString &path);\r
354   void OpenDrivesFolder();\r
355   \r
356   void SetBookmark(int index);\r
357   void OpenBookmark(int index);\r
358   \r
359   void LoadFullPath();\r
360   void LoadFullPathAndShow();\r
361   void FoldersHistory();\r
362   void OpenParentFolder();\r
363   void CloseOpenFolders();\r
364   void OpenRootFolder();\r
365 \r
366 \r
367   HRESULT Create(HWND mainWindow, HWND parentWindow,\r
368       UINT id,\r
369       const UString &currentFolderPrefix,\r
370       const UString &arcFormat,\r
371       CPanelCallback *panelCallback,\r
372       CAppState *appState, bool &archiveIsOpened, bool &encrypted);\r
373   void SetFocusToList();\r
374   void SetFocusToLastRememberedItem();\r
375 \r
376 \r
377   void ReadListViewInfo();\r
378   void SaveListViewInfo();\r
379 \r
380   CPanel() :\r
381       // _virtualMode(flase),\r
382       _exStyle(0),\r
383       _showDots(false),\r
384       _showRealFileIcons(false),\r
385       _needSaveInfo(false),\r
386       _startGroupSelect(0),\r
387       _selectionIsDefined(false),\r
388       _ListViewMode(3),\r
389       _flatMode(false),\r
390       _flatModeForDisk(false),\r
391       _flatModeForArc(false),\r
392       _xSize(300),\r
393       _mySelectMode(false),\r
394       _enableItemChangeNotify(true),\r
395       _dontShowMode(false)\r
396   {}\r
397 \r
398   void SetExtendedStyle()\r
399   {\r
400     if (_listView != 0)\r
401       _listView.SetExtendedListViewStyle(_exStyle);\r
402   }\r
403 \r
404 \r
405   bool _needSaveInfo;\r
406   UString _typeIDString;\r
407   CListViewInfo _listViewInfo;\r
408   CItemProperties _properties;\r
409   CItemProperties _visibleProperties;\r
410   \r
411   PROPID _sortID;\r
412   // int _sortIndex;\r
413   bool _ascending;\r
414 \r
415   void Release();\r
416   ~CPanel();\r
417   void OnLeftClick(MY_NMLISTVIEW_NMITEMACTIVATE *itemActivate);\r
418   bool OnRightClick(MY_NMLISTVIEW_NMITEMACTIVATE *itemActivate, LRESULT &result);\r
419   void ShowColumnsContextMenu(int x, int y);\r
420 \r
421   void OnTimer();\r
422   void OnReload();\r
423   bool OnContextMenu(HANDLE windowHandle, int xPos, int yPos);\r
424 \r
425   CMyComPtr<IContextMenu> _sevenZipContextMenu;\r
426   CMyComPtr<IContextMenu> _systemContextMenu;\r
427   HRESULT CreateShellContextMenu(\r
428       const CRecordVector<UInt32> &operatedIndices,\r
429       CMyComPtr<IContextMenu> &systemContextMenu);\r
430   void CreateSystemMenu(HMENU menu,\r
431       const CRecordVector<UInt32> &operatedIndices,\r
432       CMyComPtr<IContextMenu> &systemContextMenu);\r
433   void CreateSevenZipMenu(HMENU menu,\r
434       const CRecordVector<UInt32> &operatedIndices,\r
435       CMyComPtr<IContextMenu> &sevenZipContextMenu);\r
436   void CreateFileMenu(HMENU menu,\r
437       CMyComPtr<IContextMenu> &sevenZipContextMenu,\r
438       CMyComPtr<IContextMenu> &systemContextMenu,\r
439       bool programMenu);\r
440   void CreateFileMenu(HMENU menu);\r
441   bool InvokePluginCommand(int id);\r
442   bool InvokePluginCommand(int id, IContextMenu *sevenZipContextMenu,\r
443       IContextMenu *systemContextMenu);\r
444 \r
445   void InvokeSystemCommand(const char *command);\r
446   void Properties();\r
447   void EditCut();\r
448   void EditCopy();\r
449   void EditPaste();\r
450 \r
451   int _startGroupSelect;\r
452 \r
453   bool _selectionIsDefined;\r
454   bool _selectMark;\r
455   int _prevFocusedItem;\r
456 \r
457  \r
458   // void SortItems(int index);\r
459   void SortItemsWithPropID(PROPID propID);\r
460 \r
461   void GetSelectedItemsIndices(CRecordVector<UInt32> &indices) const;\r
462   void GetOperatedItemIndices(CRecordVector<UInt32> &indices) const;\r
463   void GetAllItemIndices(CRecordVector<UInt32> &indices) const;\r
464   void GetOperatedIndicesSmart(CRecordVector<UInt32> &indices) const;\r
465   // void GetOperatedListViewIndices(CRecordVector<UInt32> &indices) const;\r
466   void KillSelection();\r
467 \r
468   UString GetFolderTypeID() const;\r
469   bool IsFolderTypeEqTo(const wchar_t *s) const;\r
470   bool IsRootFolder() const;\r
471   bool IsFSFolder() const;\r
472   bool IsFSDrivesFolder() const;\r
473   bool IsArcFolder() const;\r
474   bool IsFsOrDrivesFolder() const { return IsFSFolder() || IsFSDrivesFolder(); }\r
475   bool IsDeviceDrivesPrefix() const { return _currentFolderPrefix == L"\\\\.\\"; }\r
476   bool IsFsOrPureDrivesFolder() const { return IsFSFolder() || (IsFSDrivesFolder() && !IsDeviceDrivesPrefix()); }\r
477 \r
478   UString GetFsPath() const;\r
479   UString GetDriveOrNetworkPrefix() const;\r
480 \r
481   bool DoesItSupportOperations() const;\r
482 \r
483   bool _processTimer;\r
484   bool _processNotify;\r
485 \r
486   class CDisableTimerProcessing\r
487   {\r
488     bool _processTimerMem;\r
489     bool _processNotifyMem;\r
490 \r
491     CPanel &_panel;\r
492     public:\r
493 \r
494     CDisableTimerProcessing(CPanel &panel): _panel(panel)\r
495     {\r
496       Disable();\r
497     }\r
498     void Disable()\r
499     {\r
500       _processTimerMem = _panel._processTimer;\r
501       _processNotifyMem = _panel._processNotify;\r
502       _panel._processTimer = false;\r
503       _panel._processNotify = false;\r
504     }\r
505     void Restore()\r
506     {\r
507       _panel._processTimer = _processTimerMem;\r
508       _panel._processNotify = _processNotifyMem;\r
509     }\r
510     ~CDisableTimerProcessing()\r
511     {\r
512       Restore();\r
513     }\r
514     CDisableTimerProcessing& operator=(const CDisableTimerProcessing &) {; }\r
515   };\r
516 \r
517   // bool _passwordIsDefined;\r
518   // UString _password;\r
519 \r
520   HRESULT RefreshListCtrl();\r
521 \r
522   void MessageBoxInfo(LPCWSTR message, LPCWSTR caption);\r
523   void MessageBox(LPCWSTR message);\r
524   void MessageBox(LPCWSTR message, LPCWSTR caption);\r
525   void MessageBoxMyError(LPCWSTR message);\r
526   void MessageBoxError(HRESULT errorCode, LPCWSTR caption);\r
527   void MessageBoxError(HRESULT errorCode);\r
528   void MessageBoxLastError(LPCWSTR caption);\r
529   void MessageBoxLastError();\r
530 \r
531   void MessageBoxErrorForUpdate(HRESULT errorCode, UINT resourceID, UInt32 langID);\r
532 \r
533   void MessageBoxErrorLang(UINT resourceID, UInt32 langID);\r
534 \r
535   void OpenFocusedItemAsInternal();\r
536   void OpenSelectedItems(bool internal);\r
537 \r
538   void OpenFolderExternal(int index);\r
539 \r
540   void OpenFolder(int index);\r
541   HRESULT OpenParentArchiveFolder();\r
542   HRESULT OpenItemAsArchive(IInStream *inStream,\r
543       const CTempFileInfo &tempFileInfo,\r
544       const UString &virtualFilePath,\r
545       const UString &arcFormat,\r
546       bool &encrypted);\r
547   HRESULT OpenItemAsArchive(const UString &name, const UString &arcFormat, bool &encrypted);\r
548   HRESULT OpenItemAsArchive(int index);\r
549   void OpenItemInArchive(int index, bool tryInternal, bool tryExternal,\r
550       bool editMode);\r
551   HRESULT OnOpenItemChanged(const UString &folderPath, const UString &itemName, bool usePassword, const UString &password);\r
552   LRESULT OnOpenItemChanged(LPARAM lParam);\r
553 \r
554   void OpenItem(int index, bool tryInternal, bool tryExternal);\r
555   void EditItem();\r
556   void EditItem(int index);\r
557 \r
558   void RenameFile();\r
559   void ChangeComment();\r
560 \r
561   void SetListViewMode(UInt32 index);\r
562   UInt32 GetListViewMode() const { return _ListViewMode; }\r
563   PROPID GetSortID() const { return _sortID; }\r
564 \r
565   void ChangeFlatMode();\r
566   bool GetFlatMode() const { return _flatMode; }\r
567 \r
568   void RefreshStatusBar();\r
569   void OnRefreshStatusBar();\r
570 \r
571   void AddToArchive();\r
572 \r
573   void GetFilePaths(const CRecordVector<UInt32> &indices, UStringVector &paths);\r
574   void ExtractArchives();\r
575   void TestArchives();\r
576 \r
577   HRESULT CopyTo(const CRecordVector<UInt32> &indices, const UString &folder,\r
578       bool moveMode, bool showErrorMessages, UStringVector *messages,\r
579       bool &usePassword, UString &password);\r
580 \r
581   HRESULT CopyTo(const CRecordVector<UInt32> &indices, const UString &folder,\r
582       bool moveMode, bool showErrorMessages, UStringVector *messages)\r
583   {\r
584     bool usePassword = false;\r
585     UString password;\r
586     if (_parentFolders.Size() > 0)\r
587     {\r
588       const CFolderLink &fl = _parentFolders.Back();\r
589       usePassword = fl.UsePassword;\r
590       password = fl.Password;\r
591     }\r
592     return CopyTo(indices, folder, moveMode, showErrorMessages, messages, usePassword, password);\r
593   }\r
594 \r
595   HRESULT CopyFrom(const UString &folderPrefix, const UStringVector &filePaths,\r
596       bool showErrorMessages, UStringVector *messages);\r
597 \r
598   void CopyFromNoAsk(const UStringVector &filePaths);\r
599   void CopyFromAsk(const UStringVector &filePaths);\r
600 \r
601   // empty folderPath means create new Archive to path of first fileName.\r
602   void DropObject(IDataObject * dataObject, const UString &folderPath);\r
603 \r
604   // empty folderPath means create new Archive to path of first fileName.\r
605   void CompressDropFiles(const UStringVector &fileNames, const UString &folderPath);\r
606 \r
607   void RefreshTitle(bool always = false) { _panelCallback->RefreshTitle(always);  }\r
608   void RefreshTitleAlways() { RefreshTitle(true);  }\r
609 \r
610   UString GetItemsInfoString(const CRecordVector<UInt32> &indices);\r
611 };\r
612 \r
613 class CMyBuffer\r
614 {\r
615   void *_data;\r
616 public:\r
617   CMyBuffer(): _data(0) {}\r
618   operator void *() { return _data; }\r
619   bool Allocate(size_t size)\r
620   {\r
621     if (_data != 0)\r
622       return false;\r
623     _data = ::MidAlloc(size);\r
624     return _data != 0;\r
625   }\r
626   ~CMyBuffer() { ::MidFree(_data); }\r
627 };\r
628 \r
629 #endif\r