1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-08 01:15:56 +01:00

changed indentation to use spaces only

This commit is contained in:
dan
2004-10-12 21:28:27 +00:00
parent 5912898b06
commit 6830b05716
240 changed files with 35951 additions and 35773 deletions

View File

@@ -2,9 +2,9 @@
* Demo user widget for WINGs
*
* Author: Alfredo K. Kojima
*
*
* This file is in the public domain.
*
*
*/
@@ -12,7 +12,7 @@
*
* Include the WINGs private data header.
*
*
*
*/
#include <WINGs/WINGsP.h>
@@ -25,14 +25,14 @@
* Define the widget "class"
*/
typedef struct W_MyWidget {
/* these two fields must be present in all your widgets in this
/* these two fields must be present in all your widgets in this
* exact position */
W_Class widgetClass;
WMView *view;
/* put your stuff here */
char *text;
} _MyWidget;
@@ -50,16 +50,16 @@ static void handleActionEvents(XEvent *event, void *data);
/*
* Delegates
* Delegates
* See the source for the other widgets to see how to use.
* You won't need to use this most of the time.
*/
static W_ViewDelegate _MyWidgetDelegate = {
NULL,
NULL,
NULL,
NULL,
NULL
NULL,
NULL,
NULL,
NULL,
NULL
};
@@ -76,9 +76,9 @@ InitMyWidget(WMScreen *scr)
{
/* register our widget with WINGs and get our widget class ID */
if (!myWidgetClass) {
myWidgetClass = W_RegisterUserWidget();
myWidgetClass = W_RegisterUserWidget();
}
return myWidgetClass;
}
@@ -90,7 +90,7 @@ MyWidget*
CreateMyWidget(WMWidget *parent)
{
MyWidget *mPtr;
/* allocate some storage for our new widget instance */
mPtr = wmalloc(sizeof(MyWidget));
/* initialize it */
@@ -99,17 +99,17 @@ CreateMyWidget(WMWidget *parent)
/* set the class ID */
mPtr->widgetClass = myWidgetClass;
/*
/*
* Create the view for our widget.
* Note: the Window for the view is only created after the view is
* realized with W_RealizeView()
*
*
* Consider the returned view as read-only.
*/
mPtr->view = W_CreateView(W_VIEW(parent));
if (!mPtr->view) {
wfree(mPtr);
return NULL;
wfree(mPtr);
return NULL;
}
/* always do this */
mPtr->view->self = mPtr;
@@ -121,8 +121,8 @@ CreateMyWidget(WMWidget *parent)
* Intercept some events for our widget, so that we can handle them.
*/
WMCreateEventHandler(mPtr->view, ExposureMask /* this allows us to know when we should paint */
|StructureNotifyMask, /* this allows us to know things like when we are destroyed */
handleEvents, mPtr);
|StructureNotifyMask, /* this allows us to know things like when we are destroyed */
handleEvents, mPtr);
/*
* Intercept some other events. This could be merged with the above
@@ -146,14 +146,14 @@ paintMyWidget(_MyWidget *mPtr)
if (mPtr->text) {
color = WMWhiteColor(scr);
W_PaintText(mPtr->view, mPtr->view->window, scr->normalFont, 0, 0,
mPtr->view->size.width, WACenter, color,
False, mPtr->text, strlen(mPtr->text));
WMReleaseColor(color);
color = WMWhiteColor(scr);
W_PaintText(mPtr->view, mPtr->view->window, scr->normalFont, 0, 0,
mPtr->view->size.width, WACenter, color,
False, mPtr->text, strlen(mPtr->text));
WMReleaseColor(color);
}
}
@@ -165,17 +165,17 @@ handleEvents(XEvent *event, void *data)
_MyWidget *mPtr = (_MyWidget*)data;
switch (event->type) {
case Expose:
if (event->xexpose.count!=0)
break;
paintMyWidget(mPtr);
break;
case DestroyNotify:
destroyMyWidget(mPtr);
break;
switch (event->type) {
case Expose:
if (event->xexpose.count!=0)
break;
paintMyWidget(mPtr);
break;
case DestroyNotify:
destroyMyWidget(mPtr);
break;
}
}
@@ -186,10 +186,10 @@ handleActionEvents(XEvent *event, void *data)
_MyWidget *mPtr = (_MyWidget*)data;
switch (event->type) {
case ButtonPress:
XBell(mPtr->view->screen->display, 100);
XBell(mPtr->view->screen->display, 100);
break;
case ButtonPress:
XBell(mPtr->view->screen->display, 100);
XBell(mPtr->view->screen->display, 100);
break;
}
}
@@ -200,12 +200,12 @@ SetMyWidgetText(MyWidget *mPtr, char *text)
CHECK_CLASS(mPtr, myWidgetClass);
if (mPtr->text)
wfree(mPtr->text);
wfree(mPtr->text);
mPtr->text = wstrdup(text);
if (W_VIEW_MAPPED(mPtr->view)) {
paintMyWidget(mPtr);
paintMyWidget(mPtr);
}
}
@@ -215,12 +215,12 @@ static void
destroyMyWidget(_MyWidget *mPtr)
{
/*
* Free all data we allocated for our widget.
* Free all data we allocated for our widget.
*/
if (mPtr->text)
wfree(mPtr->text);
wfree(mPtr->text);
wfree(mPtr);
}

View File

@@ -1,7 +1,7 @@
/*
* Header for demo widget.
*
*
*/
typedef struct W_MyWidget MyWidget;

View File

@@ -22,30 +22,31 @@ int main(int argc, char **argv)
WMInitializeApplication("Test", &argc, argv);
if (!dpy) {
wfatal("could not open display");
exit(1);
wfatal("could not open display");
exit(1);
}
scr = WMCreateSimpleApplicationScreen(dpy);
/* init our widget */
InitMyWidget(scr);
win = WMCreateWindow(scr, "test");
WMResizeWidget(win, 150, 50);
thing = CreateMyWidget(win);
SetMyWidgetText(thing, "The Test");
WMResizeWidget(thing, 100, 20);
WMMoveWidget(thing, 10, 10);
WMRealizeWidget(win);
WMMapSubwidgets(win);
WMMapWidget(win);
WMScreenMainLoop(scr);
return 0;
}

View File

@@ -1,15 +1,15 @@
/*
* Author: Len Trigg <trigg@cs.waikato.ac.nz>
* Author: Len Trigg <trigg@cs.waikato.ac.nz>
*/
/*
Update: Franck Wolff <frawolff@club-internet.fr>
-----------------------------------------------------------------------
List of updated functions :
- main :
add -s option for a save panel...
-----------------------------------------------------------------------
*/
Update: Franck Wolff <frawolff@club-internet.fr>
-----------------------------------------------------------------------
List of updated functions :
- main :
add -s option for a save panel...
-----------------------------------------------------------------------
*/
@@ -34,23 +34,23 @@ char *ProgName;
void usage(void)
{
fprintf(stderr,
"usage:\n"
"\t%s [-options]\n"
"\n"
"options:\n"
" -s\t\tSave panel (default open panel)\n"
" -i <str>\tInitial directory (default /)\n"
" -t <str>\tQuery window title (default none)\n"
"\n"
"information:\n"
"\t%s pops up a WindowMaker style file selection panel.\n"
"\n"
"version:\n"
"\t%s\n"
,ProgName,ProgName,__DATE__
);
exit(0);
fprintf(stderr,
"usage:\n"
"\t%s [-options]\n"
"\n"
"options:\n"
" -s\t\tSave panel (default open panel)\n"
" -i <str>\tInitial directory (default /)\n"
" -t <str>\tQuery window title (default none)\n"
"\n"
"information:\n"
"\t%s pops up a WindowMaker style file selection panel.\n"
"\n"
"version:\n"
"\t%s\n"
,ProgName,ProgName,__DATE__
);
exit(0);
}
#define OPEN_PANEL_TYPE 0
@@ -58,68 +58,69 @@ void usage(void)
int main(int argc, char **argv)
{
Display *dpy = XOpenDisplay("");
WMScreen *scr;
WMPixmap *pixmap;
WMOpenPanel *oPanel;
WMSavePanel *sPanel;
/* RImage *image;*/
char *title = NULL;
char *initial = "/";
int ch;
int panelType = OPEN_PANEL_TYPE;
extern char *optarg;
extern int optind;
Display *dpy = XOpenDisplay("");
WMScreen *scr;
WMPixmap *pixmap;
WMOpenPanel *oPanel;
WMSavePanel *sPanel;
/* RImage *image;*/
char *title = NULL;
char *initial = "/";
int ch;
int panelType = OPEN_PANEL_TYPE;
extern char *optarg;
extern int optind;
if (!dpy) {
puts("could not open display");
exit(1);
}
WMInitializeApplication("WMFile", &argc, argv);
ProgName = argv[0];
while((ch = getopt(argc, argv, "si:ht:")) != -1)
switch(ch)
{
case 's':
panelType = SAVE_PANEL_TYPE;
break;
case 'i':
initial = optarg;
break;
case 't':
title = optarg;
break;
default:
usage();
if (!dpy) {
puts("could not open display");
exit(1);
}
WMInitializeApplication("WMFile", &argc, argv);
ProgName = argv[0];
while((ch = getopt(argc, argv, "si:ht:")) != -1)
switch(ch)
{
case 's':
panelType = SAVE_PANEL_TYPE;
break;
case 'i':
initial = optarg;
break;
case 't':
title = optarg;
break;
default:
usage();
}
for(; optind <argc; optind++)
usage();
usage();
scr = WMCreateSimpleApplicationScreen(dpy);
pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
WMSetApplicationIconPixmap(scr, pixmap);
WMReleasePixmap(pixmap);
if (panelType == SAVE_PANEL_TYPE) {
sPanel = WMGetSavePanel(scr);
if (WMRunModalFilePanelForDirectory(sPanel, NULL, initial,
/*title*/ NULL, NULL) == True)
printf("%s\n", WMGetFilePanelFileName(sPanel));
else
printf("\n");
sPanel = WMGetSavePanel(scr);
if (WMRunModalFilePanelForDirectory(sPanel, NULL, initial,
/*title*/ NULL, NULL) == True)
printf("%s\n", WMGetFilePanelFileName(sPanel));
else
printf("\n");
} else {
oPanel = WMGetOpenPanel(scr);
if (WMRunModalFilePanelForDirectory(oPanel, NULL, initial,
/*title*/ NULL, NULL) == True)
printf("%s\n", WMGetFilePanelFileName(oPanel));
else
printf("\n");
oPanel = WMGetOpenPanel(scr);
if (WMRunModalFilePanelForDirectory(oPanel, NULL, initial,
/*title*/ NULL, NULL) == True)
printf("%s\n", WMGetFilePanelFileName(oPanel));
else
printf("\n");
}
return 0;
}

View File

@@ -1,6 +1,6 @@
/*
* Author: Len Trigg <trigg@cs.waikato.ac.nz>
* Author: Len Trigg <trigg@cs.waikato.ac.nz>
*/
@@ -23,78 +23,81 @@ wAbort()
char *ProgName;
void usage(void)
void
usage(void)
{
fprintf(stderr,
"usage:\n"
"\t%s [-options]\n"
"\n"
"options:\n"
" -i <str>\tInitial entry contents (default none)\n"
" -p <str>\tPrompt message (default none)\n"
" -t <str>\tQuery window title (default none)\n"
"\n"
"information:\n"
"\t%s pops up a WindowMaker style input panel.\n"
"\n"
"version:\n"
"\t%s\n"
,ProgName,ProgName,__DATE__
);
exit(0);
fprintf(stderr,
"usage:\n"
"\t%s [-options]\n"
"\n"
"options:\n"
" -i <str>\tInitial entry contents (default none)\n"
" -p <str>\tPrompt message (default none)\n"
" -t <str>\tQuery window title (default none)\n"
"\n"
"information:\n"
"\t%s pops up a WindowMaker style input panel.\n"
"\n"
"version:\n"
"\t%s\n"
,ProgName,ProgName,__DATE__
);
exit(0);
}
int main(int argc, char **argv)
int
main(int argc, char **argv)
{
Display *dpy = XOpenDisplay("");
WMScreen *scr;
WMPixmap *pixmap;
char *title = NULL;
char *prompt = NULL;
char *initial = NULL;
char *result = NULL;
int ch;
extern char *optarg;
extern int optind;
Display *dpy = XOpenDisplay("");
WMScreen *scr;
WMPixmap *pixmap;
char *title = NULL;
char *prompt = NULL;
char *initial = NULL;
char *result = NULL;
int ch;
extern char *optarg;
extern int optind;
WMInitializeApplication("WMQuery", &argc, argv);
ProgName = argv[0];
WMInitializeApplication("WMQuery", &argc, argv);
if (!dpy) {
puts("could not open display");
exit(1);
}
while((ch = getopt(argc, argv, "i:hp:t:")) != -1)
switch(ch)
{
case 'i':
initial = optarg;
break;
case 'p':
prompt = optarg;
break;
case 't':
title = optarg;
break;
default:
usage();
ProgName = argv[0];
if (!dpy) {
puts("could not open display");
exit(1);
}
for(; optind <argc; optind++)
usage();
while((ch = getopt(argc, argv, "i:hp:t:")) != -1)
switch(ch)
{
case 'i':
initial = optarg;
break;
case 'p':
prompt = optarg;
break;
case 't':
title = optarg;
break;
default:
usage();
}
for(; optind <argc; optind++)
usage();
scr = WMCreateSimpleApplicationScreen(dpy);
scr = WMCreateSimpleApplicationScreen(dpy);
pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
WMSetApplicationIconPixmap(scr, pixmap); WMReleasePixmap(pixmap);
WMSetApplicationIconPixmap(scr, pixmap); WMReleasePixmap(pixmap);
if ((result = WMRunInputPanel(scr, NULL, title, prompt, initial, "OK", "Cancel")) != NULL)
printf("%s\n", result);
else
printf("\n");
return 0;
if ((result = WMRunInputPanel(scr, NULL, title, prompt, initial, "OK", "Cancel")) != NULL)
printf("%s\n", result);
else
printf("\n");
return 0;
}

View File

@@ -28,7 +28,7 @@ Display *dpy;
int windowCount = 0;
void
closeAction(WMWidget *self, void *data)
closeAction(WMWidget *self, void *data)
{
WMDestroyWidget(self);
windowCount--;
@@ -117,13 +117,13 @@ testFrame(WMScreen *scr)
/*static void
resizedWindow(void *self, WMNotification *notif)
{
WMView *view = (WMView*)WMGetNotificationObject(notif);
WMSize size = WMGetViewSize(view);
resizedWindow(void *self, WMNotification *notif)
{
WMView *view = (WMView*)WMGetNotificationObject(notif);
WMSize size = WMGetViewSize(view);
WMResizeWidget((WMWidget*)self, size.width, size.height);
}*/
WMResizeWidget((WMWidget*)self, size.width, size.height);
}*/
void
testBox(WMScreen *scr)
@@ -1071,3 +1071,4 @@ main(int argc, char **argv)
return 0;
}