Merge branch 'master' into 1.0
[dcpomatic.git] / src / wx / wx_util.cc
index 632dbc32e034b8ee39b8d507bfff97779a43b005..e0d7d843ff51fb31f06881592e670f3adab6dbce 100644 (file)
@@ -43,6 +43,14 @@ add_label_to_sizer (wxSizer* s, wxWindow* p, wxString t, int prop)
        return m;
 }
 
+wxStaticText *
+add_label_to_grid_bag_sizer (wxGridBagSizer* s, wxWindow* p, wxString t, wxGBPosition pos, wxGBSpan span)
+{
+       wxStaticText* m = new wxStaticText (p, wxID_ANY, t);
+       s->Add (m, pos, span, wxALIGN_CENTER_VERTICAL | wxALL, 6);
+       return m;
+}
+
 /** Pop up an error dialogue box.
  *  @param parent Parent.
  *  @param m Message.
@@ -50,11 +58,21 @@ add_label_to_sizer (wxSizer* s, wxWindow* p, wxString t, int prop)
 void
 error_dialog (wxWindow* parent, wxString m)
 {
-       wxMessageDialog* d = new wxMessageDialog (parent, m, _("DVD-o-matic"), wxOK);
+       wxMessageDialog* d = new wxMessageDialog (parent, m, _("DCP-o-matic"), wxOK);
        d->ShowModal ();
        d->Destroy ();
 }
 
+bool
+confirm_dialog (wxWindow* parent, wxString m)
+{
+       wxMessageDialog* d = new wxMessageDialog (parent, m, _("DVD-o-matic"), wxYES_NO | wxICON_QUESTION);
+       int const r = d->ShowModal ();
+       d->Destroy ();
+       return r == wxID_YES;
+}
+       
+
 /** @param s wxWidgets string.
  *  @return Corresponding STL string.
  */
@@ -170,6 +188,14 @@ checked_set (wxTextCtrl* widget, string value)
        }
 }
 
+void
+checked_set (wxStaticText* widget, string value)
+{
+       if (widget->GetLabel() != std_to_wx (value)) {
+               widget->SetLabel (std_to_wx (value));
+       }
+}
+
 void
 checked_set (wxCheckBox* widget, bool value)
 {