mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +01:00
WINGs: add function to set the color of the frame title
This patch adds a function used to set the color of the frame title
This commit is contained in:
committed by
Carlos R. Mafra
parent
cb5076794a
commit
3b298e8964
@@ -1135,6 +1135,8 @@ void WMSetFrameRelief(WMFrame *fPtr, WMReliefType relief);
|
|||||||
|
|
||||||
void WMSetFrameTitle(WMFrame *fPtr, const char *title);
|
void WMSetFrameTitle(WMFrame *fPtr, const char *title);
|
||||||
|
|
||||||
|
void WMSetFrameTitleColor(WMFrame *fPtr, WMColor *color);
|
||||||
|
|
||||||
/* ---[ WINGs/wtextfield.c ]---------------------------------------------- */
|
/* ---[ WINGs/wtextfield.c ]---------------------------------------------- */
|
||||||
|
|
||||||
WMTextField* WMCreateTextField(WMWidget *parent);
|
WMTextField* WMCreateTextField(WMWidget *parent);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ typedef struct W_Frame {
|
|||||||
W_View *view;
|
W_View *view;
|
||||||
|
|
||||||
char *caption;
|
char *caption;
|
||||||
|
WMColor *textColor;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
WMReliefType relief:4;
|
WMReliefType relief:4;
|
||||||
@@ -186,7 +187,7 @@ static void paintFrame(Frame * fPtr)
|
|||||||
d = XCreatePixmap(display, view->window, tw, th, scrPtr->depth);
|
d = XCreatePixmap(display, view->window, tw, th, scrPtr->depth);
|
||||||
XFillRectangle(display, d, WMColorGC(view->backColor), 0, 0, tw, th);
|
XFillRectangle(display, d, WMColorGC(view->backColor), 0, 0, tw, th);
|
||||||
|
|
||||||
WMDrawString(scrPtr, d, scrPtr->black, font, 0, 0, fPtr->caption, tlen);
|
WMDrawString(scrPtr, d, fPtr->textColor ? fPtr->textColor : scrPtr->black, font, 0, 0, fPtr->caption, tlen);
|
||||||
XCopyArea(display, d, view->window, scrPtr->copyGC, 0, 0, tw, th, tx, ty);
|
XCopyArea(display, d, view->window, scrPtr->copyGC, 0, 0, tw, th, tx, ty);
|
||||||
XFreePixmap(display, d);
|
XFreePixmap(display, d);
|
||||||
} else {
|
} else {
|
||||||
@@ -213,6 +214,17 @@ static void handleEvents(XEvent * event, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WMSetFrameTitleColor(WMFrame *fPtr, WMColor *color)
|
||||||
|
{
|
||||||
|
if (fPtr->textColor)
|
||||||
|
WMReleaseColor(fPtr->textColor);
|
||||||
|
fPtr->textColor = WMRetainColor(color);
|
||||||
|
|
||||||
|
if (fPtr->view->flags.realized) {
|
||||||
|
repaintFrame(fPtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WMFrame *WMCreateFrame(WMWidget * parent)
|
WMFrame *WMCreateFrame(WMWidget * parent)
|
||||||
{
|
{
|
||||||
Frame *fPtr;
|
Frame *fPtr;
|
||||||
@@ -227,6 +239,7 @@ WMFrame *WMCreateFrame(WMWidget * parent)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
fPtr->view->self = fPtr;
|
fPtr->view->self = fPtr;
|
||||||
|
fPtr->textColor = WMRetainColor(fPtr->view->screen->black);
|
||||||
|
|
||||||
WMCreateEventHandler(fPtr->view, ExposureMask | StructureNotifyMask, handleEvents, fPtr);
|
WMCreateEventHandler(fPtr->view, ExposureMask | StructureNotifyMask, handleEvents, fPtr);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user