15#include "functions_defs.h"
49 Scr->TBInfo.width = (
Scr->TitleHeight -
50 2 * (
Scr->FramePadding +
Scr->ButtonIndent));
52 Scr->TBInfo.pad = ((
Scr->TitlePadding > 1)
53 ? ((
Scr->TitlePadding + 1) / 2) : 0);
55 Scr->TBInfo.pad = ((
Scr->TitlePadding > 1)
56 ? ((
Scr->TitlePadding + 1) / 2) : 1);
57 h =
Scr->TBInfo.width - 2 *
Scr->TBInfo.border;
63 if(!
Scr->NoDefaults) {
65#define MKBTN(bmap, func, isrt) \
66 CreateTitleButton(TBPM_##bmap, F_##func, "", NULL, \
70 if(
Scr->use3Dtitles) {
71 MKBTN(3DDOT, ICONIFY,
false);
72 MKBTN(3DRESIZE, RESIZE,
true);
75 MKBTN(ICONIFY, ICONIFY,
false);
76 MKBTN(RESIZE, RESIZE,
true);
92 for(tb =
Scr->TBInfo.head; tb; tb = tb->
next) {
104 fprintf(stderr,
"%s: unable to add titlebar button \"%s\"\n",
146 int buttonwidth = (
Scr->TBInfo.width +
Scr->TBInfo.pad);
149 Scr->TBInfo.leftx =
Scr->TBInfo.rightoff =
Scr->FramePadding;
155 if(
Scr->TBInfo.nleft > 0) {
156 Scr->TBInfo.leftx +=
Scr->ButtonIndent;
168 if(
Scr->TBInfo.nright > 0) {
169 Scr->TBInfo.rightoff += (
Scr->ButtonIndent
170 + (
Scr->TBInfo.nright * buttonwidth)
178 Scr->TBInfo.titlex = (
Scr->TBInfo.leftx
179 + (
Scr->TBInfo.nleft * buttonwidth)
181 +
Scr->TitlePadding);
209 fprintf(stderr,
"%s: can't find titlebutton\n",
ProgramName);
212 for(tbf =
cur_tb->funs; tbf; tbf = tbf->
next) {
213 if(tbf->
num == button && tbf->
mods == nmods) {
220 fprintf(stderr,
"%s: out of memory\n",
ProgramName);
242 bool rightside,
bool append)
249 "%s: unable to allocate %lu bytes for title button\n",
255 cur_tb->rightside = rightside;
257 Scr->TBInfo.nright++;
277 if((!
Scr->TBInfo.head) || ((!append) && (!rightside))) {
281 else if(append && rightside) {
Image * GetImage(const char *name, ColorPair cp)
static void ComputeCommonTitleOffsets(void)
bool CreateTitleButton(char *name, int func, char *action, MenuRoot *menuroot, bool rightside, bool append)
void InitTitlebarButtons(void)
#define MKBTN(bmap, func, isrt)
void SetCurrentTBAction(int button, int nmods, int func, char *action, MenuRoot *menuroot)
static TitleButton * cur_tb