mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-18 20:10:29 +01:00
WINGs: add functions to set widget background image
With this patch we can set widget background image. As now, only background color was available.
This commit is contained in:
committed by
Carlos R. Mafra
parent
47ac986b53
commit
c10469264d
@@ -930,6 +930,10 @@ void WMSetWidgetBackgroundColor(WMWidget *w, WMColor *color);
|
|||||||
|
|
||||||
WMColor* WMGetWidgetBackgroundColor(WMWidget *w);
|
WMColor* WMGetWidgetBackgroundColor(WMWidget *w);
|
||||||
|
|
||||||
|
void WMSetWidgetBackgroundPixmap(WMWidget *w, WMPixmap *pix);
|
||||||
|
|
||||||
|
WMPixmap *WMGetWidgetBackgroundPixmap(WMWidget *w);
|
||||||
|
|
||||||
void WMMapSubwidgets(WMWidget *w);
|
void WMMapSubwidgets(WMWidget *w);
|
||||||
|
|
||||||
void WMUnmapSubwidgets(WMWidget *w);
|
void WMUnmapSubwidgets(WMWidget *w);
|
||||||
|
|||||||
@@ -572,6 +572,8 @@ struct W_View {
|
|||||||
void *hangedData; /* data holder for user program */
|
void *hangedData; /* data holder for user program */
|
||||||
|
|
||||||
WMColor *backColor;
|
WMColor *backColor;
|
||||||
|
WMPixmap *backImage;
|
||||||
|
|
||||||
|
|
||||||
Cursor cursor;
|
Cursor cursor;
|
||||||
|
|
||||||
@@ -664,6 +666,8 @@ void W_ResizeView(W_View *view, unsigned int width, unsigned int height);
|
|||||||
|
|
||||||
void W_SetViewBackgroundColor(W_View *view, WMColor *color);
|
void W_SetViewBackgroundColor(W_View *view, WMColor *color);
|
||||||
|
|
||||||
|
void W_SetViewBackgroundPixmap(W_View *view, WMPixmap *pix);
|
||||||
|
|
||||||
void W_SetViewCursor(W_View *view, Cursor cursor);
|
void W_SetViewCursor(W_View *view, Cursor cursor);
|
||||||
|
|
||||||
void W_SetFocusOfTopLevel(W_View *toplevel, W_View *view);
|
void W_SetFocusOfTopLevel(W_View *toplevel, W_View *view);
|
||||||
|
|||||||
@@ -960,6 +960,21 @@ WMColor *WMGetWidgetBackgroundColor(WMWidget * w)
|
|||||||
return W_VIEW(w)->backColor;
|
return W_VIEW(w)->backColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WMSetWidgetBackgroundPixmap(WMWidget *w, WMPixmap *pix)
|
||||||
|
{
|
||||||
|
if (!pix)
|
||||||
|
return;
|
||||||
|
|
||||||
|
W_SetViewBackgroundPixmap(W_VIEW(w), pix);
|
||||||
|
if (W_VIEW(w)->flags.mapped)
|
||||||
|
WMRedisplayWidget(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
WMPixmap *WMGetWidgetBackgroundPixmap(WMWidget *w)
|
||||||
|
{
|
||||||
|
return W_VIEW(w)->backImage;
|
||||||
|
}
|
||||||
|
|
||||||
void WMRaiseWidget(WMWidget * w)
|
void WMRaiseWidget(WMWidget * w)
|
||||||
{
|
{
|
||||||
W_RaiseView(W_VIEW(w));
|
W_RaiseView(W_VIEW(w));
|
||||||
|
|||||||
@@ -220,12 +220,20 @@ W_PaintTextAndImage(W_View * view, int wrap, WMColor * textColor, W_Font * font,
|
|||||||
XFillRectangle(screen->display, d, WMColorGC(backColor),
|
XFillRectangle(screen->display, d, WMColorGC(backColor),
|
||||||
0, 0, view->size.width, view->size.height);
|
0, 0, view->size.width, view->size.height);
|
||||||
} else {
|
} else {
|
||||||
|
if (view->attribs.background_pixmap) {
|
||||||
#ifndef DOUBLE_BUFFER
|
#ifndef DOUBLE_BUFFER
|
||||||
XClearWindow(screen->display, d);
|
XClearWindow(screen->display, d);
|
||||||
#else
|
#else
|
||||||
XSetForeground(screen->display, screen->copyGC, view->attribs.background_pixel);
|
XCopyArea(screen->display, view->attribs.background_pixmap, d, screen->copyGC, 0, 0, view->size.width, view->size.height, 0, 0);
|
||||||
XFillRectangle(screen->display, d, screen->copyGC, 0, 0, view->size.width, view->size.height);
|
|
||||||
#endif
|
#endif
|
||||||
|
} else {
|
||||||
|
#ifndef DOUBLE_BUFFER
|
||||||
|
XClearWindow(screen->display, d);
|
||||||
|
#else
|
||||||
|
XSetForeground(screen->display, screen->copyGC, view->attribs.background_pixel);
|
||||||
|
XFillRectangle(screen->display, d, screen->copyGC, 0, 0, view->size.width, view->size.height);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (relief == WRFlat) {
|
if (relief == WRFlat) {
|
||||||
|
|||||||
@@ -100,7 +100,8 @@ static W_View *createView(W_Screen * screen, W_View * parent)
|
|||||||
view->attribFlags = CWEventMask | CWBitGravity;
|
view->attribFlags = CWEventMask | CWBitGravity;
|
||||||
view->attribs = defAtts;
|
view->attribs = defAtts;
|
||||||
|
|
||||||
view->attribFlags |= CWBackPixel | CWColormap | CWBorderPixel;
|
view->attribFlags |= CWBackPixel | CWColormap | CWBorderPixel | CWBackPixmap;
|
||||||
|
view->attribs.background_pixmap = None;
|
||||||
view->attribs.background_pixel = W_PIXEL(screen->gray);
|
view->attribs.background_pixel = W_PIXEL(screen->gray);
|
||||||
view->attribs.border_pixel = W_PIXEL(screen->black);
|
view->attribs.border_pixel = W_PIXEL(screen->black);
|
||||||
view->attribs.colormap = screen->colormap;
|
view->attribs.colormap = screen->colormap;
|
||||||
@@ -496,6 +497,20 @@ void W_SetViewBackgroundColor(W_View * view, WMColor * color)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void W_SetViewBackgroundPixmap(W_View *view, WMPixmap *pix)
|
||||||
|
{
|
||||||
|
if (view->backImage)
|
||||||
|
WMReleasePixmap(view->backImage);
|
||||||
|
view->backImage = WMRetainPixmap(pix);
|
||||||
|
|
||||||
|
view->attribFlags |= CWBackPixmap;
|
||||||
|
view->attribs.background_pixmap = pix->pixmap;
|
||||||
|
if (view->flags.realized) {
|
||||||
|
XSetWindowBackgroundPixmap(view->screen->display, view->window, pix->pixmap);
|
||||||
|
XClearWindow(view->screen->display, view->window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void W_SetViewCursor(W_View * view, Cursor cursor)
|
void W_SetViewCursor(W_View * view, Cursor cursor)
|
||||||
{
|
{
|
||||||
view->cursor = cursor;
|
view->cursor = cursor;
|
||||||
|
|||||||
Reference in New Issue
Block a user