2 Copyright (C) 1999 Paul Barton-Davis
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.
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.
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.
20 #ifndef __gtkmm2ext_utils_h__
21 #define __gtkmm2ext_utils_h__
27 #include <cairomm/refptr.h>
29 #include <gtkmm/container.h>
30 #include <gtkmm/treeview.h>
31 #include <gdkmm/window.h> /* for WMDecoration */
32 #include <gdkmm/pixbuf.h>
33 #include <pangomm/fontdescription.h>
35 #include "gtkmm2ext/visibility.h"
50 LIBGTKMM2EXT_API void init (const char*);
52 LIBGTKMM2EXT_API std::string fit_to_pixels (const std::string&, int pixel_width, Pango::FontDescription& font, int& actual_width, bool with_ellipses = false);
53 LIBGTKMM2EXT_API std::pair<std::string, double> fit_to_pixels (cairo_t *, std::string, double);
54 LIBGTKMM2EXT_API int pixel_width (const std::string& str, Pango::FontDescription& font);
56 LIBGTKMM2EXT_API void get_ink_pixel_size (Glib::RefPtr<Pango::Layout>,
57 int& width, int& height);
59 LIBGTKMM2EXT_API void set_size_request_to_display_given_text (Gtk::Widget &w,
64 LIBGTKMM2EXT_API void set_size_request_to_display_given_text (Gtk::Widget &w,
65 const std::vector<std::string>&,
69 LIBGTKMM2EXT_API Glib::RefPtr<Gdk::Pixbuf> pixbuf_from_string (const std::string& name,
70 const Pango::FontDescription& font,
75 LIBGTKMM2EXT_API void set_popdown_strings (Gtk::ComboBoxText&,
76 const std::vector<std::string>&);
78 template<class T> LIBGTKMM2EXT_API void deferred_delete (void *ptr) {
79 delete static_cast<T *> (ptr);
82 LIBGTKMM2EXT_API GdkWindow* get_paned_handle (Gtk::Paned& paned);
83 LIBGTKMM2EXT_API void set_decoration (Gtk::Window* win, Gdk::WMDecoration decor);
84 LIBGTKMM2EXT_API void set_treeview_header_as_default_label(Gtk::TreeViewColumn *c);
85 LIBGTKMM2EXT_API Glib::RefPtr<Gdk::Drawable> get_bogus_drawable();
86 LIBGTKMM2EXT_API void detach_menu (Gtk::Menu&);
88 LIBGTKMM2EXT_API Glib::RefPtr<Gdk::Window> window_to_draw_on (Gtk::Widget& w, Gtk::Widget** parent);
90 LIBGTKMM2EXT_API bool possibly_translate_keyval_to_make_legal_accelerator (uint32_t& keyval);
91 LIBGTKMM2EXT_API uint32_t possibly_translate_legal_accelerator_to_real_key (uint32_t keyval);
93 LIBGTKMM2EXT_API int physical_screen_height (Glib::RefPtr<Gdk::Window>);
94 LIBGTKMM2EXT_API int physical_screen_width (Glib::RefPtr<Gdk::Window>);
96 LIBGTKMM2EXT_API void container_clear (Gtk::Container&);
98 /* C++ API for rounded rectangles */
100 LIBGTKMM2EXT_API void rounded_rectangle (Cairo::RefPtr<Cairo::Context> context, double x, double y, double w, double h, double r=10);
101 LIBGTKMM2EXT_API void rounded_top_rectangle (Cairo::RefPtr<Cairo::Context> context, double x, double y, double w, double h, double r=10);
102 LIBGTKMM2EXT_API void rounded_top_left_rectangle (Cairo::RefPtr<Cairo::Context> context, double x, double y, double w, double h, double r=10);
103 LIBGTKMM2EXT_API void rounded_top_right_rectangle (Cairo::RefPtr<Cairo::Context> context, double x, double y, double w, double h, double r=10);
104 LIBGTKMM2EXT_API void rounded_top_half_rectangle (Cairo::RefPtr<Cairo::Context>, double x, double y, double w, double h, double r=10);
105 LIBGTKMM2EXT_API void rounded_bottom_half_rectangle (Cairo::RefPtr<Cairo::Context>, double x, double y, double w, double h, double r=10);
106 LIBGTKMM2EXT_API void rounded_right_half_rectangle (Cairo::RefPtr<Cairo::Context>, double x, double y, double w, double h, double r=10);
108 /* C API for rounded rectangles */
110 LIBGTKMM2EXT_API void rounded_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
111 LIBGTKMM2EXT_API void rounded_top_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
112 LIBGTKMM2EXT_API void rounded_top_left_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
113 LIBGTKMM2EXT_API void rounded_top_right_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
114 LIBGTKMM2EXT_API void rounded_top_half_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
115 LIBGTKMM2EXT_API void rounded_bottom_half_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
116 LIBGTKMM2EXT_API void rounded_right_half_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
118 LIBGTKMM2EXT_API Gtk::Label* left_aligned_label (std::string const &);
120 LIBGTKMM2EXT_API void set_no_tooltip_whatsoever (Gtk::Widget &);
121 LIBGTKMM2EXT_API void enable_tooltips ();
122 LIBGTKMM2EXT_API void disable_tooltips ();
125 #endif /* __gtkmm2ext_utils_h__ */