1
/* $Id: screen.hg,v 1.8 2006/06/10 15:26:24 murrayc Exp $ */
5
* Copyright (C) 1998-2002 The gtkmm Development Team
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the Free
19
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
//#include <gdkmm/visual.h>
23
//#include <gdkmm/window.h>
24
#include <gdkmm/rectangle.h>
25
#include <glibmm/object.h>
26
#include <cairomm/fontoptions.h>
28
_PINCLUDE(glibmm/private/object_p.h)
38
/** Object representing a physical screen
39
* Gdk::Screen objects are the GDK representation of a physical screen. It is used throughout GDK and GTK+ to specify
40
* which screen the top level windows are to be displayed on. It is also used to query the screen specification and
41
* default settings such as the screen width (get_width()), etc.
42
* Note that a screen may consist of multiple monitors which are merged to form a large screen area.
44
class Screen : public Glib::Object
46
_CLASS_GOBJECT(Screen,GdkScreen,GDK_SCREEN,Glib::Object,GObject)
50
_WRAP_METHOD(Glib::RefPtr<Visual> get_system_visual(), gdk_screen_get_system_visual, refreturn)
51
_WRAP_METHOD(Glib::RefPtr<const Visual> get_system_visual() const, gdk_screen_get_system_visual, refreturn, constversion)
53
_WRAP_METHOD(Glib::RefPtr<Visual> get_rgba_visual(), gdk_screen_get_rgba_visual, refreturn)
54
_WRAP_METHOD(Glib::RefPtr<const Visual> get_rgba_visual() const, gdk_screen_get_rgba_visual, refreturn, constversion)
56
_WRAP_METHOD(bool is_composited() const, gdk_screen_is_composited)
58
_WRAP_METHOD(Glib::RefPtr<Window> get_root_window(), gdk_screen_get_root_window, refreturn)
59
_WRAP_METHOD(Glib::RefPtr<const Window> get_root_window() const, gdk_screen_get_root_window, refreturn, constversion)
61
_WRAP_METHOD(Glib::RefPtr<Display> get_display(), gdk_screen_get_display, refreturn)
62
_WRAP_METHOD(Glib::RefPtr<const Display> get_display() const, gdk_screen_get_display, refreturn, constversion)
64
_WRAP_METHOD(int get_number() const, gdk_screen_get_number)
65
_WRAP_METHOD(int get_width() const, gdk_screen_get_width)
66
_WRAP_METHOD(int get_height() const, gdk_screen_get_height)
67
_WRAP_METHOD(int get_width_mm() const, gdk_screen_get_width_mm)
68
_WRAP_METHOD(int get_height_mm() const, gdk_screen_get_height_mm)
70
#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<Visual> >',`Glib::ListHandler< Glib::RefPtr<Visual> >::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)')
71
_WRAP_METHOD(std::vector< Glib::RefPtr<Visual> > list_visuals(), gdk_screen_list_visuals)
73
#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<Window> >',`Glib::ListHandler< Glib::RefPtr<Window> >::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)')
74
_WRAP_METHOD(std::vector< Glib::RefPtr<Window> > get_toplevel_windows(), gdk_screen_get_toplevel_windows)
76
_WRAP_METHOD(Glib::ustring make_display_name(), gdk_screen_make_display_name)
78
_WRAP_METHOD(int get_n_monitors() const, gdk_screen_get_n_monitors)
79
_WRAP_METHOD(int get_primary_monitor() const, gdk_screen_get_primary_monitor)
80
_WRAP_METHOD(void get_monitor_geometry(int monitor_num, Rectangle& dest) const, gdk_screen_get_monitor_geometry)
81
_WRAP_METHOD(int get_monitor_at_point(int x, int y) const, gdk_screen_get_monitor_at_point)
82
_WRAP_METHOD(int get_monitor_at_window(const Glib::RefPtr<Window>& window) const, gdk_screen_get_monitor_at_window)
84
_WRAP_METHOD(int get_monitor_width_mm(int monitor_num) const, gdk_screen_get_monitor_width_mm)
85
_WRAP_METHOD(int get_monitor_height_mm(int monitor_num) const, gdk_screen_get_monitor_height_mm)
86
_WRAP_METHOD(Glib::ustring get_monitor_plug_name(int monitor_num) const, gdk_screen_get_monitor_plug_name)
88
_WRAP_METHOD(static Glib::RefPtr<Screen> get_default(), gdk_screen_get_default, refreturn)
90
template <class ValueType>
91
bool get_setting(const Glib::ustring& name, ValueType& value) const;
92
_IGNORE(gdk_screen_get_setting)
94
_WRAP_METHOD(void set_font_options(const Cairo::FontOptions& options), gdk_screen_set_font_options)
96
// Note: This returns a const, so we assume that we must copy it:
97
#m4 _CONVERSION(`const cairo_font_options_t*', `Cairo::FontOptions', `Cairo::FontOptions(const_cast<cairo_font_options_t*>($3), true /* take_reference */)')
98
_WRAP_METHOD(Cairo::FontOptions get_font_options() const, gdk_screen_get_font_options)
100
_WRAP_METHOD(void set_resolution(double dpi), gdk_screen_set_resolution)
101
_WRAP_METHOD(double get_resolution() const, gdk_screen_get_resolution)
103
_WRAP_METHOD(Glib::RefPtr<Gdk::Window> get_active_window(), gdk_screen_get_active_window, refreturn)
104
_WRAP_METHOD(Glib::RefPtr<const Gdk::Window> get_active_window() const, gdk_screen_get_active_window, refreturn, constversion)
106
#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<Window> >',`Glib::ListHandler< Glib::RefPtr<Window> >::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
107
_WRAP_METHOD(std::vector< Glib::RefPtr<Window> > get_window_stack(), gdk_screen_get_window_stack)
109
//We use no_default_handler because GdkDisplayManagerClass is private.
111
/** The size_changed signal is emitted when the pixel width or
112
* height of a screen changes.
114
_WRAP_SIGNAL(void size_changed(), size-changed, no_default_handler)
115
_WRAP_SIGNAL(void composited_changed(), composited-changed, no_default_handler)
116
_WRAP_SIGNAL(void monitors_changed(), monitors-changed, no_default_handler)
118
_WRAP_PROPERTY("font-options", Cairo::FontOptions)
119
_WRAP_PROPERTY("resolution", double)
122
template <class ValueType>
123
bool Screen::get_setting(const Glib::ustring& name, ValueType& value) const
125
Glib::Value<ValueType> glibmmvalue;
126
glibmmvalue.init(Glib::Value<ValueType>::value_type());
128
gboolean result = gdk_screen_get_setting(const_cast<GdkScreen*>(gobj()), name.c_str(), glibmmvalue.gobj());
130
value = glibmmvalue.get();
134
} /* namespace Gdk */