GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

window.hh

Go to the documentation of this file.
00001 /* GFC-UI: GTK+ Foundation Classes (User Interface Library) 00002 * Copyright (C) 2002-2004 The GFC Development Team. 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00023 00024 #ifndef GFC_GDK_WINDOW_HH 00025 #define GFC_GDK_WINDOW_HH 00026 00027 #ifndef GFC_GDK_DRAWABLE_HH 00028 #include <gfc/gdk/drawable.hh> 00029 #endif 00030 00031 #ifndef GFC_GDK_EVENTS_HH 00032 #include <gfc/gdk/events.hh> 00033 #endif 00034 00035 namespace GFC { 00036 00037 namespace Gdk { 00038 00039 class Cursor; 00040 class Pixbuf; 00041 00044 00045 enum WindowType 00046 { 00047 WINDOW_ROOT = GDK_WINDOW_ROOT, 00050 00051 WINDOW_TOPLEVEL = GDK_WINDOW_TOPLEVEL, 00053 00054 WINDOW_CHILD = GDK_WINDOW_CHILD, 00056 00057 WINDOW_DIALOG = GDK_WINDOW_DIALOG, 00059 00060 WINDOW_TEMP = GDK_WINDOW_TEMP, 00062 00063 WINDOW_FOREIGN = GDK_WINDOW_FOREIGN 00065 }; 00066 00071 00072 enum WMDecoration 00073 { 00074 DECOR_ALL = GDK_DECOR_ALL, 00075 DECOR_BORDER = GDK_DECOR_BORDER, 00076 DECOR_RESIZEH = GDK_DECOR_RESIZEH, 00077 DECOR_TITLE = GDK_DECOR_TITLE, 00078 DECOR_MENU = GDK_DECOR_MENU, 00079 DECOR_MINIMIZE = GDK_DECOR_MINIMIZE, 00080 DECOR_MAXIMIZE = GDK_DECOR_MAXIMIZE 00081 }; 00082 00084 00085 typedef unsigned int WMDecorationField; 00086 00091 00092 enum WMFunction 00093 { 00094 FUNC_ALL = GDK_FUNC_ALL, 00095 FUNC_RESIZE = GDK_FUNC_RESIZE, 00096 FUNC_MOVE = GDK_FUNC_MOVE, 00097 FUNC_MINIMIZE = GDK_FUNC_MINIMIZE, 00098 FUNC_MAXMIZE = GDK_FUNC_MAXIMIZE, 00099 FUNC_CLOSE = GDK_FUNC_CLOSE 00100 }; 00101 00103 00104 typedef unsigned int WMFunctionField; 00105 00108 00109 Window* get_default_root_window(); 00113 00115 00154 00155 class Geometry 00156 { 00157 GdkGeometry geometry_; 00158 unsigned int mask_; 00159 00160 public: 00163 00164 Geometry(); 00166 00170 00171 GdkGeometry* gdk_geometry() const; 00173 00174 GdkWindowHints gdk_window_hints () const; 00176 00177 int min_width() const; 00179 00180 int min_height() const; 00182 00183 int max_width() const; 00185 00186 int max_height() const; 00188 00189 int base_width() const; 00191 00192 int base_height() const; 00194 00195 int width_increment() const; 00197 00198 int height_increment() const; 00200 00201 double min_aspect_ratio() const; 00203 00204 double max_aspect_ratio() const; 00206 00207 bool min_size_set() const; 00209 00210 bool max_size_set() const; 00212 00213 bool base_size_set() const; 00215 00216 bool aspect_range_set() const; 00218 00219 bool resize_increments_set() const; 00221 00225 00226 void set_min_size(int width, int height); 00230 00231 void unset_min_size(); 00233 00234 void set_max_size(int width, int height); 00238 00239 void unset_max_size(); 00241 00242 void set_base_size(int width, int height); 00246 00247 void unset_base_size(); 00249 00250 void set_resize_increments(int width_inc, int height_inc); 00254 00255 void unset_resize_increments(); 00257 00258 void set_aspect_range(double min_aspect_ratio, double max_aspect_ratio); 00262 00263 void unset_aspect_range(); 00265 00266 void constrain_size(unsigned int flags, int width, int height, int *new_width, int *new_height); 00274 00276 }; 00277 00285 00286 class WindowAttr 00287 { 00288 GdkWindowAttr attr_; 00289 int mask_; 00290 00291 public: 00294 00295 WindowAttr(int width, int height, WindowType type, EventMaskField event_mask = 0); 00301 00302 WindowAttr(int x, int y, int width, int height, WindowType type, EventMaskField event_mask = 0); 00310 00311 WindowAttr(const Rectangle& allocation, WindowType type, EventMaskField event_mask = 0); 00316 00320 00321 GdkWindowAttr* gdk_window_attr() const; 00323 00324 int mask() const { return mask_; } 00326 00327 void set_title(const String& title); 00330 00331 void set_type(WindowType type); 00334 00335 void set_events(EventMaskField event_mask); 00338 00339 void set_position(int x, int y); 00343 00344 void set_size(int width, int height); 00348 00349 void set_allocation(int x, int y, int width, int height); 00355 00356 void set_allocation(const Rectangle& allocation); 00359 00360 void set_cursor(const Cursor& cursor); 00363 00364 void set_visual(const Visual& visual); 00367 00368 void set_colormap(const Colormap& colormap); 00371 00372 void set_input_only(); 00379 00380 void set_override_redirect(); 00382 00384 }; 00385 00394 00395 class Window : public Drawable 00396 { 00397 friend class G::Object; 00398 00399 Window(const Window&); 00400 Window& operator=(const Window&); 00401 00402 protected: 00405 00406 explicit Window(GdkWindow *window, bool owns_reference = true); 00413 00415 00416 public: 00419 00420 Window(const WindowAttr& attributes); 00423 00424 Window(const Window& parent, const WindowAttr& attributes); 00431 00432 virtual ~Window(); 00434 00436 00437 static Pointer<Window> create(GdkNativeWindow anid, const Display *display = 0); 00446 00447 static Pointer<Window> lookup(GdkNativeWindow anid, const Display *display = 0); 00454 00457 00458 GdkWindow* gdk_window() const; 00460 00461 GdkWindowObject* gdk_window_object() const; 00463 00464 WindowType get_window_type() const; 00466 00467 bool is_visible() const; 00470 00471 bool is_viewable() const; 00477 00478 WindowState get_state() const; 00481 00482 void get_user_data(void *&data) const; 00486 00487 void get_geometry(int *x, int *y, int *width, int *height, int *depth) const; 00505 00506 void get_geometry(Rectangle& rectangle, int *depth) const; 00521 00522 void get_position(int *x, int *y) const; 00531 00532 Point get_position() const; 00540 00541 bool get_origin(int *x, int *y) const; 00549 00550 Point get_origin() const; 00556 00557 void get_root_origin(int *x, int *y) const; 00561 00562 Point get_root_origin() const; 00565 00566 Window* get_pointer(int *x, int *y, ModifierTypeField *mask) const; 00575 00576 Window* get_parent() const; 00585 00586 Window* get_toplevel() const; 00589 00590 bool get_children(std::vector<Window*>& child_list) const; 00598 00599 EventMaskField get_events() const; 00602 00603 Window* get_group() const; 00606 00607 bool get_decorations(WMDecorationField *decorations) const; 00611 00612 Pointer<Region> get_update_area() const; 00618 00619 Rectangle get_frame_extents() const; 00625 00626 void get_frame_extents(Rectangle& rectangle) const; 00632 00634 00635 static Window* at_pointer(int *win_x, int *win_y, const Display *display = 0); 00646 00647 static Window* at_pointer(Point& point, const Display *display = 0); 00657 00658 static bool get_toplevels(std::vector<Window*>& toplevels); 00665 00666 static void process_all_updates(); 00668 00669 static void add_filter(Window *window, GdkFilterFunc function, void *data); 00677 00678 static void remove_filter(Window *window, GdkFilterFunc function, void *data); 00683 00686 00687 virtual void dispose(); 00696 00697 void show(); 00704 00705 void show_unraised(); 00711 00712 void hide(); 00716 00717 void withdraw(); 00721 00722 void move(int x, int y); 00732 00733 void move(const Point& point); 00742 00743 void resize(int width, int height); 00752 00753 void move_resize(int x, int y, int width, int height); 00762 00763 void move_resize(const Rectangle& rectangle); 00768 00769 void reparent(Window& new_parent, int x, int y); 00775 00776 void clear(); 00778 00779 void clear_area(int x, int y, int width, int height, bool generate_expose = false); 00786 00787 void clear_area(const Rectangle& rectangle, bool generate_expose = false); 00791 00792 void raise(); 00799 00800 void lower(); 00810 00811 void focus(unsigned int timestamp); 00818 00819 void set_user_data(void *user_data); 00828 00829 void set_override_redirect(bool override_redirect); 00838 00839 void set_accept_focus(bool accept_focus); 00846 00847 void scroll(int dx, int dy); 00859 00860 void shape_combine_mask(Bitmap *shape_mask, int x = 0, int y = 0); 00878 00879 void shape_combine_region(Region *shape_region, int offset_x = 0, int offset_y = 0); 00898 00899 void set_child_shapes(); 00905 00906 void merge_child_shapes(); 00912 00913 bool set_static_gravities(bool use_static); 00921 00922 void set_type_hint(WindowTypeHint hint); 00929 00930 void set_modal_hint(bool modal); 00937 00938 void set_skip_taskbar_hint(bool skips_taskbar); 00946 00947 void set_skip_pager_hint(bool skips_pager); 00957 00958 void set_geometry_hints(const Geometry *geometry); 00978 00979 void begin_paint(const Rectangle& rectangle); 00985 00986 void begin_paint(const Region& region); 01015 01016 void end_paint(); 01021 01022 void set_title(const char *title); 01023 void set_title(const String& title); 01029 01030 void set_role(const char *role); 01031 void set_role(const String& role); 01043 01044 void set_transient_for(Window& parent); 01052 01053 void set_background(const Color& color); 01061 01062 void set_back_pixmap(Pixmap *pixmap, bool parent_relative = false); 01077 01078 void set_cursor(const Cursor& cursor); 01083 01084 void set_events(EventMaskField event_mask); 01092 01093 void set_icon_list(const std::vector<Pixbuf*>& pixbufs); 01102 01103 void set_icon(Pixmap *pixmap, Bitmap *mask, Window *icon_window = 0); 01113 01114 void set_icon_name(const char *name); 01115 void set_icon_name(const String& name); 01122 01123 void set_group(Window& leader); 01136 01137 void set_decorations(WMDecorationField decorations); 01153 01154 void set_functions(WMFunctionField functions); 01166 01167 void iconify(); 01172 01173 void deiconify(); 01179 01180 void stick(); 01188 01189 void unstick(); 01191 01192 void maximize(); 01199 01200 void unmaximize(); 01207 01208 void fullscreen(); 01216 01217 void unfullscreen(); 01225 01226 void set_keep_above(bool setting); 01236 01237 void set_keep_below(bool setting); 01247 01248 void register_dnd(); 01250 01251 void begin_resize_drag(WindowEdge edge, int button, int root_x, int root_y, unsigned int timestamp); 01263 01264 void begin_move_drag(int button, int root_x, int root_y, unsigned int timestamp); 01275 01276 void invalidate(const Rectangle& rectangle, bool invalidate_children); 01283 01284 void invalidate(const Region& region, bool invalidate_children); 01302 01303 void freeze_updates(); 01308 01309 void thaw_updates(); 01311 01312 void process_updates(bool update_children); 01321 01322 void set_debug_updates(bool setting); 01339 01340 GrabStatus keyboard_grab(bool owner_events = false, unsigned int time = GDK_CURRENT_TIME); 01352 01353 GrabStatus pointer_grab(EventMaskField event_mask, Window *confine_to = 0, Cursor *cursor = 0, 01354 bool owner_events = false, unsigned int time = GDK_CURRENT_TIME); 01385 01389 01390 void set_extension_events(int mask, ExtensionMode mode); 01395 01397 }; 01398 01399 } // namespace Gdk 01400 01401 } // namespace GFC 01402 01403 #include <gfc/gdk/inline/window.inl> 01404 01405 #endif // GFC_GDK_WINDOW_HH 01406

Generated on Tue Aug 24 00:34:33 2004 for GFC-UI by doxygen 1.3.8