]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwidgets/dialogs/interaction.cpp
* : svn:keywords
[vlc] / modules / gui / wxwidgets / dialogs / interaction.cpp
index 586f9c6949939887e84caf59f1186a115431781d..7c8f890c0ab1ad4f2c047d5d575f0a96032470bb 100644 (file)
@@ -2,9 +2,9 @@
  * interaction.cpp: wxWidgets handling of interaction dialogs
  *****************************************************************************
  * Copyright (C) 2000-2004 the VideoLAN team
- * $Id: bookmarks.cpp 13106 2005-11-02 19:20:34Z zorglub $
+ * $Id$
  *
- * Authors: Clément Stenac <zorglub@videolan.org>
+ * Authors: Clément Stenac <zorglub@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -46,6 +46,7 @@ BEGIN_EVENT_TABLE( InteractionDialog, wxDialog)
     EVT_BUTTON( wxID_OK, InteractionDialog::OnOkYes )
     EVT_BUTTON( wxID_YES, InteractionDialog::OnOkYes )
     EVT_BUTTON( wxID_CANCEL, InteractionDialog::OnCancel)
+    EVT_BUTTON( wxID_CLOSE, InteractionDialog::OnCancel)
     EVT_BUTTON( wxID_NO, InteractionDialog::OnNo )
     EVT_BUTTON( wxID_CLEAR, InteractionDialog::OnClear )
     EVT_CHECKBOX( NoShow_Event, InteractionDialog::OnNoShow )
@@ -69,7 +70,7 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
     widgets_panel->SetSizer( widgets_sizer );
 
     buttons_panel = new wxPanel( this, -1 );
-    buttons_sizer = new wxBoxSizer( wxHORIZONTAL );
+    buttons_sizer = new wxStdDialogButtonSizer;
     buttons_panel->SetSizer( buttons_sizer );
 
     main_sizer = new wxBoxSizer( wxVERTICAL );
@@ -112,7 +113,7 @@ void InteractionDialog::Render()
     {
         wxTextCtrl *errors ; // Special case
         label = new wxStaticText( widgets_panel, -1,
-          wxU( _("The following errors happened. More details might be "
+          wxU( _("The following errors occurred. More details might be "
                  "available in the Messages window.") ) );
         errors = new wxTextCtrl( widgets_panel, -1, wxT(""),
                          wxDefaultPosition, wxDefaultSize,
@@ -167,43 +168,39 @@ void InteractionDialog::Render()
     //-------------- Buttons ------------------
     if( p_dialog->i_flags & DIALOG_OK_CANCEL )
     {
-        wxButton *ok = new wxButton( buttons_panel,
-                                     wxID_OK, wxU( _("OK") ) );
-        wxButton *cancel = new wxButton( buttons_panel,
-                                         wxID_CANCEL, wxU( _("Cancel") ) );
-        buttons_sizer->Add( ok, 0, wxEXPAND | wxRIGHT| wxLEFT | wxALIGN_CENTER, 5 );
-        buttons_sizer->Add( cancel, 0, wxEXPAND | wxRIGHT| wxLEFT | wxALIGN_CENTER, 5 );
+        wxButton *ok = new wxButton( buttons_panel, wxID_OK );
+        wxButton *cancel = new wxButton( buttons_panel, wxID_CANCEL );
+        buttons_sizer->AddButton( ok );
+        buttons_sizer->AddButton( cancel );
     }
     else if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL )
     {
-        wxButton *yes = new wxButton( buttons_panel,
-                                      wxID_YES, wxU( _("Yes") ) );
-        wxButton *no = new wxButton( buttons_panel,
-                                     wxID_NO, wxU( _("No") ) );
-        wxButton *cancel = new wxButton( buttons_panel,
-                                         wxID_CANCEL, wxU( _("Cancel") ) );
-        buttons_sizer->Add( yes, 0, wxEXPAND | wxRIGHT| wxLEFT |
-                                    wxALIGN_CENTER, 5 );
-        buttons_sizer->Add( no, 0, wxEXPAND | wxRIGHT| wxLEFT |
-                                   wxALIGN_CENTER, 5 );
-        buttons_sizer->Add( cancel, 0, wxEXPAND | wxRIGHT| wxLEFT |
-                                       wxALIGN_CENTER, 5 );
+        wxButton *yes = new wxButton( buttons_panel, wxID_YES );
+        wxButton *no = new wxButton( buttons_panel, wxID_NO );
+        wxButton *cancel = new wxButton( buttons_panel, wxID_CANCEL );
+        buttons_sizer->AddButton( yes );
+        buttons_sizer->AddButton( no );
+        buttons_sizer->AddButton( cancel );
     }
     else if( p_dialog->i_flags & DIALOG_CLEAR_NOSHOW )
     {
         wxCheckBox *noshow = new wxCheckBox( buttons_panel,
-                                         NoShow_Event, wxU( _("Don't show") ) );
+                      NoShow_Event, wxU( _("Don't show further errors") ) );
         noshow->SetValue( b_noshow );
-        wxButton *clear = new wxButton( buttons_panel,
-                                        wxID_CLEAR, wxU( _("Clear") ) );
-        buttons_sizer->Add( noshow, 0, wxEXPAND | wxRIGHT| wxLEFT | wxALIGN_LEFT, 5 );
+        wxButton *clear = new wxButton( buttons_panel, wxID_CLEAR );
+        wxButton *close = new wxButton( buttons_panel, wxID_CLOSE );
+        close->SetDefault();
+        buttons_sizer->Add( noshow, 0, wxEXPAND | wxRIGHT|
+                                       wxLEFT | wxALIGN_LEFT, 5 );
         buttons_sizer->Add( 0, 0, 1 );
-        buttons_sizer->Add( clear , 0, wxEXPAND | wxRIGHT| wxLEFT | wxALIGN_RIGHT, 5 );
-
+        buttons_sizer->AddButton( clear );
+        buttons_sizer->SetNegativeButton( clear );
+        buttons_sizer->AddButton( close );
+        buttons_sizer->SetAffirmativeButton( close );
     }
     widgets_sizer->Layout();
     widgets_panel->SetSizerAndFit( widgets_sizer );
-    buttons_sizer->Layout();
+    buttons_sizer->Realize();
     buttons_panel->SetSizerAndFit( buttons_sizer );
     main_sizer->Layout();
     SetSizerAndFit( main_sizer );