15#include "functions_defs.h"
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) {
104 fprintf(
stderr,
"%s: unable to add titlebar button \"%s\"\n",
109 tb->width =
tb->image->width;
110 tb->height =
tb->image->height;
113 tb->dstx = (h -
tb->width + 1) / 2;
115 tb->srcx = -(
tb->dstx);
124 tb->dsty = (h -
tb->height + 1) / 2;
126 tb->srcy = -(
tb->dsty);
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
178 Scr->TBInfo.titlex = (
Scr->TBInfo.leftx
181 +
Scr->TitlePadding);
229 tbf->action = action;
230 tbf->menuroot = menuroot;
242 bool rightside,
bool append)
249 "%s: unable to allocate %lu bytes for title button\n",
257 Scr->TBInfo.nright++;
277 if((!
Scr->TBInfo.head) || ((!
append) && (!rightside))) {
281 else if(
append && rightside) {
283 for(
t =
Scr->TBInfo.head;
t->next;
t =
t->next) {
291 for(
t =
Scr->TBInfo.head;
t && !
t->rightside;
t =
t->next) {
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