]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/filepickercmn.cpp
bitmap button size was too small when uxtheme functions were used to get the margins
[wxWidgets.git] / src / common / filepickercmn.cpp
index 949ee2c8c364358817f9c33a2e92e502b5ba9ca0..3591e7d6544b1cef281709321ce649ce592a6b93 100644 (file)
     #pragma hdrstop
 #endif
 
-#include "wx/filepicker.h"
+#if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL
 
+#include "wx/filepicker.h"
 
+#ifndef WX_PRECOMP
+    #include "wx/textctrl.h"
+#endif
 
 // ============================================================================
 // implementation
 // ============================================================================
 
-#if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL
-
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_FILEPICKER_CHANGED)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_DIRPICKER_CHANGED)
 IMPLEMENT_DYNAMIC_CLASS(wxFileDirPickerEvent, wxCommandEvent)
@@ -51,12 +53,25 @@ bool wxFileDirPickerCtrlBase::CreateBase( wxWindow *parent, wxWindowID id,
                         long style, const wxValidator& validator,
                         const wxString &name )
 {
-    wxASSERT_MSG(path.IsEmpty() || CheckPath(path), wxT("Invalid initial path !"));
+    wxASSERT_MSG(path.empty() || CheckPath(path), wxT("Invalid initial path !"));
 
     if (!wxPickerBase::CreateBase(parent, id, path, pos, size,
                                    style, validator, name))
         return false;
 
+    if (!HasFlag(wxFLP_OPEN) && !HasFlag(wxFLP_SAVE))
+        m_windowStyle |= wxFLP_OPEN;     // wxFD_OPEN is the default
+
+    // check that the styles are not contradictory
+    wxASSERT_MSG( !(HasFlag(wxFLP_SAVE) && HasFlag(wxFLP_OPEN)),
+                  _T("can't specify both wxFLP_SAVE and wxFLP_OPEN at once") );
+
+    wxASSERT_MSG( !HasFlag(wxFLP_SAVE) || !HasFlag(wxFLP_FILE_MUST_EXIST),
+                   _T("wxFLP_FILE_MUST_EXIST can't be used with wxFLP_SAVE" ) );
+
+    wxASSERT_MSG( !HasFlag(wxFLP_OPEN) || !HasFlag(wxFLP_OVERWRITE_PROMPT),
+                  _T("wxFLP_OVERWRITE_PROMPT can't be used with wxFLP_OPEN") );
+
     // create a wxFilePickerWidget or a wxDirPickerWidget...
     if (!CreatePicker(this, path, message, wildcard))
         return false;