]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/textdlgg.cpp
don't crash when destroying a not initialized socket (patch 1489095)
[wxWidgets.git] / src / generic / textdlgg.cpp
index 9b6ea31e908225d0919d9d052d2b756766672e5d..aae60f323148cf7c84812971512377f7a62d0caa 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        textdlgg.cpp
+// Name:        src/generic/textdlgg.cpp
 // Purpose:     wxTextEntryDialog
 // Author:      Julian Smart
 // Modified by:
@@ -26,6 +26,8 @@
 
 #if wxUSE_TEXTDLG
 
+#include "wx/generic/textdlgg.h"
+
 #ifndef WX_PRECOMP
     #include "wx/utils.h"
     #include "wx/dialog.h"
@@ -40,7 +42,8 @@
     #include "wx/statline.h"
 #endif
 
-#include "wx/generic/textdlgg.h"
+const wxChar wxGetTextFromUserPromptStr[] = wxT("Input Text");
+const wxChar wxGetPasswordFromUserPromptStr[] = wxT("Enter Password");
 
 // ----------------------------------------------------------------------------
 // constants
@@ -83,7 +86,7 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent,
                                      long style,
                                      const wxPoint& pos)
                  : wxDialog(parent, wxID_ANY, caption, pos, wxDefaultSize,
-                            wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL),
+                            wxDEFAULT_DIALOG_STYLE),
                    m_value(value)
 {
     m_dialogStyle = style;
@@ -96,7 +99,7 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent,
 #if wxUSE_STATTEXT
     // 1) text message
     topsizer->Add( CreateTextSizer( message ), 0, wxALL, wxLARGESMALL(10,0) );
-#endif        
+#endif
 
     // 2) text ctrl
     m_textctrl = new wxTextCtrl(this, wxID_TEXT, value,
@@ -107,36 +110,28 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent,
 #if wxUSE_VALIDATORS
     wxTextValidator validator( wxFILTER_NONE, &m_value );
     m_textctrl->SetValidator( validator );
-#endif
-  // wxUSE_VALIDATORS
-
-    // smart phones does not support or do not waste space for wxButtons
-#ifdef __SMARTPHONE__
-
-    SetRightMenu(wxID_CANCEL, _("Cancel"));
-
-#else // __SMARTPHONE__/!__SMARTPHONE__
+#endif // wxUSE_VALIDATORS
 
-#if wxUSE_STATLINE
-    // 3) static line
-    topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
-#endif
-
-    // 4) buttons
-    topsizer->Add( CreateButtonSizer( style ), 0, wxEXPAND | wxALL, 10 );
-
-#endif // !__SMARTPHONE__
+    // 3) buttons if any
+    wxSizer *buttonSizer = CreateButtonSizer( style & ButtonSizerFlags , true, wxLARGESMALL(10,0) );
+    if(buttonSizer->GetChildren().GetCount() > 0 )
+    {
+        topsizer->Add( buttonSizer, 0, wxEXPAND | wxALL, wxLARGESMALL(10,0) );
+    }
+    else
+    {
+        topsizer->AddSpacer( wxLARGESMALL(15,0) );
+        delete buttonSizer;
+    }
 
     SetAutoLayout( true );
     SetSizer( topsizer );
 
-#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
     topsizer->SetSizeHints( this );
     topsizer->Fit( this );
 
     if ( style & wxCENTRE )
         Centre( wxBOTH );
-#endif
 
     m_textctrl->SetSelection(-1, -1);
     m_textctrl->SetFocus();