2f0bf3a98eda8c44d4f29a72ac1563c505c0e986
[ardour.git] / libs / gtkmm2ext / utils.cc
1 /*
2     Copyright (C) 1999 Paul Barton-Davis 
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18     $Id$
19 */
20
21 #include <gtk/gtkpaned.h>
22 #include <gtkmm2ext/utils.h>
23 #include <gtkmm2ext/gtkutils.h>
24 #include <gtkmm/comboboxtext.h>
25
26 #include "i18n.h"
27
28 using namespace std;
29
30 void
31 Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w, const gchar *text,
32                                             gint hpadding, gint vpadding)
33
34 {
35         w.ensure_style ();
36         set_size_request_to_display_given_text(w, text, hpadding, vpadding);
37 }
38
39 void
40 Gtkmm2ext::init ()
41 {
42         // Necessary for gettext
43         (void) bindtextdomain(PACKAGE, LOCALEDIR);
44 }
45
46 void
47 Gtkmm2ext::set_popdown_strings (Gtk::ComboBoxText& cr, vector<string>& strings)
48 {
49         cr.clear ();
50
51         for (vector<string>::iterator i = strings.begin(); i != strings.end(); ++i) {
52                 cr.append_text (*i);
53         }
54 }
55
56 GdkWindow*
57 Gtkmm2ext::get_paned_handle (Gtk::Paned& paned)
58 {
59         return GTK_PANED(paned.gobj())->handle;
60 }