mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-11 11:15:55 +01:00
changed indentation to use spaces only
This commit is contained in:
118
WINGs/wlabel.c
118
WINGs/wlabel.c
@@ -9,22 +9,22 @@
|
||||
typedef struct W_Label {
|
||||
W_Class widgetClass;
|
||||
W_View *view;
|
||||
|
||||
|
||||
char *caption;
|
||||
|
||||
WMColor *textColor;
|
||||
WMFont *font; /* if NULL, use default */
|
||||
|
||||
|
||||
W_Pixmap *image;
|
||||
|
||||
struct {
|
||||
WMReliefType relief:3;
|
||||
WMImagePosition imagePosition:4;
|
||||
WMAlignment alignment:2;
|
||||
|
||||
unsigned int noWrap:1;
|
||||
WMReliefType relief:3;
|
||||
WMImagePosition imagePosition:4;
|
||||
WMAlignment alignment:2;
|
||||
|
||||
unsigned int redrawPending:1;
|
||||
unsigned int noWrap:1;
|
||||
|
||||
unsigned int redrawPending:1;
|
||||
} flags;
|
||||
} Label;
|
||||
|
||||
@@ -47,23 +47,23 @@ WMLabel*
|
||||
WMCreateLabel(WMWidget *parent)
|
||||
{
|
||||
Label *lPtr;
|
||||
|
||||
|
||||
lPtr = wmalloc(sizeof(Label));
|
||||
memset(lPtr, 0, sizeof(Label));
|
||||
|
||||
lPtr->widgetClass = WC_Label;
|
||||
|
||||
|
||||
lPtr->view = W_CreateView(W_VIEW(parent));
|
||||
if (!lPtr->view) {
|
||||
wfree(lPtr);
|
||||
return NULL;
|
||||
wfree(lPtr);
|
||||
return NULL;
|
||||
}
|
||||
lPtr->view->self = lPtr;
|
||||
|
||||
|
||||
lPtr->textColor = WMRetainColor(lPtr->view->screen->black);
|
||||
|
||||
|
||||
WMCreateEventHandler(lPtr->view, ExposureMask|StructureNotifyMask,
|
||||
handleEvents, lPtr);
|
||||
handleEvents, lPtr);
|
||||
|
||||
W_ResizeView(lPtr->view, DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
lPtr->flags.alignment = DEFAULT_ALIGNMENT;
|
||||
@@ -78,16 +78,16 @@ WMCreateLabel(WMWidget *parent)
|
||||
void
|
||||
WMSetLabelImage(WMLabel *lPtr, WMPixmap *image)
|
||||
{
|
||||
if (lPtr->image!=NULL)
|
||||
WMReleasePixmap(lPtr->image);
|
||||
|
||||
if (lPtr->image!=NULL)
|
||||
WMReleasePixmap(lPtr->image);
|
||||
|
||||
if (image)
|
||||
lPtr->image = WMRetainPixmap(image);
|
||||
lPtr->image = WMRetainPixmap(image);
|
||||
else
|
||||
lPtr->image = NULL;
|
||||
lPtr->image = NULL;
|
||||
|
||||
if (lPtr->view->flags.realized) {
|
||||
paintLabel(lPtr);
|
||||
paintLabel(lPtr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,17 +111,17 @@ WMSetLabelImagePosition(WMLabel *lPtr, WMImagePosition position)
|
||||
{
|
||||
lPtr->flags.imagePosition = position;
|
||||
if (lPtr->view->flags.realized) {
|
||||
paintLabel(lPtr);
|
||||
paintLabel(lPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMSetLabelTextAlignment(WMLabel *lPtr, WMAlignment alignment)
|
||||
{
|
||||
lPtr->flags.alignment = alignment;
|
||||
if (lPtr->view->flags.realized) {
|
||||
paintLabel(lPtr);
|
||||
paintLabel(lPtr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ WMSetLabelRelief(WMLabel *lPtr, WMReliefType relief)
|
||||
{
|
||||
lPtr->flags.relief = relief;
|
||||
if (lPtr->view->flags.realized) {
|
||||
paintLabel(lPtr);
|
||||
paintLabel(lPtr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,15 +140,15 @@ void
|
||||
WMSetLabelText(WMLabel *lPtr, char *text)
|
||||
{
|
||||
if (lPtr->caption)
|
||||
wfree(lPtr->caption);
|
||||
|
||||
wfree(lPtr->caption);
|
||||
|
||||
if (text!=NULL) {
|
||||
lPtr->caption = wstrdup(text);
|
||||
lPtr->caption = wstrdup(text);
|
||||
} else {
|
||||
lPtr->caption = NULL;
|
||||
lPtr->caption = NULL;
|
||||
}
|
||||
if (lPtr->view->flags.realized) {
|
||||
paintLabel(lPtr);
|
||||
paintLabel(lPtr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,16 +162,16 @@ WMGetLabelFont(WMLabel *lPtr)
|
||||
|
||||
void
|
||||
WMSetLabelFont(WMLabel *lPtr, WMFont *font)
|
||||
{
|
||||
{
|
||||
if (lPtr->font!=NULL)
|
||||
WMReleaseFont(lPtr->font);
|
||||
WMReleaseFont(lPtr->font);
|
||||
if (font)
|
||||
lPtr->font = WMRetainFont(font);
|
||||
lPtr->font = WMRetainFont(font);
|
||||
else
|
||||
lPtr->font = NULL;
|
||||
lPtr->font = NULL;
|
||||
|
||||
if (lPtr->view->flags.realized) {
|
||||
paintLabel(lPtr);
|
||||
paintLabel(lPtr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,11 +180,11 @@ void
|
||||
WMSetLabelTextColor(WMLabel *lPtr, WMColor *color)
|
||||
{
|
||||
if (lPtr->textColor)
|
||||
WMReleaseColor(lPtr->textColor);
|
||||
WMReleaseColor(lPtr->textColor);
|
||||
lPtr->textColor = WMRetainColor(color);
|
||||
|
||||
if (lPtr->view->flags.realized) {
|
||||
paintLabel(lPtr);
|
||||
paintLabel(lPtr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,9 +194,9 @@ WMSetLabelWraps(WMLabel *lPtr, Bool flag)
|
||||
{
|
||||
flag = ((flag==0) ? 0 : 1);
|
||||
if (lPtr->flags.noWrap != !flag) {
|
||||
lPtr->flags.noWrap = !flag;
|
||||
if (lPtr->view->flags.realized)
|
||||
paintLabel(lPtr);
|
||||
lPtr->flags.noWrap = !flag;
|
||||
if (lPtr->view->flags.realized)
|
||||
paintLabel(lPtr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,10 +208,10 @@ paintLabel(Label *lPtr)
|
||||
|
||||
W_PaintTextAndImage(lPtr->view, !lPtr->flags.noWrap,
|
||||
lPtr->textColor ? lPtr->textColor : scrPtr->black,
|
||||
(lPtr->font!=NULL ? lPtr->font : scrPtr->normalFont),
|
||||
lPtr->flags.relief, lPtr->caption,
|
||||
lPtr->flags.alignment, lPtr->image,
|
||||
lPtr->flags.imagePosition, NULL, 0);
|
||||
(lPtr->font!=NULL ? lPtr->font : scrPtr->normalFont),
|
||||
lPtr->flags.relief, lPtr->caption,
|
||||
lPtr->flags.alignment, lPtr->image,
|
||||
lPtr->flags.imagePosition, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -225,15 +225,15 @@ handleEvents(XEvent *event, void *data)
|
||||
|
||||
|
||||
switch (event->type) {
|
||||
case Expose:
|
||||
if (event->xexpose.count!=0)
|
||||
break;
|
||||
paintLabel(lPtr);
|
||||
break;
|
||||
|
||||
case DestroyNotify:
|
||||
destroyLabel(lPtr);
|
||||
break;
|
||||
case Expose:
|
||||
if (event->xexpose.count!=0)
|
||||
break;
|
||||
paintLabel(lPtr);
|
||||
break;
|
||||
|
||||
case DestroyNotify:
|
||||
destroyLabel(lPtr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,16 +242,18 @@ static void
|
||||
destroyLabel(Label *lPtr)
|
||||
{
|
||||
if (lPtr->textColor)
|
||||
WMReleaseColor(lPtr->textColor);
|
||||
|
||||
WMReleaseColor(lPtr->textColor);
|
||||
|
||||
if (lPtr->caption)
|
||||
wfree(lPtr->caption);
|
||||
wfree(lPtr->caption);
|
||||
|
||||
if (lPtr->font)
|
||||
WMReleaseFont(lPtr->font);
|
||||
WMReleaseFont(lPtr->font);
|
||||
|
||||
if (lPtr->image)
|
||||
WMReleasePixmap(lPtr->image);
|
||||
WMReleasePixmap(lPtr->image);
|
||||
|
||||
wfree(lPtr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user