]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwidgets/dialogs/interaction.cpp
wx/dialogs/*: Don't put labels in buttons if we have a wxID_FOO. So the buttons are...
[vlc] / modules / gui / wxwidgets / dialogs / interaction.cpp
index 45aad02cc669597369417e0a7eb95cea33c9058f..7b340f0ebf6b99eaf43a7495f5650e5de2100b3d 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2000-2004 the VideoLAN team
  * $Id: bookmarks.cpp 13106 2005-11-02 19:20:34Z zorglub $
  *
- * 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.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -41,12 +41,13 @@ enum
      NoShow_Event
 };
 
-BEGIN_EVENT_TABLE( InteractionDialog, wxFrame )
+BEGIN_EVENT_TABLE( InteractionDialog, wxDialog)
     EVT_CLOSE( InteractionDialog::OnClose )
     EVT_BUTTON( wxID_OK, InteractionDialog::OnOkYes )
     EVT_BUTTON( wxID_YES, InteractionDialog::OnOkYes )
     EVT_BUTTON( wxID_CANCEL, InteractionDialog::OnCancel)
-    EVT_BUTTON( No_Event, InteractionDialog::OnNo )
+    EVT_BUTTON( wxID_CLOSE, InteractionDialog::OnCancel)
+    EVT_BUTTON( wxID_NO, InteractionDialog::OnNo )
     EVT_BUTTON( wxID_CLEAR, InteractionDialog::OnClear )
     EVT_CHECKBOX( NoShow_Event, InteractionDialog::OnNoShow )
 END_EVENT_TABLE()
@@ -57,7 +58,7 @@ END_EVENT_TABLE()
 InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
                                       wxWindow *p_parent,
                                       interaction_dialog_t *_p_dialog )
-  : wxFrame( p_parent, -1, wxU( _p_dialog->psz_title ) )
+  : wxDialog( p_parent, -1, wxU( _p_dialog->psz_title ) )
 {
     /* Initializations */
     p_intf = _p_intf;
@@ -151,6 +152,7 @@ void InteractionDialog::Render()
                 widget.val = &p_widget->val;
                 widget.i_type = WIDGET_INPUT_TEXT;
                 input_widgets.push_back( widget );
+                break;
             case WIDGET_PROGRESS:
                 label = new wxStaticText(widgets_panel, -1,
                                     wxU( p_widget->psz_text ) );
@@ -166,36 +168,37 @@ 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") ) );
+        wxButton *ok = new wxButton( buttons_panel, wxID_OK );
+        wxButton *cancel = new wxButton( buttons_panel, wxID_CANCEL );
         buttons_sizer->Add( ok, 0, wxEXPAND | wxRIGHT| wxLEFT | wxALIGN_CENTER, 5 );
         buttons_sizer->Add( cancel, 0, wxEXPAND | wxRIGHT| wxLEFT | wxALIGN_CENTER, 5 );
     }
     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->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 );
     }
     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 );
+        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->Add( clear , 0, wxEXPAND | wxRIGHT|
+                                       wxLEFT | wxALIGN_RIGHT, 5 );
+        buttons_sizer->Add( close , 0, wxEXPAND | wxRIGHT|
+                                       wxLEFT | wxALIGN_RIGHT, 5 );
     }
     widgets_sizer->Layout();
     widgets_panel->SetSizerAndFit( widgets_sizer );
@@ -242,7 +245,8 @@ void InteractionDialog::OnClear( wxCommandEvent& event )
     }
     widgets_panel->DestroyChildren();
     /* FIXME: Needed for the spacer */
-    buttons_sizer->Remove( 1 );buttons_sizer->Remove( 2 );buttons_sizer->Remove( 3 );
+    buttons_sizer->Remove( 1 );buttons_sizer->Remove( 2 );
+    buttons_sizer->Remove( 3 );
     buttons_panel->DestroyChildren();
     input_widgets.clear();
     vlc_mutex_unlock( &p_dialog->p_interaction->object_lock );
@@ -261,7 +265,7 @@ void InteractionDialog::Finish( int i_ret )
     while ( it < input_widgets.end() )
     {
         if( (*it).i_type == WIDGET_INPUT_TEXT )
-            (*it).val->psz_string = strdup( (*it).control->GetValue().mb_str() );
+            (*it).val->psz_string = strdup( (*it).control->GetValue().mb_str());
         it++;
     }
     Hide();