mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-18 20:10:29 +01:00
WINGs: Added 'const' attribute to functions in wbutton, wframe, wlabel, wlist, wwindow
This makes both the API and local function const-correct on their input parameters.
This commit is contained in:
committed by
Carlos R. Mafra
parent
e7c8ac76ea
commit
c89e8df33f
@@ -951,20 +951,20 @@ void WMSetBalloonEnabled(WMScreen *scr, Bool flag);
|
||||
|
||||
/* ---[ WINGs/wwindow.c ]------------------------------------------------- */
|
||||
|
||||
WMWindow* WMCreateWindow(WMScreen *screen, char *name);
|
||||
WMWindow* WMCreateWindow(WMScreen *screen, const char *name);
|
||||
|
||||
WMWindow* WMCreateWindowWithStyle(WMScreen *screen, char *name, int style);
|
||||
WMWindow* WMCreateWindowWithStyle(WMScreen *screen, const char *name, int style);
|
||||
|
||||
WMWindow* WMCreatePanelWithStyleForWindow(WMWindow *owner, char *name,
|
||||
WMWindow* WMCreatePanelWithStyleForWindow(WMWindow *owner, const char *name,
|
||||
int style);
|
||||
|
||||
WMWindow* WMCreatePanelForWindow(WMWindow *owner, char *name);
|
||||
WMWindow* WMCreatePanelForWindow(WMWindow *owner, const char *name);
|
||||
|
||||
void WMChangePanelOwner(WMWindow *win, WMWindow *newOwner);
|
||||
|
||||
void WMSetWindowTitle(WMWindow *wPtr, char *title);
|
||||
void WMSetWindowTitle(WMWindow *wPtr, const char *title);
|
||||
|
||||
void WMSetWindowMiniwindowTitle(WMWindow *win, char *title);
|
||||
void WMSetWindowMiniwindowTitle(WMWindow *win, const char *title);
|
||||
|
||||
void WMSetWindowMiniwindowImage(WMWindow *win, RImage *image);
|
||||
|
||||
@@ -1025,9 +1025,9 @@ void WMSetButtonFont(WMButton *bPtr, WMFont *font);
|
||||
|
||||
void WMSetButtonTextAlignment(WMButton *bPtr, WMAlignment alignment);
|
||||
|
||||
void WMSetButtonText(WMButton *bPtr, char *text);
|
||||
void WMSetButtonText(WMButton *bPtr, const char *text);
|
||||
|
||||
void WMSetButtonAltText(WMButton *bPtr, char *text);
|
||||
void WMSetButtonAltText(WMButton *bPtr, const char *text);
|
||||
|
||||
void WMSetButtonTextColor(WMButton *bPtr, WMColor *color);
|
||||
|
||||
@@ -1075,7 +1075,7 @@ void WMSetLabelTextAlignment(WMLabel *lPtr, WMAlignment alignment);
|
||||
|
||||
void WMSetLabelRelief(WMLabel *lPtr, WMReliefType relief);
|
||||
|
||||
void WMSetLabelText(WMLabel *lPtr, char *text);
|
||||
void WMSetLabelText(WMLabel *lPtr, const char *text);
|
||||
|
||||
WMFont* WMGetLabelFont(WMLabel *lPtr);
|
||||
|
||||
@@ -1091,7 +1091,7 @@ void WMSetFrameTitlePosition(WMFrame *fPtr, WMTitlePosition position);
|
||||
|
||||
void WMSetFrameRelief(WMFrame *fPtr, WMReliefType relief);
|
||||
|
||||
void WMSetFrameTitle(WMFrame *fPtr, char *title);
|
||||
void WMSetFrameTitle(WMFrame *fPtr, const char *title);
|
||||
|
||||
/* ---[ WINGs/wtextfield.c ]---------------------------------------------- */
|
||||
|
||||
@@ -1170,13 +1170,13 @@ void WMSetListAllowEmptySelection(WMList *lPtr, Bool flag);
|
||||
|
||||
#define WMAddListItem(lPtr, text) WMInsertListItem((lPtr), -1, (text))
|
||||
|
||||
WMListItem* WMInsertListItem(WMList *lPtr, int row, char *text);
|
||||
WMListItem* WMInsertListItem(WMList *lPtr, int row, const char *text);
|
||||
|
||||
void WMSortListItems(WMList *lPtr);
|
||||
|
||||
void WMSortListItemsWithComparer(WMList *lPtr, WMCompareDataProc *func);
|
||||
|
||||
int WMFindRowOfListItemWithTitle(WMList *lPtr, char *title);
|
||||
int WMFindRowOfListItemWithTitle(WMList *lPtr, const char *title);
|
||||
|
||||
WMListItem* WMGetListItem(WMList *lPtr, int row);
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@ void WMSetButtonTextAlignment(WMButton * bPtr, WMAlignment alignment)
|
||||
}
|
||||
}
|
||||
|
||||
void WMSetButtonText(WMButton * bPtr, char *text)
|
||||
void WMSetButtonText(WMButton * bPtr, const char *text)
|
||||
{
|
||||
if (bPtr->caption)
|
||||
wfree(bPtr->caption);
|
||||
@@ -325,7 +325,7 @@ void WMSetButtonText(WMButton * bPtr, char *text)
|
||||
}
|
||||
}
|
||||
|
||||
void WMSetButtonAltText(WMButton * bPtr, char *text)
|
||||
void WMSetButtonAltText(WMButton * bPtr, const char *text)
|
||||
{
|
||||
if (bPtr->altCaption)
|
||||
wfree(bPtr->altCaption);
|
||||
|
||||
@@ -40,7 +40,7 @@ void WMSetFrameRelief(WMFrame * fPtr, WMReliefType relief)
|
||||
}
|
||||
}
|
||||
|
||||
void WMSetFrameTitle(WMFrame * fPtr, char *title)
|
||||
void WMSetFrameTitle(WMFrame * fPtr, const char *title)
|
||||
{
|
||||
if (fPtr->caption)
|
||||
wfree(fPtr->caption);
|
||||
|
||||
@@ -111,7 +111,7 @@ void WMSetLabelRelief(WMLabel * lPtr, WMReliefType relief)
|
||||
}
|
||||
}
|
||||
|
||||
void WMSetLabelText(WMLabel * lPtr, char *text)
|
||||
void WMSetLabelText(WMLabel * lPtr, const char *text)
|
||||
{
|
||||
if (lPtr->caption)
|
||||
wfree(lPtr->caption);
|
||||
|
||||
@@ -179,7 +179,7 @@ void WMSortListItemsWithComparer(WMList * lPtr, WMCompareDataProc * func)
|
||||
paintList(lPtr);
|
||||
}
|
||||
|
||||
WMListItem *WMInsertListItem(WMList * lPtr, int row, char *text)
|
||||
WMListItem *WMInsertListItem(WMList * lPtr, int row, const char *text)
|
||||
{
|
||||
WMListItem *item;
|
||||
|
||||
@@ -635,12 +635,18 @@ static void handleEvents(XEvent * event, void *data)
|
||||
|
||||
static int matchTitle(const void *item, const void *title)
|
||||
{
|
||||
return (strcmp(((WMListItem *) item)->text, (char *)title) == 0 ? 1 : 0);
|
||||
return (strcmp(((WMListItem *) item)->text, (const char *)title) == 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
int WMFindRowOfListItemWithTitle(WMList * lPtr, char *title)
|
||||
int WMFindRowOfListItemWithTitle(WMList * lPtr, const char *title)
|
||||
{
|
||||
return WMFindInArray(lPtr->items, matchTitle, title);
|
||||
/*
|
||||
* We explicitely discard the 'const' attribute here because the
|
||||
* call-back function handler must not be made with a const
|
||||
* attribute, but our local call-back function (above) does have
|
||||
* it properly set, so we're consistent
|
||||
*/
|
||||
return WMFindInArray(lPtr->items, matchTitle, (char *) title);
|
||||
}
|
||||
|
||||
void WMSelectListItem(WMList * lPtr, int row)
|
||||
|
||||
@@ -98,7 +98,7 @@ static void realizeObserver(void *self, WMNotification * not)
|
||||
realizeWindow(self);
|
||||
}
|
||||
|
||||
WMWindow *WMCreatePanelWithStyleForWindow(WMWindow * owner, char *name, int style)
|
||||
WMWindow *WMCreatePanelWithStyleForWindow(WMWindow * owner, const char *name, int style)
|
||||
{
|
||||
WMWindow *win;
|
||||
|
||||
@@ -108,7 +108,7 @@ WMWindow *WMCreatePanelWithStyleForWindow(WMWindow * owner, char *name, int styl
|
||||
return win;
|
||||
}
|
||||
|
||||
WMWindow *WMCreatePanelForWindow(WMWindow * owner, char *name)
|
||||
WMWindow *WMCreatePanelForWindow(WMWindow * owner, const char *name)
|
||||
{
|
||||
return WMCreatePanelWithStyleForWindow(owner, name,
|
||||
WMTitledWindowMask | WMClosableWindowMask | WMResizableWindowMask);
|
||||
@@ -123,14 +123,14 @@ void WMChangePanelOwner(WMWindow * win, WMWindow * newOwner)
|
||||
}
|
||||
}
|
||||
|
||||
WMWindow *WMCreateWindow(WMScreen * screen, char *name)
|
||||
WMWindow *WMCreateWindow(WMScreen * screen, const char *name)
|
||||
{
|
||||
return WMCreateWindowWithStyle(screen, name, WMTitledWindowMask
|
||||
| WMClosableWindowMask
|
||||
| WMMiniaturizableWindowMask | WMResizableWindowMask);
|
||||
}
|
||||
|
||||
WMWindow *WMCreateWindowWithStyle(WMScreen * screen, char *name, int style)
|
||||
WMWindow *WMCreateWindowWithStyle(WMScreen * screen, const char *name, int style)
|
||||
{
|
||||
_Window *win;
|
||||
|
||||
@@ -250,7 +250,7 @@ static void setMiniwindow(WMWindow *win, RImage *image)
|
||||
wfree(data);
|
||||
}
|
||||
|
||||
void WMSetWindowTitle(WMWindow * win, char *title)
|
||||
void WMSetWindowTitle(WMWindow * win, const char *title)
|
||||
{
|
||||
if (win->title != NULL)
|
||||
wfree(win->title);
|
||||
@@ -598,7 +598,7 @@ void WMSetWindowMiniwindowPixmap(WMWindow * win, WMPixmap * pixmap)
|
||||
}
|
||||
}
|
||||
|
||||
void WMSetWindowMiniwindowTitle(WMWindow * win, char *title)
|
||||
void WMSetWindowMiniwindowTitle(WMWindow * win, const char *title)
|
||||
{
|
||||
if ((win->miniTitle && !title) || (!win->miniTitle && title)
|
||||
|| (title && win->miniTitle && strcoll(title, win->miniTitle) != 0)) {
|
||||
|
||||
Reference in New Issue
Block a user