新規作成  編集  Ruby-GNOME2 Project Website  ページ一覧  検索  更新履歴  編集履歴  RSS  ログイン

Gdk::Geometry

class Gdk::Geometry

The Gdk::Geometry gives the window manager information about a window's geometry constraints. Normally you would set these on the GTK+ level using Gtk::Window#set_geometry_hints. Gtk::Window then sets the hints on the Gdk::Window it creates.

Gdk::Window#set_geometry_hints expects the hints to be fully valid already and simply passes them to the window manager; in contrast, Gtk::Window#set_geometry_hints performs some interpretation. For example, Gtk::Window will apply the hints to the geometry widget instead of the toplevel window, if you set a geometry widget. Also, the min_width/min_height/max_width/max_height fields may be set to -1, and Gtk::Window will substitute the size request of the window or geometry widget. If the minimum size hint is not provided, Gtk::Window will use its requisition as the minimum size. If the minimum size is provided and a geometry widget is set, Gtk::Window will take the minimum size as the minimum size of the geometry widget rather than the entire window. The base size is treated similarly.

The canonical use-case for Gtk::Window#set_geometry_hints is to get a terminal widget to resize properly. Here, the terminal text area should be the geometry widget; Gtk::Window will then automatically set the base size to the size of other widgets in the terminal window, such as the menubar and scrollbar. Then, the width_inc and height_inc fields should be set to the size of one character in the terminal. Finally, the base size should be set to the size of one character. The net effect is that the minimum size of the terminal will have a 1x1 character terminal area, and only terminal sizes on the "character grid" will be allowed.

Here's an example of how the terminal example would be implemented, assuming a terminal area widget called "terminal" and a toplevel window "toplevel":

hints = Gdk::Geometry.new

hints.base_width  = terminal.char_width;  # terminal is subclass of Gtk::Widget
hints.base_height = terminal.char_height;
hints.min_width   = terminal.char_width;
hints.min_height  = terminal.char_height;
hints.width_inc   = terminal.char_width;
hints.height_inc  = terminal.char_height;

window.set_geometry_hints(terminal, hints,
                           Gdk::Window::HINT_RESIZE_INC |
                           Gdk::Window::HINT_MIN_SIZE |
                           Gdk::WIndow::BASE_SIZE)

The other useful fields are the min_aspect and max_aspect fields; these contain a width/height ratio as a floating point number. If a geometry widget is set, the aspect applies to the geometry widget rather than the entire window. The most common use of these hints is probably to set min_aspect and max_aspect to the same value, thus forcing the window to keep a constant aspect ratio.

Class Methods

Gdk::Geometry.new
(not yet)
  • Returns: self

Instance Methods

base_height
(not yet)
  • Returns: self
base_height=
(not yet)
  • Returns: self
base_width
(not yet)
  • Returns: self
base_width=
(not yet)
  • Returns: self
height_inc
(not yet)
  • Returns: self
height_inc=
(not yet)
  • Returns: self
max_aspect
(not yet)
  • Returns: self
max_aspect=
(not yet)
  • Returns: self
max_height
(not yet)
  • Returns: self
max_height=
(not yet)
  • Returns: self
max_width
(not yet)
  • Returns: self
max_width=
(not yet)
  • Returns: self
min_aspect
(not yet)
  • Returns: self
min_aspect=
(not yet)
  • Returns: self
min_height
(not yet)
  • Returns: self
min_height=
(not yet)
  • Returns: self
min_width
(not yet)
  • Returns: self
min_width=
(not yet)
  • Returns: self
set
(not yet)
  • Returns: self
set_base_height
(not yet)
  • Returns: self
set_base_width
(not yet)
  • Returns: self
set_height_inc
(not yet)
  • Returns: self
set_max_aspect
(not yet)
  • Returns: self
set_max_height
(not yet)
  • Returns: self
set_max_width
(not yet)
  • Returns: self
set_min_aspect
(not yet)
  • Returns: self
set_min_height
(not yet)
  • Returns: self
set_min_width
(not yet)
  • Returns: self
set_width_inc
(not yet)
  • Returns: self
set_win_gravity
(not yet)
  • Returns: self
width_inc
(not yet)
  • Returns: self
width_inc=
(not yet)
  • Returns: self
win_gravity
(not yet)
  • Returns: self
win_gravity=
(not yet)
  • Returns: self
更新日時:2005/11/17 02:43:41
キーワード:
参照:[Gdk::Window] [Gtk::Window] [Gdk::Geometry] [ウインドウ]