Reference Manual
Inti Logo
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

window.h

Go to the documentation of this file.
00001 /*  Inti: Integrated Foundation Classes
00002  *  Copyright (C) 2002-2003 The Inti Development Team.
00003  *  Copyright (C) 2000 Red Hat, Inc.
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU Library General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Library General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018  */
00019  
00024 
00025 #ifndef INTI_GDK_WINDOW_H
00026 #define INTI_GDK_WINDOW_H
00027 
00028 #ifndef INTI_GDK_DRAWABLE_H
00029 #include <inti/gdk/drawable.h>
00030 #endif
00031 
00032 #ifndef INTI_GDK_EVENTS_H
00033 #include <inti/gdk/events.h>
00034 #endif
00035 
00036 namespace Inti {
00037 
00038 namespace Gdk {
00039 
00040 class Cursor;
00041 class Pixbuf;
00042 class WindowClass;
00043 
00046 
00047 enum WindowType
00048 {
00049         WINDOW_ROOT = GDK_WINDOW_ROOT,
00052 
00053         WINDOW_TOPLEVEL = GDK_WINDOW_TOPLEVEL,
00055         
00056         WINDOW_CHILD = GDK_WINDOW_CHILD,
00058         
00059         WINDOW_DIALOG = GDK_WINDOW_DIALOG,
00061 
00062         WINDOW_TEMP = GDK_WINDOW_TEMP,
00064 
00065         WINDOW_FOREIGN = GDK_WINDOW_FOREIGN
00067 };
00068 
00073 
00074 enum WMDecoration
00075 {
00076         DECOR_ALL = GDK_DECOR_ALL, 
00077         DECOR_BORDER = GDK_DECOR_BORDER, 
00078         DECOR_RESIZEH = GDK_DECOR_RESIZEH, 
00079         DECOR_TITLE = GDK_DECOR_TITLE, 
00080         DECOR_MENU = GDK_DECOR_MENU, 
00081         DECOR_MINIMIZE = GDK_DECOR_MINIMIZE, 
00082         DECOR_MAXIMIZE = GDK_DECOR_MAXIMIZE 
00083 };
00084 
00086 
00087 typedef unsigned int WMDecorationField;
00088 
00093 
00094 enum WMFunction
00095 {
00096         FUNC_ALL = GDK_FUNC_ALL, 
00097         FUNC_RESIZE = GDK_FUNC_RESIZE, 
00098         FUNC_MOVE = GDK_FUNC_MOVE, 
00099         FUNC_MINIMIZE = GDK_FUNC_MINIMIZE, 
00100         FUNC_MAXMIZE = GDK_FUNC_MAXIMIZE, 
00101         FUNC_CLOSE = GDK_FUNC_CLOSE 
00102 };
00103 
00105 
00106 typedef unsigned int WMFunctionField;
00107 
00110 
00111 Window* get_default_root_window();
00115 
00117 
00156 
00157 class Geometry
00158 {
00159         GdkGeometry geometry_;
00160         unsigned int mask_;
00161 
00162 public:
00165 
00166         Geometry();
00168 
00172 
00173         GdkGeometry* gdk_geometry() const { return const_cast<GdkGeometry*>(&geometry_); }
00175 
00176         GdkWindowHints gdk_window_hints () const { return (GdkWindowHints)mask_; }
00178 
00179         int min_width() const;
00181 
00182         int min_height() const;
00184 
00185         int max_width() const;
00187 
00188         int max_height() const;
00190 
00191         int base_width() const;
00193 
00194         int base_height() const;
00196 
00197         int width_increment() const;
00199 
00200         int height_increment() const;
00202 
00203         double min_aspect_ratio() const;
00205 
00206         double max_aspect_ratio() const;
00208 
00209         bool min_size_set() const;
00211 
00212         bool max_size_set() const;
00214 
00215         bool base_size_set() const;
00217 
00218         bool aspect_range_set() const;
00220 
00221         bool resize_increments_set() const;
00223 
00227 
00228         void set_min_size(int width, int height);
00232 
00233         void unset_min_size();
00235 
00236         void set_max_size(int width, int height);
00240 
00241         void unset_max_size();
00243 
00244         void set_base_size(int width, int height);
00248 
00249         void unset_base_size();
00251 
00252         void set_resize_increments(int width_inc, int height_inc);
00256 
00257         void unset_resize_increments();
00259 
00260         void set_aspect_range(double min_aspect_ratio, double max_aspect_ratio);
00264 
00265         void unset_aspect_range();
00267 
00268         void constrain_size(unsigned int flags, int width, int height, int *new_width, int *new_height);
00276 
00278 };
00279 
00287 
00288 class WindowAttr
00289 {
00290         GdkWindowAttr attr_;
00291         int mask_;
00292 
00293 public:
00296 
00297         WindowAttr(int width, int height, WindowType type, EventMaskField event_mask = 0);
00303 
00304         WindowAttr(int x, int y, int width, int height, WindowType type, EventMaskField event_mask = 0);
00312 
00313         WindowAttr(const Rectangle& allocation, WindowType type, EventMaskField event_mask = 0);
00318 
00322 
00323         GdkWindowAttr* gdk_window_attr() const { return const_cast<GdkWindowAttr*>(&attr_); }
00325 
00326         int mask() const { return mask_; }
00328 
00329         void set_title(const String& title);
00332 
00333         void set_type(WindowType type);
00336 
00337         void set_events(EventMaskField event_mask);
00340 
00341         void set_position(int x, int y);
00345 
00346         void set_size(int width, int height);
00350 
00351         void set_allocation(int x, int y, int width, int height);
00357 
00358         void set_allocation(const Rectangle& allocation);
00361 
00362         void set_cursor(const Cursor& cursor);
00365 
00366         void set_visual(const Visual& visual);
00369 
00370         void set_colormap(const Colormap& colormap);
00373 
00374         void set_input_only();
00381 
00382         void set_override_redirect();
00384 
00386 };
00387 
00396 
00397 class Window : public Drawable
00398 {
00399         friend class G::Object;
00400         friend class WindowClass;
00401 
00402         Window(const Window&);
00403         Window& operator=(const Window&);
00404         
00405 protected:
00408 
00409         explicit Window(GdkWindow *window, bool reference = true);
00416 
00418         
00419 public:
00420         typedef Slot2<FilterReturn, GdkXEvent*, GdkEvent*> FilterSlot;
00434 
00437 
00438         Window(const WindowAttr& attributes);
00441 
00442         Window(const Window& parent, const WindowAttr& attributes);
00449 
00450         virtual ~Window();
00452         
00454 
00455         static Pointer<Window> create(GdkNativeWindow anid, const Display *display = 0);
00464 
00465         static Pointer<Window> lookup(GdkNativeWindow anid, const Display *display = 0);
00472 
00475 
00476         GdkWindow* gdk_window() const { return (GdkWindow*)instance; }
00478 
00479         GdkWindowObject* gdk_window_object() const;
00481 
00482         GdkWindowObjectClass* gdk_window_object_class() const;
00484 
00485         WindowType get_window_type() const;
00487 
00488         bool is_visible() const;
00491 
00492         bool is_viewable() const;
00498 
00499         WindowState get_state() const;
00502 
00503         void get_user_data(void *&data) const;
00507 
00508         void get_geometry(int *x, int *y, int *width, int *height, int *depth) const;
00526 
00527         void get_geometry(Rectangle& rectangle, int *depth) const;
00542 
00543         void get_position(int *x, int *y) const;
00552 
00553         Point get_position() const;
00561 
00562         bool get_origin(int *x, int *y) const;
00570 
00571         Point get_origin() const;
00577 
00578         void get_root_origin(int *x, int *y) const;
00582 
00583         Point get_root_origin() const;
00586 
00587         Window* get_pointer(int *x, int *y, ModifierTypeField *mask) const;
00596 
00597         Window* get_parent() const;
00606 
00607         Window* get_toplevel() const;
00610 
00611         bool get_children(std::vector<Window*>& child_list) const;
00619         
00620         EventMaskField get_events() const;
00623 
00624         bool get_decorations(WMDecorationField *decorations) const;
00628 
00629         Pointer<Region> get_update_area() const;
00635 
00636         Rectangle get_frame_extents() const;
00642 
00643         void get_frame_extents(Rectangle& rectangle) const;
00649 
00651 
00652         static Window* at_pointer(int *win_x, int *win_y, const Display *display = 0);
00663 
00664         static Window* at_pointer(Point& point, const Display *display = 0);
00674 
00675         static bool get_toplevels(std::vector<Window*>& toplevels);
00682 
00683         static void process_all_updates();
00685 
00686         static void add_filter(Window *window, const FilterSlot *filter);
00693 
00694         static void remove_filter(Window *window, const FilterSlot *filter);
00698 
00701 
00702         virtual void dispose();
00711 
00712         void show();
00719 
00720         void show_unraised();
00726 
00727         void hide();
00731 
00732         void withdraw();
00736         
00737         void move(int x, int y);
00747 
00748         void move(const Point& point);
00757 
00758         void resize(int width, int height);
00767 
00768         void move_resize(int x, int y, int width, int height);
00777 
00778         void move_resize(const Rectangle& rectangle);
00783 
00784         void reparent(Window& new_parent, int x, int y);
00790 
00791         void clear();
00793 
00794         void clear_area(int x, int y, int width, int height, bool generate_expose = false);
00801 
00802         void clear_area(const Rectangle& rectangle, bool generate_expose = false);
00806 
00807         void raise();
00814 
00815         void lower();
00825 
00826         void focus(unsigned int timestamp);
00833 
00834         void set_user_data(void *user_data);
00843         
00844         void set_override_redirect(bool override_redirect);
00853 
00854         void scroll(int dx, int dy);
00866 
00867         void shape_combine_mask(Bitmap *shape_mask, int x = 0, int y = 0);
00885 
00886         void shape_combine_region(Region *shape_region, int offset_x = 0, int offset_y = 0);
00905         
00906         void set_child_shapes();
00912         
00913         void merge_child_shapes();
00919         
00920         bool set_static_gravities(bool use_static);
00928 
00929         void set_type_hint(WindowTypeHint hint);
00936 
00937         void set_modal_hint(bool modal);
00944 
00945         void set_skip_taskbar_hint(bool skips_taskbar);
00953         
00954         void set_skip_pager_hint(bool skips_pager);
00964 
00965         void set_geometry_hints(const Geometry *geometry);
00985 
00986         void begin_paint(const Rectangle& rectangle);
00992 
00993         void begin_paint(const Region& region);
01022 
01023         void end_paint();
01028 
01029         void set_title(const String& title);
01035 
01036         void set_role(const String& role);
01048 
01049         void set_transient_for(Window& parent);
01057 
01058         void set_background(const Color& color);
01066 
01067         void set_back_pixmap(Pixmap *pixmap, bool parent_relative = false);
01082 
01083         void set_cursor(const Cursor& cursor);
01088         
01089         void set_events(EventMaskField event_mask);
01097 
01098         void set_icon_list(const std::vector<Pixbuf*>& pixbufs);
01107 
01108         void set_icon(Pixmap *pixmap, Bitmap *mask, Window *icon_window = 0);
01118 
01119         void set_icon_name(const String& name);
01126 
01127         void set_group(Window& leader);
01140 
01141         void set_decorations(WMDecorationField decorations);
01157 
01158         void set_functions(WMFunctionField functions);
01170 
01171         void iconify();
01176 
01177         void deiconify();
01183 
01184         void stick();
01192 
01193         void unstick();
01195 
01196         void maximize();
01203         
01204         void unmaximize();
01211 
01212         void fullscreen();
01220 
01221         void unfullscreen();
01229 
01230         void register_dnd();
01232 
01233         void begin_resize_drag(WindowEdge edge, int button, int root_x, int root_y, unsigned int timestamp);
01245 
01246         void begin_move_drag(int button, int root_x, int root_y, unsigned int timestamp);
01257 
01258         void invalidate(const Rectangle& rectangle, bool invalidate_children);
01265 
01266         void invalidate(const Region& region, bool invalidate_children);
01284 
01285         void freeze_updates();
01290 
01291         void thaw_updates();
01293 
01294         void process_updates(bool update_children);
01303 
01304         void set_debug_updates(bool setting);
01321 
01322         GrabStatus keyboard_grab(bool owner_events = false, unsigned int time = GDK_CURRENT_TIME);
01334 
01335         GrabStatus pointer_grab(EventMaskField event_mask, Window *confine_to = 0, Cursor *cursor = 0,
01336                                 bool owner_events = false, unsigned int time = GDK_CURRENT_TIME);
01367 
01371 
01372         void set_extension_events(int mask, ExtensionMode mode);
01377 
01379 };
01380 
01381 } // namespace Gdk
01382 
01383 } // namespace Inti
01384 
01385 #endif // INTI_GDK_WINDOW_H
01386 
Main Page - Footer


Generated on Sun Sep 14 20:08:05 2003 for Inti by doxygen 1.3.2 written by Dimitri van Heesch, © 1997-2002