mutter/src/frames.h

161 lines
4.8 KiB
C
Raw Normal View History

2001-06-12 00:38:24 -04:00
/* Metacity window frame manager widget */
/*
* Copyright (C) 2001 Havoc Pennington
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef META_FRAMES_H
#define META_FRAMES_H
#include <gtk/gtk.h>
2001-06-15 00:33:21 -04:00
#include <gdk/gdkx.h>
2001-06-17 23:24:25 -04:00
#include "common.h"
typedef enum
{
META_FRAME_CONTROL_NONE,
META_FRAME_CONTROL_TITLE,
META_FRAME_CONTROL_DELETE,
META_FRAME_CONTROL_MENU,
META_FRAME_CONTROL_MINIMIZE,
META_FRAME_CONTROL_MAXIMIZE,
META_FRAME_CONTROL_RESIZE_SE,
META_FRAME_CONTROL_RESIZE_S,
META_FRAME_CONTROL_RESIZE_SW,
META_FRAME_CONTROL_RESIZE_N,
META_FRAME_CONTROL_RESIZE_NE,
META_FRAME_CONTROL_RESIZE_NW,
META_FRAME_CONTROL_RESIZE_W,
META_FRAME_CONTROL_RESIZE_E
} MetaFrameControl;
2001-06-12 00:38:24 -04:00
2001-06-20 00:29:28 -04:00
typedef enum
{
META_FRAME_STATUS_NORMAL,
2001-06-20 23:40:14 -04:00
META_FRAME_STATUS_MOVING,
META_FRAME_STATUS_CLICKING_MINIMIZE,
META_FRAME_STATUS_CLICKING_MAXIMIZE,
META_FRAME_STATUS_CLICKING_DELETE,
META_FRAME_STATUS_CLICKING_MENU,
2001-06-30 19:17:52 -04:00
META_FRAME_STATUS_RESIZING_SE,
META_FRAME_STATUS_RESIZING_S,
META_FRAME_STATUS_RESIZING_SW,
META_FRAME_STATUS_RESIZING_N,
META_FRAME_STATUS_RESIZING_NE,
META_FRAME_STATUS_RESIZING_NW,
META_FRAME_STATUS_RESIZING_W,
META_FRAME_STATUS_RESIZING_E
2001-06-20 00:29:28 -04:00
} MetaFrameStatus;
2001-06-12 00:38:24 -04:00
/* This is one widget that manages all the window frames
* as subwindows.
*/
#define META_TYPE_FRAMES (meta_frames_get_type ())
2001-06-18 02:11:53 -04:00
#define META_FRAMES(obj) (GTK_CHECK_CAST ((obj), META_TYPE_FRAMES, MetaFrames))
#define META_FRAMES_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), META_TYPE_FRAMES, MetaFramesClass))
#define META_IS_FRAMES(obj) (GTK_CHECK_TYPE ((obj), META_TYPE_FRAMES))
#define META_IS_FRAMES_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), META_TYPE_FRAMES))
#define META_FRAMES_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), META_TYPE_FRAMES, MetaFramesClass))
2001-06-12 00:38:24 -04:00
typedef struct _MetaFrames MetaFrames;
typedef struct _MetaFramesClass MetaFramesClass;
2001-06-18 02:11:53 -04:00
typedef struct _MetaUIFrame MetaUIFrame;
2001-06-15 00:33:21 -04:00
typedef struct _MetaFrameProperties MetaFrameProperties;
2001-06-20 23:40:14 -04:00
struct _MetaUIFrame
{
Window xwindow;
GdkWindow *window;
PangoLayout *layout;
};
2001-06-12 00:38:24 -04:00
struct _MetaFrames
{
GtkWindow parent_instance;
2001-06-15 00:33:21 -04:00
/* If we did a widget per frame, we wouldn't want to cache this. */
MetaFrameProperties *props;
int text_height;
GHashTable *frames;
2001-06-30 19:17:52 -04:00
guint tooltip_timeout;
MetaUIFrame *last_motion_frame;
2001-07-02 21:45:43 -04:00
GdkCursor *south_resize_cursor;
GdkCursor *west_resize_cursor;
GdkCursor *east_resize_cursor;
GdkCursor *se_resize_cursor;
GdkCursor *sw_resize_cursor;
GdkCursor *current_cursor;
2001-06-20 00:29:28 -04:00
/* The below is all for grabs */
MetaFrameStatus grab_status;
MetaUIFrame *grab_frame;
/* initial mouse position for drags */
int start_root_x, start_root_y;
2001-06-30 19:17:52 -04:00
/* initial window position for drags */
2001-06-20 00:29:28 -04:00
int start_window_x, start_window_y;
2001-06-30 19:17:52 -04:00
/* initial window size for drags */
int start_window_w, start_window_h;
2001-06-20 00:29:28 -04:00
/* button doing the dragging */
int start_button;
2001-06-12 00:38:24 -04:00
};
struct _MetaFramesClass
{
GtkWindowClass parent_class;
};
GType meta_frames_get_type (void) G_GNUC_CONST;
MetaFrames *meta_frames_new (void);
void meta_frames_manage_window (MetaFrames *frames,
2001-06-15 00:33:21 -04:00
Window xwindow);
void meta_frames_unmanage_window (MetaFrames *frames,
Window xwindow);
void meta_frames_set_title (MetaFrames *frames,
Window xwindow,
const char *title);
2001-06-12 00:38:24 -04:00
2001-06-17 23:24:25 -04:00
void meta_frames_get_geometry (MetaFrames *frames,
Window xwindow,
int *top_height, int *bottom_height,
int *left_width, int *right_width);
void meta_frames_reset_bg (MetaFrames *frames,
Window xwindow);
void meta_frames_queue_draw (MetaFrames *frames,
Window xwindow);
2001-06-21 02:08:35 -04:00
void meta_frames_get_pixmap_for_control (MetaFrames *frames,
MetaFrameControl control,
GdkPixmap **pixmap,
GdkBitmap **mask);
2001-06-23 01:49:35 -04:00
2001-06-21 02:08:35 -04:00
void meta_frames_notify_menu_hide (MetaFrames *frames);
2001-06-12 00:38:24 -04:00
#endif