Welcome to mirror list, hosted at ThFree Co, Russian Federation.

BrowseDialog.h « FileManager « UI « 7zip « CPP - github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 41eb6b500dd11baaec567ae6fc94136e40da5ebe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// BrowseDialog.h

#ifndef __BROWSE_DIALOG_H
#define __BROWSE_DIALOG_H

#ifdef UNDER_CE

#include "Windows/FileFind.h"

#include "Windows/Control/Dialog.h"
#include "Windows/Control/ListView.h"

#include "BrowseDialogRes.h"
#include "SysIconUtils.h"

class CBrowseDialog: public NWindows::NControl::CModalDialog
{
  NWindows::NControl::CListView _list;
  CObjectVector<NWindows::NFile::NFind::CFileInfoW> _files;
  CExtToIconMap _extToIconMap;
  int _sortIndex;
  bool _ascending;
  bool _showDots;

  virtual bool OnInit();
  virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
  virtual bool OnNotify(UINT controlID, LPNMHDR header);
  virtual void OnOK();

  virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
  virtual bool OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result);

  void FinishOnOK();
  HRESULT Reload(const UString &pathPrefix, const UString &selectedName);
  HRESULT Reload();
  void OpenParentFolder();

  void OnItemEnter();

  int GetRealItemIndex(int indexInListView) const
  {
    LPARAM param;
    if (!_list.GetItemParam(indexInListView, param))
      return (int)-1;
    return (int)param;
  }

  void ShowError(LPCWSTR s);
  void ShowSelectError();
public:
  UString Title;
  UString Path;
  bool FolderMode;

  CBrowseDialog(): FolderMode(true), _showDots(false) {}

  INT_PTR Create(HWND parent = 0) { return CModalDialog::Create(IDD_DIALOG_BROWSE, parent); }
  int CompareItems(LPARAM lParam1, LPARAM lParam2);
};

bool MyBrowseForFolder(HWND owner, LPCWSTR title, LPCWSTR initialFolder, UString &resultPath);
bool MyBrowseForFile(HWND owner, LPCWSTR title, LPCWSTR initialFolder, LPCWSTR s, UString &resultPath);

#else

#include "Windows/CommonDialog.h"
#include "Windows/Shell.h"

#define MyBrowseForFolder(h, title, initialFolder, resultPath) \
  NShell::BrowseForFolder(h, title, initialFolder, resultPath)

#define MyBrowseForFile(h, title, initialFolder, s, resultPath) \
  MyGetOpenFileName(h, title, initialFolder, s, resultPath)

#endif

#endif