This patch adds a function used to set the color of the frame title.

---
 WINGs/WINGs/WINGs.h |  2 ++
 WINGs/wframe.c      | 15 ++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/WINGs/WINGs/WINGs.h b/WINGs/WINGs/WINGs.h
index 51252f5..6333750 100644
--- a/WINGs/WINGs/WINGs.h
+++ b/WINGs/WINGs/WINGs.h
@@ -1135,6 +1135,8 @@ void WMSetFrameRelief(WMFrame *fPtr, WMReliefType relief);

 void WMSetFrameTitle(WMFrame *fPtr, const char *title);

+void WMSetFrameTitleColor(WMFrame *fPtr, WMColor *color);
+
 /* ---[ WINGs/wtextfield.c ]---------------------------------------------- */

 WMTextField* WMCreateTextField(WMWidget *parent);
diff --git a/WINGs/wframe.c b/WINGs/wframe.c
index 336f839..ad2fc01 100644
--- a/WINGs/wframe.c
+++ b/WINGs/wframe.c
@@ -6,6 +6,7 @@ typedef struct W_Frame {
  W_View *view;

  char *caption;
+ WMColor *textColor;

  struct {
  WMReliefType relief:4;
@@ -186,7 +187,7 @@ static void paintFrame(Frame * fPtr)
  d = XCreatePixmap(display, view->window, tw, th, scrPtr->depth);
  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);
  XFreePixmap(display, d);
  } 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)
 {
  Frame *fPtr;
@@ -227,6 +239,7 @@ WMFrame *WMCreateFrame(WMWidget * parent)
  return NULL;
  }
  fPtr->view->self = fPtr;
+ fPtr->textColor = WMRetainColor(fPtr->view->screen->black);

  WMCreateEventHandler(fPtr->view, ExposureMask | StructureNotifyMask,
handleEvents, fPtr);

-- 
1.8.3.2

Attachment: 0001-WINGs-add-function-to-set-the-color-of-the-frame-tit.patch
Description: Binary data

Reply via email to