1 /* 2 * pwm/frame.h 3 * 4 * Copyright (c) Tuomo Valkonen 1999-2001. 5 * 6 * You may distribute and modify this program under the terms of either 7 * the Clarified Artistic License or the GNU GPL, version 2 or later. 8 */ 9 10 #ifndef INCLUDED_INCLUDED_FRAME_H 11 #define INCLUDED_INCLUDED_FRAME_H 12 13 #include "common.h" 14 #include "winobj.h" 15 16 17 #define WFRAME_HIDDEN WWINOBJ_HIDDEN 18 #define WFRAME_MAX_VERT 0x0001 19 #define WFRAME_MAX_HORIZ 0x0002 20 #define WFRAME_SHADE 0x0004 21 #define WFRAME_NO_BAR 0x0008 22 #define WFRAME_NO_BORDER 0x0010 23 24 #define WFRAME_NO_DECOR (WFRAME_NO_BAR|WFRAME_NO_BORDER) 25 #define WFRAME_MAX_BOTH (WFRAME_MAX_VERT|WFRAME_MAX_HORIZ) 26 27 #define WFRAME_IS_HIDDEN(F) WWINOBJ_IS_HIDDEN(F) 28 #define WFRAME_IS_NO_BAR(F) ((F)->flags&WFRAME_NO_BAR) 29 #define WFRAME_IS_NO_BORDER(F) ((F)->flags&WFRAME_NO_BORDER) 30 #define WFRAME_IS_SHADE(F) ((F)->flags&WFRAME_SHADE) 31 #define WFRAME_IS_NORMAL(F) (!WFRAME_IS_HIDDEN(F) && !WFRAME_IS_SHADE(F)) 32 33 #define BAR_X(FRAME) ((FRAME)->x) 34 #define BAR_Y(FRAME) ((FRAME)->y) 35 #define BAR_W(FRAME) ((FRAME)->bar_w) 36 #define BAR_H(FRAME) ((FRAME)->bar_h) 37 #define FRAME_X(FRAME) ((FRAME)->x) 38 #define FRAME_Y(FRAME) ((FRAME)->y+(FRAME)->bar_h) 39 #define FRAME_W(FRAME) ((FRAME)->w) 40 #define FRAME_H(FRAME) ((FRAME)->h-(FRAME)->bar_h) 41 42 #define FRAME_MAXW_UNSET(FRAME) ((FRAME)->max_w<=0) 43 #define FRAME_MAXH_UNSET(FRAME) ((FRAME)->max_h<=0) 44 45 #define FRAME_CWIN_LIST(FRAME) ((WClientWin*)((FRAME)->t_children)) 46 47 48 /* */ 49 50 51 struct _WClientWin; 52 struct _WScreen; 53 54 typedef struct _WFrame{ 55 INHERIT_WWINOBJ; 56 57 int frame_id; 58 59 /* Internal (client window) width and height and */ 60 /* X and Y indent of client window within frame window */ 61 int frame_iw, frame_ih, frame_ix, frame_iy; 62 63 /* Bar height and width */ 64 int bar_w, bar_h, tab_w; 65 66 Window frame_win, bar_win; 67 68 int min_h, min_w; 69 int max_h, max_w; 70 71 int saved_iw, saved_ih; 72 int saved_x, saved_y; 73 74 int cwin_count; 75 struct _WClientWin *current_cwin; 76 } WFrame; 77 78 79 /* */ 80 81 82 extern WFrame *create_frame(int x, int y, int iw, int ih, int id, int flags); 83 extern WFrame *create_add_frame_simple(int x, int y, int iiw, int iih); 84 85 extern void destroy_frame(WFrame *frame); 86 87 extern bool frame_attach_clientwin(WFrame *frame, struct _WClientWin *cwin); 88 extern void frame_detach_clientwin(WFrame *frame, struct _WClientWin *cwin, 89 int x, int y); 90 extern void frame_attach_tagged(WFrame *frame); 91 extern void join_tagged(); 92 93 extern void frame_switch_clientwin(WFrame *frame, struct _WClientWin *cwin); 94 extern void frame_switch_nth(WFrame *frame, int cwinnum); 95 extern void frame_switch_rot(WFrame *frame, int rotcnt); 96 97 extern void activate_frame(WFrame *frame); 98 extern void deactivate_frame(WFrame *frame); 99 100 extern void set_frame_size(WFrame *frame, int w, int h); 101 extern void set_frame_pos(WFrame *frame, int x, int y); 102 extern void set_frame_state(WFrame *frame, int stateflags); 103 extern void frame_clientwin_resize(WFrame *frame, struct _WClientWin *cwin, 104 int w, int h, bool dmax); 105 106 extern void frame_toggle_shade(WFrame *frame); 107 extern void frame_toggle_sticky(WFrame *frame); 108 extern void frame_toggle_maximize(WFrame *frame, int mask); 109 110 extern void frame_recalc_bar(WFrame *frame); 111 extern void frame_recalc_minmax(WFrame *frame); 112 113 extern void clientwin_to_frame_size(int iw, int ih, int flags, 114 int *fw, int *fh); 115 116 extern void frame_set_decor(WFrame *frame, int decorflags); 117 extern void frame_toggle_decor(WFrame *frame); 118 119 #endif /* INCLUDED_FRAME_H */ 120