File: dirdlg.h

package info (click to toggle)
wxpython4.0 4.2.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 221,752 kB
  • sloc: cpp: 962,555; python: 230,573; ansic: 170,731; makefile: 51,756; sh: 9,342; perl: 1,564; javascript: 584; php: 326; xml: 200
file content (148 lines) | stat: -rw-r--r-- 5,042 bytes parent folder | download | duplicates (4)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/////////////////////////////////////////////////////////////////////////////
// Name:        wx/dirdlg.h
// Purpose:     wxDirDialog base class
// Author:      Robert Roebling
// Modified by:
// Created:
// Copyright:   (c) Robert Roebling
// Licence:     wxWindows Licence
/////////////////////////////////////////////////////////////////////////////

#ifndef _WX_DIRDLG_H_BASE_
#define _WX_DIRDLG_H_BASE_

#include "wx/defs.h"

#if wxUSE_DIRDLG

#include "wx/dialog.h"

// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------

extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogDefaultFolderStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[];


/*
    The flags below must coexist with the following flags in m_windowStyle
    #define wxCAPTION               0x20000000
    #define wxMAXIMIZE              0x00002000
    #define wxCLOSE_BOX             0x00001000
    #define wxSYSTEM_MENU           0x00000800
    wxBORDER_NONE   =               0x00200000
    #define wxRESIZE_BORDER         0x00000040
    #define wxDIALOG_NO_PARENT      0x00000020
*/

#define wxDD_CHANGE_DIR         0x0100
#define wxDD_DIR_MUST_EXIST     0x0200
#define wxDD_MULTIPLE           0x0400
#define wxDD_SHOW_HIDDEN        0x0001

// deprecated, on by default now, use wxDD_DIR_MUST_EXIST to disable it
#define wxDD_NEW_DIR_BUTTON     0

#define wxDD_DEFAULT_STYLE      (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)

//-------------------------------------------------------------------------
// wxDirDialogBase
//-------------------------------------------------------------------------

class WXDLLIMPEXP_CORE wxDirDialogBase : public wxDialog
{
public:
    wxDirDialogBase() {}
    wxDirDialogBase(wxWindow *parent,
                    const wxString& title = wxASCII_STR(wxDirSelectorPromptStr),
                    const wxString& defaultPath = wxEmptyString,
                    long style = wxDD_DEFAULT_STYLE,
                    const wxPoint& pos = wxDefaultPosition,
                    const wxSize& sz = wxDefaultSize,
                    const wxString& name = wxASCII_STR(wxDirDialogNameStr))
    {
        Create(parent, title, defaultPath, style, pos, sz, name);
    }

    virtual ~wxDirDialogBase() {}


    bool Create(wxWindow *parent,
                const wxString& title = wxASCII_STR(wxDirSelectorPromptStr),
                const wxString& defaultPath = wxEmptyString,
                long style = wxDD_DEFAULT_STYLE,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& sz = wxDefaultSize,
                const wxString& name = wxASCII_STR(wxDirDialogNameStr))
    {
        if (!wxDialog::Create(parent, wxID_ANY, title, pos, sz, style, name))
            return false;
        m_path = defaultPath;
        m_message = title;
        return true;
    }

    virtual void SetMessage(const wxString& message) { m_message = message; }
    virtual void SetPath(const wxString& path) { m_path = path; }

    virtual wxString GetMessage() const { return m_message; }
    virtual wxString GetPath() const
    {
        wxCHECK_MSG( !HasFlag(wxDD_MULTIPLE), wxString(),
                     "When using wxDD_MULTIPLE, must call GetPaths() instead" );
        return m_path;
    }

    virtual void GetPaths(wxArrayString& paths) const
    {
        paths = m_paths;
    }

protected:
    wxString m_message;
    wxString m_path;
    wxArrayString m_paths;
};


// Universal and non-port related switches with need for generic implementation
#if defined(__WXUNIVERSAL__)
    #include "wx/generic/dirdlgg.h"
    #define wxDirDialog wxGenericDirDialog
#elif defined(__WXMSW__) && !wxUSE_OLE
    #include "wx/generic/dirdlgg.h"
    #define wxDirDialog wxGenericDirDialog
#elif defined(__WXMSW__)
    #include "wx/msw/dirdlg.h"  // Native MSW
#elif defined(__WXGTK20__)
    #include "wx/gtk/dirdlg.h"  // Native GTK for gtk2.4
#elif defined(__WXGTK__)
    #include "wx/generic/dirdlgg.h"
    #define wxDirDialog wxGenericDirDialog
#elif defined(__WXMAC__)
    #include "wx/osx/dirdlg.h"      // Native Mac
#elif defined(__WXMOTIF__) || \
      defined(__WXX11__)
    #include "wx/generic/dirdlgg.h"     // Other ports use generic implementation
    #define wxDirDialog wxGenericDirDialog
#elif defined(__WXQT__)
    #include "wx/qt/dirdlg.h"
#endif

// ----------------------------------------------------------------------------
// common ::wxDirSelector() function
// ----------------------------------------------------------------------------

WXDLLIMPEXP_CORE wxString
wxDirSelector(const wxString& message = wxASCII_STR(wxDirSelectorPromptStr),
              const wxString& defaultPath = wxEmptyString,
              long style = wxDD_DEFAULT_STYLE,
              const wxPoint& pos = wxDefaultPosition,
              wxWindow *parent = NULL);

#endif // wxUSE_DIRDLG

#endif
    // _WX_DIRDLG_H_BASE_