1 /** 2 * @file border.h 3 * @author Joe Wingbermuehle 4 * @date 2004-2006 5 * 6 * @brief Functions for handling window borders. 7 * 8 */ 9 10 #ifndef BORDER_H 11 #define BORDER_H 12 13 #include "gradient.h" 14 15 struct ClientNode; 16 struct ClientState; 17 18 /** Border icon types. */ 19 typedef unsigned char BorderIconType; 20 #define BI_CLOSE 0 21 #define BI_MAX 1 22 #define BI_MAX_ACTIVE 2 23 #define BI_MENU 3 24 #define BI_MIN 4 25 #define BI_COUNT 5 26 27 /** Flags to determine what action to take on the border. */ 28 typedef unsigned char BorderActionType; 29 #define BA_NONE 0 /**< Do nothing. */ 30 #define BA_RESIZE 1 /**< Resize the window. */ 31 #define BA_MOVE 2 /**< Move the window. */ 32 #define BA_CLOSE 3 /**< Close the window. */ 33 #define BA_MAXIMIZE 4 /**< Maximize the window. */ 34 #define BA_MINIMIZE 5 /**< Minimize the window. */ 35 #define BA_MENU 6 /**< Show the window menu. */ 36 #define BA_RESIZE_N 0x10 /**< Resize north. */ 37 #define BA_RESIZE_S 0x20 /**< Resize south. */ 38 #define BA_RESIZE_E 0x40 /**< Resize east. */ 39 #define BA_RESIZE_W 0x80 /**< Resize west. */ 40 41 /*@{*/ 42 void InitializeBorders(void); 43 void StartupBorders(void); 44 #define ShutdownBorders() (void)(0) 45 void DestroyBorders(void); 46 /*@}*/ 47 48 /** Determine the action to take for a client. 49 * @param np The client. 50 * @param x The x-coordinate of the mouse (frame relative). 51 * @param y The y-coordinate of the mouse (frame relative). 52 * @return The action to take. 53 */ 54 BorderActionType GetBorderActionType(const struct ClientNode *np, int x, int y); 55 56 /** Reset the shape of a window border. 57 * @param np The client. 58 */ 59 void ResetBorder(const struct ClientNode *np); 60 61 /** Draw a window border. 62 * @param np The client whose frame to draw. 63 */ 64 void DrawBorder(struct ClientNode *np); 65 66 /** Get the size of a border icon. 67 * @return The size in pixels (note that icons are square). 68 */ 69 int GetBorderIconSize(void); 70 71 /** Get the height of a window title bar. */ 72 unsigned GetTitleHeight(void); 73 74 /** Get the size of a window border. 75 * @param state The client state. 76 * @param north Pointer to the value to contain the north border size. 77 * @param south Pointer to the value to contain the south border size. 78 * @param east Pointer to the value to contain the east border size. 79 * @param west Pointer to the value to contain the west border size. 80 */ 81 void GetBorderSize(const struct ClientState *state, 82 int *north, int *south, int *east, int *west); 83 84 /** Redraw all borders on the current desktop. */ 85 void ExposeCurrentDesktop(void); 86 87 /** Draw a rounded rectangle. 88 * @param d The drawable on which to render. 89 * @param gc The graphics context. 90 * @param x The x-coodinate. 91 * @param y The y-coordinate. 92 * @param width The width. 93 * @param height The height. 94 * @param radius The corner radius. 95 */ 96 void DrawRoundedRectangle(Drawable d, GC gc, int x, int y, 97 int width, int height, int radius); 98 99 /** Set the icon to use for a border button. */ 100 void SetBorderIcon(BorderIconType t, const char *name); 101 102 #endif /* BORDER_H */ 103 104