frames.h

Go to the documentation of this file.
00001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
00002 
00003 /* Metacity window frame manager widget */
00004 
00005 /* 
00006  * Copyright (C) 2001 Havoc Pennington
00007  * 
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License as
00010  * published by the Free Software Foundation; either version 2 of the
00011  * License, or (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * General Public License for more details.
00017  * 
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00021  * 02111-1307, USA.
00022  */
00023 
00024 #ifndef META_FRAMES_H
00025 #define META_FRAMES_H
00026 
00027 #include <gtk/gtk.h>
00028 #include <gdk/gdkx.h>
00029 #include "common.h"
00030 #include "theme.h"
00031 
00032 typedef enum
00033 {
00034   META_FRAME_CONTROL_NONE,
00035   META_FRAME_CONTROL_TITLE,
00036   META_FRAME_CONTROL_DELETE,
00037   META_FRAME_CONTROL_MENU,
00038   META_FRAME_CONTROL_MINIMIZE,
00039   META_FRAME_CONTROL_MAXIMIZE,
00040   META_FRAME_CONTROL_UNMAXIMIZE,
00041   META_FRAME_CONTROL_SHADE,
00042   META_FRAME_CONTROL_UNSHADE,
00043   META_FRAME_CONTROL_ABOVE,
00044   META_FRAME_CONTROL_UNABOVE,
00045   META_FRAME_CONTROL_STICK,
00046   META_FRAME_CONTROL_UNSTICK,
00047   META_FRAME_CONTROL_RESIZE_SE,
00048   META_FRAME_CONTROL_RESIZE_S,
00049   META_FRAME_CONTROL_RESIZE_SW,
00050   META_FRAME_CONTROL_RESIZE_N,
00051   META_FRAME_CONTROL_RESIZE_NE,
00052   META_FRAME_CONTROL_RESIZE_NW,
00053   META_FRAME_CONTROL_RESIZE_W,
00054   META_FRAME_CONTROL_RESIZE_E,
00055   META_FRAME_CONTROL_CLIENT_AREA
00056 } MetaFrameControl;
00057 
00058 /* This is one widget that manages all the window frames
00059  * as subwindows.
00060  */
00061 
00062 #define META_TYPE_FRAMES            (meta_frames_get_type ())
00063 #define META_FRAMES(obj)            (GTK_CHECK_CAST ((obj), META_TYPE_FRAMES, MetaFrames))
00064 #define META_FRAMES_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), META_TYPE_FRAMES, MetaFramesClass))
00065 #define META_IS_FRAMES(obj)         (GTK_CHECK_TYPE ((obj), META_TYPE_FRAMES))
00066 #define META_IS_FRAMES_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), META_TYPE_FRAMES))
00067 #define META_FRAMES_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS ((obj), META_TYPE_FRAMES, MetaFramesClass))
00068 
00069 typedef struct _MetaFrames        MetaFrames;
00070 typedef struct _MetaFramesClass   MetaFramesClass;
00071 
00072 typedef struct _MetaUIFrame         MetaUIFrame;
00073 
00074 struct _MetaUIFrame
00075 {
00076   Window xwindow;
00077   GdkWindow *window;
00078   MetaFrameStyle *cache_style;
00079   PangoLayout *layout;
00080   int text_height;
00081   char *title; /* NULL once we have a layout */
00082   guint expose_delayed : 1;
00083   guint shape_applied : 1;
00084   
00085   /* FIXME get rid of this, it can just be in the MetaFrames struct */
00086   MetaFrameControl prelit_control;
00087 };
00088 
00089 struct _MetaFrames
00090 {
00091   GtkWindow parent_instance;
00092   
00093   GHashTable *text_heights;
00094 
00095   GHashTable *frames;
00096 
00097   guint tooltip_timeout;
00098   MetaUIFrame *last_motion_frame;
00099 
00100   int expose_delay_count;
00101 
00102   int invalidate_cache_timeout_id;
00103   GList *invalidate_frames;
00104   GHashTable *cache;
00105 };
00106 
00107 struct _MetaFramesClass
00108 {
00109   GtkWindowClass parent_class;
00110 
00111 };
00112 
00113 GType        meta_frames_get_type               (void) G_GNUC_CONST;
00114 
00115 MetaFrames *meta_frames_new (int screen_number);
00116 
00117 void meta_frames_manage_window (MetaFrames *frames,
00118                                 Window      xwindow,
00119                                 GdkWindow  *window);
00120 void meta_frames_unmanage_window (MetaFrames *frames,
00121                                   Window      xwindow);
00122 void meta_frames_set_title (MetaFrames *frames,
00123                             Window      xwindow,
00124                             const char *title);
00125 
00126 void meta_frames_repaint_frame (MetaFrames *frames,
00127                                 Window      xwindow);
00128 
00129 void meta_frames_get_geometry (MetaFrames *frames,
00130                                Window xwindow,
00131                                int *top_height, int *bottom_height,
00132                                int *left_width, int *right_width);
00133 
00134 void meta_frames_reset_bg     (MetaFrames *frames,
00135                                Window      xwindow);
00136 void meta_frames_unflicker_bg (MetaFrames *frames,
00137                                Window      xwindow,
00138                                int         target_width,
00139                                int         target_height);
00140 
00141 void meta_frames_apply_shapes (MetaFrames *frames,
00142                                Window      xwindow,
00143                                int         new_window_width,
00144                                int         new_window_height,
00145                                gboolean    window_has_shape);
00146 void meta_frames_move_resize_frame (MetaFrames *frames,
00147                                     Window      xwindow,
00148                                     int         x,
00149                                     int         y,
00150                                     int         width,
00151                                     int         height);
00152 void meta_frames_queue_draw (MetaFrames *frames,
00153                              Window      xwindow);
00154 
00155 void meta_frames_notify_menu_hide (MetaFrames *frames);
00156 
00157 Window meta_frames_get_moving_frame (MetaFrames *frames);
00158 
00159 void meta_frames_push_delay_exposes (MetaFrames *frames);
00160 void meta_frames_pop_delay_exposes  (MetaFrames *frames);
00161 
00162 #endif

Generated on Sat Aug 23 22:04:18 2008 for metacity by  doxygen 1.5.5