~ubuntu-branches/ubuntu/precise/gtkmm3.0/precise

« back to all changes in this revision

Viewing changes to gdk/src/screen.hg

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2011-06-17 00:12:44 UTC
  • Revision ID: james.westby@ubuntu.com-20110617001244-9hl5an15hiaaahi6
Tags: upstream-3.0.1
ImportĀ upstreamĀ versionĀ 3.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: screen.hg,v 1.8 2006/06/10 15:26:24 murrayc Exp $ */
 
2
 
 
3
/* screen.h
 
4
 *
 
5
 * Copyright (C) 1998-2002 The gtkmm Development Team
 
6
 *
 
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.
 
11
 *
 
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.
 
16
 *
 
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.
 
20
 */
 
21
 
 
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>
 
27
_DEFS(gdkmm,gdk)
 
28
_PINCLUDE(glibmm/private/object_p.h)
 
29
 
 
30
 
 
31
namespace Gdk
 
32
{
 
33
 
 
34
class Display;
 
35
class Visual;
 
36
class Window;
 
37
 
 
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.
 
43
 */
 
44
class Screen : public Glib::Object
 
45
{
 
46
  _CLASS_GOBJECT(Screen,GdkScreen,GDK_SCREEN,Glib::Object,GObject)
 
47
protected:
 
48
 
 
49
public:
 
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)
 
52
 
 
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)
 
55
 
 
56
  _WRAP_METHOD(bool is_composited() const, gdk_screen_is_composited)
 
57
 
 
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)
 
60
 
 
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)
 
63
 
 
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)
 
69
 
 
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)
 
72
 
 
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)
 
75
 
 
76
  _WRAP_METHOD(Glib::ustring make_display_name(), gdk_screen_make_display_name)
 
77
 
 
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)
 
83
 
 
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)
 
87
 
 
88
  _WRAP_METHOD(static Glib::RefPtr<Screen> get_default(), gdk_screen_get_default, refreturn)
 
89
 
 
90
  template <class ValueType>
 
91
  bool get_setting(const Glib::ustring& name, ValueType& value) const;
 
92
  _IGNORE(gdk_screen_get_setting)
 
93
 
 
94
  _WRAP_METHOD(void set_font_options(const Cairo::FontOptions& options), gdk_screen_set_font_options)
 
95
 
 
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)
 
99
 
 
100
  _WRAP_METHOD(void set_resolution(double dpi), gdk_screen_set_resolution)
 
101
  _WRAP_METHOD(double get_resolution() const, gdk_screen_get_resolution)
 
102
 
 
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)
 
105
 
 
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)
 
108
 
 
109
  //We use no_default_handler because GdkDisplayManagerClass is private.
 
110
 
 
111
  /** The size_changed signal is emitted when the pixel width or
 
112
   * height of a screen changes.
 
113
   */
 
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)
 
117
 
 
118
  _WRAP_PROPERTY("font-options", Cairo::FontOptions)
 
119
  _WRAP_PROPERTY("resolution", double)
 
120
};
 
121
 
 
122
template <class ValueType>
 
123
bool Screen::get_setting(const Glib::ustring& name, ValueType& value) const
 
124
{
 
125
  Glib::Value<ValueType> glibmmvalue;
 
126
  glibmmvalue.init(Glib::Value<ValueType>::value_type());
 
127
 
 
128
  gboolean result = gdk_screen_get_setting(const_cast<GdkScreen*>(gobj()), name.c_str(), glibmmvalue.gobj());
 
129
 
 
130
  value = glibmmvalue.get();
 
131
  return result;
 
132
}
 
133
 
 
134
} /* namespace Gdk */