ruby-****@sourc*****
ruby-****@sourc*****
2003年 10月 7日 (火) 23:26:08 JST
------------------------- REMOTE_ADDR = 218.231.205.39 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/?Gdk%3A%3AWindow ------------------------- = class Gdk::Window A Gdk::Window is a rectangular region on the screen. It's a low-level object, used to implement high-level objects such as Gtk::Widget and Gtk::Window on the GTK+ level. A Gtk::Window is a toplevel window, the thing a user might think of as a "window" with a titlebar and so on; a Gtk::Window may contain many Gdk::Window. For example, each Gtk::Button has a Gdk::Window associated with it. == Object Hierarchy * Object * GLib::Instantiatable * GLib::Object * Gdk::Drawable * Gdk::Window == Class Methods --- Gdk::Window.new(parent, attributes, attributes_mask) Creates a new Gdk::Window using the attributes from attributes. See Gdk::WindowAttr and ((<GdkWindowAttributesType|Gdk::Window#GdkWindowAttributesType>)) for more details. * parent: a Gdk::Window * attributes: a Gdk::WindowAttr of the new window - * attributes_mask: mask indicating which fields in attributes are valid + * attributes_mask: mask indicating which fields in attributes are valid (((<GdkWindowAttributesType|Gdk::Window#GdkWindowAttributesType>))) * Returns: the new Gdk::Window --- Gdk::Window.at_pointer Obtains the window underneath the mouse pointer, returning the location of that window. Returns nil if the window under the mouse pointer is not known to GDK (for example, belongs to another application). * Returns: [window, x, y] * window: Gdk::Window under the mouse pointer * x: origin of the window under the pointer * y: origin of the window under the pointer --- constrain_size(geometry, flags, width, height) Constrains a desired width and height according to a set of geometry hints (such as minimum and maximum size). * geometry: a Gdk::Geometry * flags: a mask indicating what portions of geometry are set(((<GdkWindowHints|Gdk::Window#GdkWindowHints>))). * width: desired width of window * height: desired height of the window * Returns: [new_width, new_height] * new_width: resulting width * new_height: resulting height --- Gdk::Window.process_all_updates Not yet --- Gdk::Window.default_root_window Not yet * Returns: self --- Gdk::Window.foreign_new Not yet * Returns: self == Instance Methods --- destroy Destroys window (destroys the server-side resource associated with window). Memory allocated for window may not be freed until all references to window are dropped. All children of window are also destroyed. There's normally no need to use this method, window are automatically destroyed when their reference count reaches 0. * Returns: nil --- window_type Gets the type of the window. See ((<GdkWindowType|Gdk::Window#GdkWindowType>)). * Returns: self --- show Like Gdk::Window#show_unraised, but also raises the window to the top of the window stack (moves the window to the front of the Z-order). This method maps a window so it's visible onscreen. Its opposite is Gdk::Window#hide. When implementing a Gtk::Widget, you should call this function on the widget's Gdk::Window as part of the "map" method. * Returns: self --- show_unraised Shows a Gdk::Window onscreen, but does not modify its stacking order. In contrast, Gdk::Window#show will raise the window to the top of the window stack. On the X11 platform, in Xlib terms, this function calls XMapWindow() (it also updates some internal GDK state, which means that you can't really use XMapWindow() directly on a GDK window). --- hide For toplevel windows, withdraws them, so they will no longer be known to the window manager; for all windows, unmaps them, so they won't be displayed. Normally done automatically as part of Gtk::Widget#hide. * Returns: nil --- visible? Checks whether the window has been mapped (with Gdk::Window#show or Gdk::Window#show_unraised). * Returns: true if the window is mapped --- viewable? Check if the window and all ancestors of the window are mapped. (This is not necessarily "viewable" in the X sense, since we only check as far as we have GDK window parents, not to the root window.) * Returns: true if the window is viewable --- state Gets the bitwise OR of the currently active window state flags, from the (((<GdkWindowState|Gdk::Event#GdkWindowState>))) enumeration. * Returns: window state bitfield(((<GdkWindowState|Gdk::EventWindowState#GdkWindowState>))) --- withdraw Withdraws a toplevel window (unmaps it and asks the window manager to forget about it). Normally done automatically by Gtk::Widget#hide called on a Gtk::Window. * Returns: nil --- iconify Asks to iconify (minimize) window. The window manager may choose to ignore the request, but normally will honor it. Using Gtk::Window#iconify is preferred, if you have a Gtk::Window widget. * Returns: self --- deiconify Attempt to deiconify (unminimize) window. On X11 the window manager may choose to ignore the request to deiconify. When using GTK+, use Gtk::Window#deiconify instead of the Gdk::Window variant. Or better yet, you probably want to use Gtk::Window#present, which raises the window, focuses it, unminimizes it, and puts it on the current desktop. * Returns: self --- stick "Pins" a toplevel window such that it's on all workspaces and does not scroll with viewports, for window managers that have scrollable viewports. (When using Gtk::Window, Gtk::Window#stick may be more useful.) On the X11 platform, this function depends on window manager support, so may have no effect with many window managers. However, GDK will do the best it can to convince the window manager to stick the window. For window managers that don't support this operation, there's nothing you can do to force it to happen. * Returns: self --- unstick Reverse operation for Gdk::Window#stick; See Gdk::Window#stick and Gtk::Window#unstick. * Returns: self --- maximize Asks the window manager to maximize window, if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don't have a concept of "maximized"; so you can't rely on the maximization actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen. If the window was already maximized, then this method does nothing. * Returns: self --- unmaximize Asks the window manager to unmaximize window, if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don't have a concept of "maximized"; so you can't rely on the unmaximization actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen. If the window wasn't maximized, then this method does nothing. * Returns: self --- move(x, y) Repositions a window relative to its parent window. For toplevel windows, window managers may ignore or modify the move; you should probably use Gtk::Window#move on a Gtk::Window widget anyway, instead of using GDK methods. For child windows, the move will reliably succeed. If you're also planning to resize the window, use Gtk::Window#move_resize to both move and resize simultaneously, for a nicer visual effect. * x: X coordinate relative to window's parent * y: Y coordinate relative to window's parent * Returns: self --- resize Resizes window; for toplevel windows, asks the window manager to resize the window. The window manager may not allow the resize. When using GTK+, use Gtk::Window#resize instead of this low-level GDK function. Windows may not be resized below 1x1. If you're also planning to move the window, use Gdk::Window#move_resize to both move and resize simultaneously, for a nicer visual effect. * width: new width of the window * height: new height of the window * Returns: self --- move_resize(x, y, width, height) Equivalent to calling Gdk::Windo#move and Gdk::Window#resize, except that both operations are performed at once, avoiding strange visual effects. (i.e. the user may be able to see the window first move, then resize, if you don't use Gdk::Window#move_resize.) * x: new X position relative to window's parent * y: new Y position relative to window's parent * width: new width * height: new height * Returns: self --- scroll(dx, dy) Scroll the contents of window, both pixels and children, by the given amount. window itself does not move. Portions of the window that the scroll operation brings in from offscreen areas are invalidated. The invalidated region may be bigger than what would strictly be necessary. (For X11, a minimum area will be invalidated if the window has no subwindows, or if the edges of the window's parent do not extend beyond the edges of the window. In other cases, a multi-step process is used to scroll the window which may produce temporary visual artifacts and unnecessary invalidations.) * dx: Amount to scroll in the X direction * dy: Amount to scroll in the Y direction * Returns: self --- reparent(new_parent, x, y) Reparents window into the given new_parent. The window being reparented will be unmapped as a side effect. * new_parent: new parent to move window into * x: X location inside the new parent * y: Y location inside the new parent * Returns: self --- clear Clears an entire window to the background color or background pixmap. * Returns: self --- clear_area(x, y, width, height, gen_expose = false) Clears an area of window to the background color or background pixmap. * x: x coordinate of rectangle to clear * y: y coordinate of rectangle to clear * width: width of rectangle to clear * height: height of rectangle to clear * gen_expose: true if generates an expose event for the cleared area. * Returns: self --- raise Raises window to the top of the Z-order (stacking order), so that other windows with the same parent window appear below window. If window is a toplevel, the window manager may choose to deny the request to move the window in the Z-order, Gdk::Window#raise only requests the restack, does not guarantee it. * Returns: self --- lower Lowers window to the bottom of the Z-order (stacking order), so that other windows with the same parent window appear above window. If window is a toplevel, the window manager may choose to deny the request to move the window in the Z-order, Gdk::Window#lower only requests the restack, does not guarantee it. ((*Note*)) that Gdk::Window#show raises the window again, so don't call this method before Gdk::Window#show. (Try Gdk::Window#show_unraised.) * Returns: self --- focus(timestamp) Sets keyboard focus to window. If window is not onscreen this will not work. In most cases, Gtk::Window#present should be used on a Gtk::Window, rather than calling this method. * timestamp: timestamp of the event triggering the window focus * Returns: self --- register_dnd Registers a window as a potential drop destination. * Returns: self --- begin_resize_drag(edge, button, root_x, root_y, timestamp) Begins a window resize operation (for a toplevel window). You might use this method to implement a "window resize grip," for example; in fact Gtk::Statusbar uses it. The method works best with window managers that support the Extended Window Manager Hints spec (see ((<URL:http://www.freedesktop.org>))), but has a fallback implementation for other window managers. * edge: the edge or corner from which the drag is started (((<GdkWindowEdge|Gdk::Window#GdkWindowEdge>))) * button: the button being used to drag * root_x: root window X coordinate of mouse click that began the drag * root_y: root window Y coordinate of mouse click that began the drag * timestamp: timestamp of mouse click that began the drag (use Gdk::Event#time) * Returns: self --- begin_move_drag(button, root_x, root_y, timestamp) Begins a window move operation (for a toplevel window). You might use this method to implement a "window move grip," for example. The method works best with window managers that support the Extended Window Manager Hints spec (see ((<URL:http://www.freedesktop.org>))), but has a fallback implementation for other window managers. * button: the button being used to drag * root_x: root window X coordinate of mouse click that began the drag * root_y: root window Y coordinate of mouse click that began the drag * timestamp: timestamp of mouse click that began the drag --- begin_paint(area) Indicates that you are beginning the process of redrawing area. A backing store (offscreen buffer) large enough to contain region will be created. The backing store will be initialized with the background color or background pixmap for window. Then, all drawing operations performed on window will be diverted to the backing store. When you call Gdk::Window#end_paint, the backing store will be copied to window, making it visible onscreen. Only the part of window contained in region will be modified; that is, drawing operations are clipped to region. The net result of all this is to remove flicker, because the user sees the finished product appear all at once when you call Gdk::Window#end_paint. If you draw to window directly without calling Gdk::Window#begin_paint, the user may see flicker as individual drawing operations are performed in sequence. The clipping and background-initializing features of gdk_window_begin_paint are conveniences for the programmer, so you can avoid doing that work yourself. When using GTK+, the widget system automatically places calls to Gdk::Window#begin_paint and Gdk::Window#end_paint around emissions of the expose_event signal. That is, if you're writing an expose event handler, you can assume that the exposed area in Gdk::EventExpose has already been cleared to the window background, is already set as the clip region, and already has a backing store. Therefore in most cases, application code need not call Gdk::Window#begin_paint. (You can disable the automatic calls around expose events on a widget-by-widget basis by calling Gtk::Widget#double_buffered=.) If you call this method multiple times before calling the matching Gdk::Window#end_paint, the backing stores are pushed onto a stack. Gdk::Window#end_paint copies the topmost backing store onscreen, subtracts the topmost region from all other regions in the stack, and pops the stack. All drawing operations affect only the topmost backing store in the stack. One matching call to Gdk::Window#end_paint is required for each call to Gdk::Window#begin_paint. * area: a Gdk::Rectangle or Gdk::Region you intend to draw to * Returns: self --- end_paint Indicates that the backing store created by the most recent call to Gdk::Window#begin_paint should be copied onscreen and deleted, leaving the next-most-recent backing store or no backing store at all as the active paint region. See Gdk::Window#begin_paint for full details. It is an error to call this function without a matching Gdk::Window#begin_paint first. * Returns: self --- invalidate(area, invalidate_children) Adds area to the update area for window. The update area is the region that needs to be redrawn, or "dirty region." The call Gdk::Window#process_updates sends one or more expose events to the window, which together cover the entire update area. An application would normally redraw the contents of window in response to those expose events. GDK will call Gdk::Window#process_all_updates on your behalf whenever your program returns to the main loop and becomes idle, so normally there's no need to do that manually, you just need to invalidate regions that you know should be redrawn. The invalidate_children parameter controls whether the region of each child window that intersects region will also be invalidated. If false, then the update area for child windows will remain unaffected. See Gdk::Window#invalidate_maybe_recurse if you need fine grained control over which children are invalidated. * area: a Gdk::Region or a Gdk::Recatangle * invalidate_children: true to also invalidate child windows * Returns: self --- invalidate_maybe_recurse Not yet --- update_area Not yet --- freeze_updates Not yet --- thaw_updates Not yet --- process_updates --- debug_updates --- get_internal_paint_info --- user_data --- user_data= --- set_user_data --- override_redirect= Not yet * Returns: self --- set_override_redirect Not yet * Returns: self --- background= Not yet * Returns: self --- children Not yet * Returns: self --- cursor= Not yet * Returns: self --- decorations= Not yet * Returns: self --- events Not yet * Returns: self --- events= Not yet * Returns: self --- functions= Not yet * Returns: self --- geometry Not yet * Returns: self --- group= Not yet * Returns: self --- icon_name= Not yet * Returns: self --- merge_child_shapes Not yet * Returns: self --- origin Not yet * Returns: self --- parent Not yet * Returns: self --- pointer Not yet * Returns: self --- position Not yet * Returns: self --- property_change Not yet * Returns: self --- property_delete Not yet * Returns: self --- property_get Not yet * Returns: self --- role= Not yet * Returns: self --- root_origin Not yet * Returns: self --- set_back_pixmap Not yet * Returns: self --- set_background Not yet * Returns: self --- set_child_shapes Not yet * Returns: self --- set_cursor Not yet * Returns: self --- set_decorations Not yet * Returns: self --- set_events Not yet * Returns: self --- set_functions Not yet * Returns: self --- set_group Not yet * Returns: self --- set_icon Not yet * Returns: self --- set_icon_name Not yet * Returns: self --- set_role Not yet * Returns: self --- set_static_gravities Not yet * Returns: self --- set_title Not yet * Returns: self --- set_transient_for Not yet * Returns: self --- shape_combine_mask Not yet * Returns: self --- static_gravities= Not yet * Returns: self --- title= Not yet * Returns: self --- toplevel Not yet * Returns: self --- toplevels Not yet * Returns: self --- transient_for= Not yet * Returns: self --- gl_capable? ((*Ruby/GtkGlExt*)) Returns whether the window is OpenGL-capable. * Returns: true if the window is OpenGL-capable, false otherwise. --- gl_drawable ((*Ruby/GtkGlExt*)) Returns the Gdk::GLDrawable held by the window. In fact, this is a macro that casts the result of Gdk::Window#gl_window to Gdk::GLDrawable. * Returns: the Gdk::GLDrawable. --- gl_window ((*Ruby/GtkGlExt*)) Returns the Gdk::GLWindow held by the window. * Returns: the Gdk::GLWindow. --- set_gl_capability(glconfig) ((*Ruby/GtkGlExt*)) Set the OpenGL-capability to the window. This function creates a new Gdk::GLWindow held by the window. * glconfig: a Gdk::GLConfig. * Returns: the Gdk::GLWindow used by the window if it is successful, nil otherwise. --- unset_gl_capability ((*Ruby/GtkGlExt*)) Unset the OpenGL-capability of the window. This function destroys the Gdk::GLWindow held by the window. * Returns: self == Constants === GdkWindowType Describes the kind of window. --- ROOT root window; this window has no parent, covers the entire screen, and is created by the window system --- TOPLEVEL toplevel window (used to implement Gtk::Window) --- CHILD child window (used to implement e.g. Gtk::Button) --- DIALOG useless/deprecated compatibility type --- TEMP override redirect temporary window (used to implement Gtk::Menu) --- FOREIGN foreign window (see Gdk::Window.foreign_new) === GdkWindowClass Gdk::Window::INPUT_OUTPUT windows are the standard kind of window you might expect. Gdk::Window::INPUT_ONLY windows are invisible; they are used to trap events, but you can't draw on them. --- INPUT_OUTPUT window for graphics and events --- INPUT_ONLY window for events only === GdkWindowHints Used to indicate which fields of a Gdk::Geometry object should be paid attention to. Also, the presence/absence of Gdk::Window::HINT_POS, Gdk::Window::HINT_USER_POS, and Gdk::Window::HINT_USER_SIZE is significant, though they don't directly refer to Gdk::Geometry fields. GDK_HINT_USER_POS will be set automatically by Gtk::Window if you call Gtk::Window#move. Gdk::Window::HINT_USER_POS and Gdk::Window::HINT_USER_SIZE should be set if the user specified a size/position using a --geometry command-line argument; Gtk::Window#parse_geometry automatically sets these flags. --- HINT_POS indicates that the program has positioned the window --- HINT_MIN_SIZE min size fields are set --- HINT_MAX_SIZE max size fields are set --- HINT_BASE_SIZE base size fields are set --- HINT_ASPECT aspect ratio fields are set --- HINT_RESIZE_INC resize increment fields are set --- HINT_WIN_GRAVITY window gravity field is set --- HINT_USER_POS indicates that the window's position was explicitly set by the user --- HINT_USER_SIZE indicates that the window's size was explicitly set by the user === GdkGravity Defines the reference point of a window and the meaning of coordinates passed to Gtk::Window#move. See Gtk::Window#move and the "implementation notes" section of the extended window manager hints specification for more details. --- GRAVITY_NORTH_WEST the reference point is at the top left corner. --- GRAVITY_NORTH the reference point is in the middle of the top edge. --- GRAVITY_NORTH_EAST the reference point is at the top right corner. --- GRAVITY_WEST the reference point is at the middle of the left edge. --- GRAVITY_CENTER the reference point is at the center of the window. --- GRAVITY_EAST the reference point is at the middle of the right edge. --- GRAVITY_SOUTH_WEST the reference point is at the lower left corner. --- GRAVITY_SOUTH the reference point is at the middle of the lower edge. --- GRAVITY_SOUTH_EAST the reference point is at the lower right corner. --- GRAVITY_STATIC the reference point is at the top left corner of the window itself, ignoring window manager decorations. === GdkWindowEdge Determines a window edge or corner. --- EDGE_NORTH_WEST the top left corner. --- EDGE_NORTH the top edge. --- EDGE_NORTH_EAST the top right corner. --- EDGE_WEST the left edge. --- EDGE_EAST the right edge. --- EDGE_SOUTH_WEST the lower left corner. --- EDGE_SOUTH the lower edge. --- EDGE_SOUTH_EAST the lower right corner. === GdkWindowTypeHint --- TYPE_HINT_NORMAL Normal toplevel window. --- TYPE_HINT_DIALOG A dialog window. --- TYPE_HINT_MENU Window used to implement a menu. --- TYPE_HINT_TOOLBAR Window used to implement toolbars. --- TYPE_HINT_SPLASHSCREEN Window used to implement a splash screen displayed as an application is starting up. ((* Since 2.2 *)) --- TYPE_HINT_UTILITY Window used to implement a small persistent utility window, such as a palette or toolbox. It is distinct from type TOOLBAR because it does not correspond to a toolbar torn off from the main application. It's distinct from type DIALOG because it isn't a transient dialog, the user will probably keep it open while they're working. Windows of this type may set the WM_TRANSIENT_FOR hint indicating the main application window. ((* Since 2.2 *)) --- TYPE_HINT_DOCK Window used to implement a dock or panel feature. Typically a Window Manager would keep such windows on top of all other windows. ((* Since 2.2 *)) --- TYPE_HINT_DESKTOP Window used to implement a desktop feature. This can include a single window containing desktop icons with the same dimensions as the screen, allowing the desktop environment to have full control of the desktop, without the need for proxying root window clicks. ((* Since 2.2 *)) === GdkWindowAttributesType Used to indicate which fields in the Gdk::WindowAttr object should be honored. For example, if you filled in the "cursor" and "x" fields of Gdk::WindowAttr, pass "Gdk::Window::WA_X | Gdk::Window::WA_CURSOR" to Gdk::Window.new. Fields in Gdk::WindowAttr not covered by a bit in this enum are required; for example, the width/height, wclass, and window_type fields are required, they have no corresponding flag in GdkWindowAttributesType. --- WA_TITLE Honor the title field --- WA_X Honor the X coordinate field --- WA_Y Honor the Y coordinate field --- WA_CURSOR Honor the cursor field --- WA_COLORMAP Honor the colormap field --- WA_VISUAL Honor the visual field --- WA_WMCLASS Honor the wmclass_class and wmclass_name fields --- WA_NOREDIR Honor the override_redirect field === GdkFilterReturn Specifies the result of applying a filter block(See Gdk::Window#add_filter) to a native event. --- FILTER_CONTINUE event not handled, continue processing. --- FILTER_TRANSLATE translated event stored. --- FILTER_REMOVE event handled, terminate processing. === GdkModifierType A set of bit-flags to indicate the state of modifier keys and mouse buttons in various event types. Typical modifier keys are Shift, Control, Meta, Super, Hyper, Alt, Compose, Apple, CapsLock or ShiftLock. Like the X Window System, GDK supports 8 modifier keys and 5 mouse buttons. --- SHIFT_MASK the Shift key. --- LOCK_MASK a Lock key (depending on the modifier mapping of the X server this may either be CapsLock or ShiftLock). --- CONTROL_MASK the Control key. --- MOD1_MASK the fourth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier, but normally it is the Alt key). --- MOD2_MASK the fifth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier). --- MOD3_MASK the sixth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier). --- MOD4_MASK the seventh modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier). --- MOD5_MASK the eighth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier). --- BUTTON1_MASK the first mouse button. --- BUTTON2_MASK the second mouse button. --- BUTTON3_MASK the third mouse button. --- BUTTON4_MASK the fourth mouse button. --- BUTTON5_MASK the fifth mouse button. --- RELEASE_MASK not used in GDK itself. GTK+ uses it to differentiate between (keyval, modifiers) pairs from key press and release events. --- MODIFIER_MASK === GdkWMDecoration These are hints originally defined by the Motif toolkit. The window manager can use them when determining how to decorate the window. The hint must be set before mapping the window. --- DECOR_ALL all decorations should be applied. --- DECOR_BORDER a frame should be drawn around the window. --- DECOR_RESIZEH the frame should have resize handles. --- DECOR_TITLE a titlebar should be placed above the window. --- DECOR_MENU a button for opening a menu should be included. --- DECOR_MINIMIZE a minimize button should be included. --- DECOR_MAXIMIZE a maximize button should be included. === GdkWMFunction These are hints originally defined by the Motif toolkit. The window manager can use them when determining the functions to offer for the window. The hint must be set before mapping the window. --- FUNC_ALL all functions should be offered. --- FUNC_RESIZE the window should be resizable. --- FUNC_MOVE the window should be movable. --- FUNC_MINIMIZE the window should be minimizable. --- FUNC_MAXIMIZE the window should be maximizable. --- FUNC_CLOSE the window should be closable. === Misc --- PARENT_RELATIVE A special value for Gdk::Pixmap variables, indicating that the background pixmap for a window should be inherited from the parent window. * ((<Scritch>)) - Add a part of Ruby/GtkGlExt * ((<Masao>)) - Add a part of Ruby/GDK