2 * WINGs test application
12 * You need to define this function to link any program to WINGs.
13 * This will be called when the application will be terminated because
30 closeAction(WMWidget
*self
, void *data
)
32 WMDestroyWidget(self
);
40 testOpenFilePanel(WMScreen
*scr
)
46 /* get the shared Open File panel */
47 panel
= WMGetOpenPanel(scr
);
49 WMRunModalFilePanelForDirectory(panel
, NULL
, "/usr/local", NULL
, NULL
);
51 /* free the panel to save some memory. Not needed otherwise. */
52 WMFreeFilePanel(WMGetOpenPanel(scr
));
57 testFontPanel(WMScreen
*scr
)
63 panel
= WMGetFontPanel(scr
);
65 WMShowFontPanel(panel
);
67 /* WMFreeFontPanel(panel);*/
73 testFrame(WMScreen
*scr
)
78 static char* titles
[] = {
86 static WMTitlePosition pos
[] = {
97 win
= WMCreateWindow(scr
, "testFrame");
98 WMSetWindowTitle(win
, "Frame");
99 WMSetWindowCloseAction(win
, closeAction
, NULL
);
100 WMResizeWidget(win
, 400, 300);
102 for (i
= 0; i
< 6; i
++) {
103 frame
= WMCreateFrame(win
);
104 WMMoveWidget(frame
, 8+(i
%3)*130, 8+(i
/3)*130);
105 WMResizeWidget(frame
, 120, 120);
106 WMSetFrameTitle(frame
, titles
[i
]);
107 WMSetFrameTitlePosition(frame
, pos
[i
]);
110 WMRealizeWidget(win
);
111 WMMapSubwidgets(win
);
117 testList(WMScreen
*scr
)
126 win
= WMCreateWindow(scr
, "testList");
127 WMSetWindowTitle(win
, "List");
128 WMSetWindowCloseAction(win
, closeAction
, NULL
);
130 list
= WMCreateList(win
);
131 for (i
=0; i
<50; i
++) {
132 sprintf(text
, "Item %i", i
);
133 WMAddListItem(list
, text
);
135 WMRealizeWidget(win
);
136 WMMapSubwidgets(win
);
144 testGradientButtons(WMScreen
*scr
)
148 WMPixmap
*pix1
, *pix2
;
151 WMColor
*color
, *altColor
;
155 /* creates the top-level window */
156 win
= WMCreateWindow(scr
, "testGradientButtons");
157 WMSetWindowTitle(win
, "Gradiented Button Demo");
158 WMResizeWidget(win
, 300, 200);
167 color
= WMCreateRGBColor(scr
, 0x5900, 0x5100, 0x5900, True
);
168 WMSetWidgetBackgroundColor(win
, color
);
169 WMReleaseColor(color
);
171 back
= RRenderGradient(60, 24, &dark
, &light
, RGRD_DIAGONAL
);
172 RBevelImage(back
, RBEV_RAISED2
);
173 pix1
= WMCreatePixmapFromRImage(scr
, back
, 0);
176 back
= RRenderGradient(60, 24, &dark
, &light
, RGRD_DIAGONAL
);
177 RBevelImage(back
, RBEV_SUNKEN
);
178 pix2
= WMCreatePixmapFromRImage(scr
, back
, 0);
181 color
= WMWhiteColor(scr
);
182 altColor
= WMCreateNamedColor(scr
, "red", True
);
184 btn
= WMCreateButton(win
, WBTMomentaryChange
);
185 WMResizeWidget(btn
, 60, 24);
186 WMMoveWidget(btn
, 20, 100);
187 WMSetButtonBordered(btn
, False
);
188 WMSetButtonImagePosition(btn
, WIPOverlaps
);
189 WMSetButtonImage(btn
, pix1
);
190 WMSetButtonAltImage(btn
, pix2
);
191 WMSetButtonText(btn
, "Cool");
192 WMSetButtonTextColor(btn
, color
);
193 WMSetButtonAltTextColor(btn
, altColor
);
195 WMSetBalloonTextForView("This is a cool button", WMWidgetView(btn
));
197 btn
= WMCreateButton(win
, WBTMomentaryChange
);
198 WMResizeWidget(btn
, 60, 24);
199 WMMoveWidget(btn
, 90, 100);
200 WMSetButtonBordered(btn
, False
);
201 WMSetButtonImagePosition(btn
, WIPOverlaps
);
202 WMSetButtonImage(btn
, pix1
);
203 WMSetButtonAltImage(btn
, pix2
);
204 WMSetButtonText(btn
, "Button");
205 WMSetButtonTextColor(btn
, color
);
207 WMSetBalloonTextForView("Este é outro balão.", WMWidgetView(btn
));
209 WMReleaseColor(color
);
210 color
= WMCreateNamedColor(scr
, "orange", True
);
212 btn
= WMCreateButton(win
, WBTMomentaryChange
);
213 WMResizeWidget(btn
, 60, 24);
214 WMMoveWidget(btn
, 160, 100);
215 WMSetButtonBordered(btn
, False
);
216 WMSetButtonImagePosition(btn
, WIPOverlaps
);
217 WMSetButtonImage(btn
, pix1
);
218 WMSetButtonAltImage(btn
, pix2
);
219 WMSetButtonText(btn
, "Test");
220 WMSetButtonTextColor(btn
, color
);
222 WMSetBalloonTextForView("This is yet another button.\nBut the balloon has 3 lines.\nYay!",
225 WMReleaseColor(color
);
226 WMReleaseColor(altColor
);
228 WMRealizeWidget(win
);
229 WMMapSubwidgets(win
);
235 testScrollView(WMScreen
*scr
)
246 /* creates the top-level window */
247 win
= WMCreateWindow(scr
, "testScroll");
248 WMSetWindowTitle(win
, "Scrollable View");
250 WMSetWindowCloseAction(win
, closeAction
, NULL
);
252 /* set the window size */
253 WMResizeWidget(win
, 300, 300);
255 /* creates a scrollable view inside the top-level window */
256 sview
= WMCreateScrollView(win
);
257 WMResizeWidget(sview
, 200, 200);
258 WMMoveWidget(sview
, 30, 30);
259 WMSetScrollViewRelief(sview
, WRSunken
);
260 WMSetScrollViewHasVerticalScroller(sview
, True
);
261 WMSetScrollViewHasHorizontalScroller(sview
, True
);
263 /* create a frame with a bunch of labels */
264 f
= WMCreateFrame(win
);
265 WMResizeWidget(f
, 400, 400);
266 WMSetFrameRelief(f
, WRFlat
);
268 for (i
=0; i
<20; i
++) {
269 l
= WMCreateLabel(f
);
270 WMResizeWidget(l
, 50, 18);
271 WMMoveWidget(l
, 10, 20*i
);
272 sprintf(buffer
, "Label %i", i
);
273 WMSetLabelText(l
, buffer
);
274 WMSetLabelRelief(l
, WRSimple
);
279 WMSetScrollViewContentView(sview
, WMWidgetView(f
));
281 /* make the windows of the widgets be actually created */
282 WMRealizeWidget(win
);
284 /* Map all child widgets of the top-level be mapped.
285 * You must call this for each container widget (like frames),
286 * even if they are childs of the top-level window.
288 WMMapSubwidgets(win
);
290 /* map the top-level window */
296 testColorWell(WMScreen
*scr
)
299 WMColorWell
*well1
, *well2
;
303 win
= WMCreateWindow(scr
, "testColor");
304 WMResizeWidget(win
, 300, 300);
306 WMSetWindowCloseAction(win
, closeAction
, NULL
);
308 well1
= WMCreateColorWell(win
);
309 WMResizeWidget(well1
, 60, 40);
310 WMMoveWidget(well1
, 100, 100);
311 WMSetColorWellColor(well1
, WMCreateRGBColor(scr
, 0x8888, 0, 0x1111, True
));
312 well2
= WMCreateColorWell(win
);
313 WMResizeWidget(well2
, 60, 40);
314 WMMoveWidget(well2
, 200, 100);
315 WMSetColorWellColor(well2
, WMCreateRGBColor(scr
, 0, 0, 0x8888, True
));
317 WMRealizeWidget(win
);
318 WMMapSubwidgets(win
);
323 sliderCallback(WMWidget
*w
, void *data
)
325 printf("SLIEDER == %i\n", WMGetSliderValue(w
));
330 testSlider(WMScreen
*scr
)
337 win
= WMCreateWindow(scr
, "testSlider");
338 WMResizeWidget(win
, 300, 300);
339 WMSetWindowTitle(win
, "Sliders");
341 WMSetWindowCloseAction(win
, closeAction
, NULL
);
343 s
= WMCreateSlider(win
);
344 WMResizeWidget(s
, 16, 100);
345 WMMoveWidget(s
, 100, 100);
346 WMSetSliderKnobThickness(s
, 8);
347 WMSetSliderContinuous(s
, False
);
348 WMSetSliderAction(s
, sliderCallback
, s
);
350 s
= WMCreateSlider(win
);
351 WMResizeWidget(s
, 100, 16);
352 WMMoveWidget(s
, 100, 10);
353 WMSetSliderKnobThickness(s
, 8);
355 WMRealizeWidget(win
);
356 WMMapSubwidgets(win
);
362 testTextField(WMScreen
*scr
)
365 WMTextField
*field
, *field2
;
369 win
= WMCreateWindow(scr
, "testText");
370 WMResizeWidget(win
, 400, 300);
372 WMSetWindowCloseAction(win
, closeAction
, NULL
);
374 field
= WMCreateTextField(win
);
375 WMResizeWidget(field
, 200, 20);
376 WMMoveWidget(field
, 20, 20);
378 field2
= WMCreateTextField(win
);
379 WMResizeWidget(field2
, 200, 20);
380 WMMoveWidget(field2
, 20, 50);
381 WMSetTextFieldAlignment(field2
, WARight
);
383 WMRealizeWidget(win
);
384 WMMapSubwidgets(win
);
391 testProgressIndicator(WMScreen
*scr
)
394 WMProgressIndicator
*pPtr
;
398 win
= WMCreateWindow(scr
, "testProgressIndicator");
399 WMResizeWidget(win
, 292, 32);
401 WMSetWindowCloseAction(win
, closeAction
, NULL
);
403 pPtr
= WMCreateProgressIndicator(win
);
404 WMMoveWidget(pPtr
, 8, 8);
405 WMSetProgressIndicatorValue(pPtr
, 75);
407 WMRealizeWidget(win
);
408 WMMapSubwidgets(win
);
415 testPullDown(WMScreen
*scr
)
418 WMPopUpButton
*pop
, *pop2
;
422 win
= WMCreateWindow(scr
, "pullDown");
423 WMResizeWidget(win
, 400, 300);
425 WMSetWindowCloseAction(win
, closeAction
, NULL
);
427 pop
= WMCreatePopUpButton(win
);
428 WMResizeWidget(pop
, 100, 20);
429 WMMoveWidget(pop
, 50, 60);
430 WMSetPopUpButtonPullsDown(pop
, True
);
431 WMSetPopUpButtonText(pop
, "Commands");
432 WMAddPopUpButtonItem(pop
, "Add");
433 WMAddPopUpButtonItem(pop
, "Remove");
434 WMAddPopUpButtonItem(pop
, "Check");
435 WMAddPopUpButtonItem(pop
, "Eat");
437 pop2
= WMCreatePopUpButton(win
);
438 WMResizeWidget(pop2
, 100, 20);
439 WMMoveWidget(pop2
, 200, 60);
440 WMSetPopUpButtonText(pop2
, "Select");
441 WMAddPopUpButtonItem(pop2
, "Apples");
442 WMAddPopUpButtonItem(pop2
, "Bananas");
443 WMAddPopUpButtonItem(pop2
, "Strawberries");
444 WMAddPopUpButtonItem(pop2
, "Blueberries");
446 WMRealizeWidget(win
);
447 WMMapSubwidgets(win
);
454 testTabView(WMScreen
*scr
)
464 win
= WMCreateWindow(scr
, "testTabs");
465 WMResizeWidget(win
, 400, 300);
467 WMSetWindowCloseAction(win
, closeAction
, NULL
);
469 tabv
= WMCreateTabView(win
);
470 WMMoveWidget(tabv
, 50, 50);
471 WMResizeWidget(tabv
, 300, 200);
473 frame
= WMCreateFrame(win
);
474 WMSetFrameRelief(frame
, WRFlat
);
475 label
= WMCreateLabel(frame
);
476 WMResizeWidget(label
, 100, 100);
477 WMSetLabelText(label
, "Label 1");
481 tab
= WMCreateTabViewItemWithIdentifier(0);
482 WMSetTabViewItemView(tab
, WMWidgetView(frame
));
483 WMAddItemInTabView(tabv
, tab
);
484 WMSetTabViewItemLabel(tab
, "Instances");
486 frame
= WMCreateFrame(win
);
487 WMSetFrameRelief(frame
, WRFlat
);
488 label
= WMCreateLabel(frame
);
489 WMResizeWidget(label
, 40, 50);
490 WMSetLabelText(label
, "Label 2");
494 tab
= WMCreateTabViewItemWithIdentifier(0);
495 WMSetTabViewItemView(tab
, WMWidgetView(frame
));
496 WMAddItemInTabView(tabv
, tab
);
497 WMSetTabViewItemLabel(tab
, "Classes");
500 frame
= WMCreateFrame(win
);
501 WMSetFrameRelief(frame
, WRFlat
);
502 label
= WMCreateLabel(frame
);
503 WMResizeWidget(label
, 100, 100);
504 WMMoveWidget(label
, 60, 40);
505 WMSetLabelText(label
, "Label 3");
508 tab
= WMCreateTabViewItemWithIdentifier(0);
509 WMSetTabViewItemView(tab
, WMWidgetView(frame
));
510 WMAddItemInTabView(tabv
, tab
);
511 WMSetTabViewItemLabel(tab
, "Something");
514 frame
= WMCreateFrame(win
);
515 WMSetFrameRelief(frame
, WRFlat
);
516 label
= WMCreateLabel(frame
);
517 WMResizeWidget(label
, 100, 100);
518 WMMoveWidget(label
, 160, 40);
519 WMSetLabelText(label
, "Label 4");
522 tab
= WMCreateTabViewItemWithIdentifier(0);
523 WMSetTabViewItemView(tab
, WMWidgetView(frame
));
524 WMAddItemInTabView(tabv
, tab
);
525 WMSetTabViewItemLabel(tab
, "Bla!");
529 frame
= WMCreateFrame(win
);
530 WMSetFrameRelief(frame
, WRFlat
);
531 label
= WMCreateLabel(frame
);
532 WMResizeWidget(label
, 100, 100);
533 WMMoveWidget(label
, 160, 40);
534 WMSetLabelText(label
, "Label fjweqklrj qwl");
536 tab
= WMCreateTabViewItemWithIdentifier(0);
537 WMSetTabViewItemView(tab
, WMWidgetView(frame
));
538 WMAddItemInTabView(tabv
, tab
);
539 WMSetTabViewItemLabel(tab
, "Weee!");
542 WMRealizeWidget(win
);
543 WMMapSubwidgets(win
);
549 splitViewConstrainProc(WMSplitView
*sPtr
, int indView
,
550 int *minSize
, int *maxSize
)
570 resizeSplitView(XEvent
*event
, void *data
)
572 WMSplitView
*sPtr
= (WMSplitView
*)data
;
574 if (event
->type
== ConfigureNotify
) {
575 int width
= event
->xconfigure
.width
- 10;
577 if (width
< WMGetSplitViewDividerThickness(sPtr
))
578 width
= WMGetSplitViewDividerThickness(sPtr
);
580 if (width
!= WMWidgetWidth(sPtr
) ||
581 event
->xconfigure
.height
!= WMWidgetHeight(sPtr
))
582 WMResizeWidget(sPtr
, width
, event
->xconfigure
.height
- 55);
587 appendSubviewButtonAction(WMWidget
*self
, void *data
)
589 WMSplitView
*sPtr
= (WMSplitView
*)data
;
591 WMLabel
*label
= WMCreateLabel(sPtr
);
593 sprintf(buf
, "Subview %d", WMGetSplitViewSubviewsCount(sPtr
) + 1);
594 WMSetLabelText(label
, buf
);
595 WMSetLabelRelief(label
, WRSunken
);
596 WMAddSplitViewSubview(sPtr
, WMWidgetView(label
));
597 WMRealizeWidget(label
);
602 removeSubviewButtonAction(WMWidget
*self
, void *data
)
604 WMSplitView
*sPtr
= (WMSplitView
*)data
;
605 int count
= WMGetSplitViewSubviewsCount(sPtr
);
608 WMView
*view
= WMGetSplitViewSubviewAt(sPtr
, count
-1);
609 WMDestroyWidget(WMWidgetOfView(view
));
610 WMRemoveSplitViewSubviewAt(sPtr
, count
-1);
615 orientationButtonAction(WMWidget
*self
, void *data
)
617 WMSplitView
*sPtr
= (WMSplitView
*)data
;
618 WMSetSplitViewVertical(sPtr
, !WMGetSplitViewVertical(sPtr
));
622 adjustSubviewsButtonAction(WMWidget
*self
, void *data
)
624 WMAdjustSplitViewSubviews((WMSplitView
*)data
);
628 testSplitView(WMScreen
*scr
)
631 WMSplitView
*splitv1
, *splitv2
;
638 win
= WMCreateWindow(scr
, "testTabs");
639 WMResizeWidget(win
, 300, 400);
640 WMSetWindowCloseAction(win
, closeAction
, NULL
);
642 frame
= WMCreateFrame(win
);
643 WMSetFrameRelief(frame
, WRSunken
);
644 WMMoveWidget(frame
, 5, 5);
645 WMResizeWidget(frame
, 290, 40);
647 splitv1
= WMCreateSplitView(win
);
648 WMMoveWidget(splitv1
, 5, 50);
649 WMResizeWidget(splitv1
, 290, 345);
650 WMSetSplitViewConstrainProc(splitv1
, splitViewConstrainProc
);
651 WMCreateEventHandler(WMWidgetView(win
), StructureNotifyMask
,
652 resizeSplitView
, splitv1
);
654 button
= WMCreateCommandButton(frame
);
655 WMSetButtonText(button
, "+");
656 WMSetButtonAction(button
, appendSubviewButtonAction
, splitv1
);
657 WMMoveWidget(button
, 10, 8);
660 button
= WMCreateCommandButton(frame
);
661 WMSetButtonText(button
, "-");
662 WMSetButtonAction(button
, removeSubviewButtonAction
, splitv1
);
663 WMMoveWidget(button
, 80, 8);
666 button
= WMCreateCommandButton(frame
);
667 WMSetButtonText(button
, "=");
668 WMMoveWidget(button
, 150, 8);
669 WMSetButtonAction(button
, adjustSubviewsButtonAction
, splitv1
);
672 button
= WMCreateCommandButton(frame
);
673 WMSetButtonText(button
, "#");
674 WMMoveWidget(button
, 220, 8);
675 WMSetButtonAction(button
, orientationButtonAction
, splitv1
);
678 label
= WMCreateLabel(splitv1
);
679 WMSetLabelText(label
, "Subview 1");
680 WMSetLabelRelief(label
, WRSunken
);
682 WMAddSplitViewSubview(splitv1
, WMWidgetView(label
));
684 splitv2
= WMCreateSplitView(splitv1
);
685 WMResizeWidget(splitv2
, 150, 150);
686 WMSetSplitViewVertical(splitv2
, True
);
688 label
= WMCreateLabel(splitv2
);
689 WMSetLabelText(label
, "Subview 2.1");
690 WMSetLabelRelief(label
, WRSunken
);
692 WMAddSplitViewSubview(splitv2
, WMWidgetView(label
));
694 label
= WMCreateLabel(splitv2
);
695 WMSetLabelText(label
, "Subview 2.2");
696 WMSetLabelRelief(label
, WRSunken
);
698 WMAddSplitViewSubview(splitv2
, WMWidgetView(label
));
700 label
= WMCreateLabel(splitv2
);
701 WMSetLabelText(label
, "Subview 2.3");
702 WMSetLabelRelief(label
, WRSunken
);
704 WMAddSplitViewSubview(splitv2
, WMWidgetView(label
));
706 WMMapWidget(splitv2
);
707 WMAddSplitViewSubview(splitv1
, WMWidgetView(splitv2
));
709 WMRealizeWidget(win
);
710 WMMapSubwidgets(win
);
715 /*******************************************************************/
717 #include <sys/types.h>
729 getImage(WMScreen
*scr
, char *file
)
734 sprintf(buffer
, "../WindowMaker/Icons/%s", file
);
735 pix
= WMCreatePixmapFromFile(scr
, buffer
);
743 static void iconMouseStuff(XEvent
*event
, void *cdata
)
745 WMLabel
*label
= (WMLabel
*)cdata
;
746 DNDStuff
*stuff
= WMGetHangedData(label
);
749 switch (event
->type
) {
751 stuff
->x
= event
->xbutton
.x
;
752 stuff
->y
= event
->xbutton
.y
;
753 stuff
->mouseDown
= True
;
756 stuff
->mouseDown
= False
;
759 if (!stuff
->mouseDown
)
762 if (abs(stuff
->x
- event
->xmotion
.x
)>4
763 || abs(stuff
->y
- event
->xmotion
.y
)>4) {
765 where
= WMGetViewScreenPosition(WMWidgetView(label
));
767 WMDragImageFromView(WMWidgetView(label
),
768 WMGetLabelImage(label
),
771 wmksize(stuff
->x
, stuff
->y
),
779 static void endedDragImage(WMView
*self
, WMPixmap
*image
, WMPoint point
,
782 DNDStuff
*stuff
= WMGetHangedData(WMWidgetOfView(self
));
785 WMDestroyWidget(WMWidgetOfView(self
));
788 stuff
->mouseDown
= False
;
792 static WMData
* fetchDragData(WMView
*self
, char *type
)
794 DNDStuff
*stuff
= WMGetHangedData(WMWidgetOfView(self
));
796 return WMCreateDataWithBytes(stuff
->filename
, strlen(stuff
->filename
)+1);
800 WMDragSourceProcs dragSourceProcs
= {
808 /************************/
811 unsigned draggingEntered(WMView
*self
, WMDraggingInfo
*info
)
813 return WDOperationCopy
;
817 unsigned draggingUpdated(WMView
*self
, WMDraggingInfo
*info
)
819 return WDOperationCopy
;
823 void (*draggingExited)(WMView *self, WMDraggingInfo *info);
825 char *prepareForDragOperation(WMView
*self
, WMDraggingInfo
*info
)
827 return "application/X-WINGs-Bla";
831 WMLabel
*makeDraggableLabel(WMWidget
*w
, char *file
, int x
, int y
);
833 Bool
performDragOperation(WMView
*self
, WMDraggingInfo
*info
,
836 char *file
= (char*)WMDataBytes(data
);
839 pos
= WMGetDraggingInfoImageLocation(info
);
843 WMPoint pos2
= WMGetViewScreenPosition(self
);
846 label
= makeDraggableLabel(WMWidgetOfView(self
), file
,
847 pos
.x
-pos2
.x
, pos
.y
-pos2
.y
);
848 WMRealizeWidget(label
);
857 void concludeDragOperation(WMView
*self
, WMDraggingInfo
*info
)
864 WMDragDestinationProcs dragDestProcs
= {
868 prepareForDragOperation
,
869 performDragOperation
,
870 concludeDragOperation
877 makeDraggableLabel(WMWidget
*w
, char *file
, int x
, int y
)
881 WMPixmap
*image
= getImage(WMWidgetScreen(w
), file
);
883 stuff
= wmalloc(sizeof(DNDStuff
));
884 stuff
->mouseDown
= False
;
886 stuff
->filename
= wstrdup(file
);
888 label
= WMCreateLabel(w
);
889 WMResizeWidget(label
, 48, 48);
890 WMMoveWidget(label
, x
, y
);
892 WMSetViewDragSourceProcs(WMWidgetView(label
), &dragSourceProcs
);
894 WMHangData(label
, stuff
);
896 WMCreateEventHandler(WMWidgetView(label
),
897 ButtonPressMask
|ButtonReleaseMask
|ButtonMotionMask
,
898 iconMouseStuff
, label
);
902 WMSetLabelImagePosition(label
, WIPImageOnly
);
903 WMSetLabelImage(label
, image
);
904 WMReleasePixmap(image
);
912 void testDragAndDrop(WMScreen
*scr
)
921 "application/X-WINGs-Bla",
927 win
= WMCreateWindow(scr
, "dragDrop");
928 WMResizeWidget(win
, 300, 300);
929 WMSetWindowCloseAction(win
, closeAction
, NULL
);
930 WMSetWindowTitle(win
, "Drag and Drop");
933 frame
= WMCreateFrame(win
);
934 WMSetFrameRelief(frame
, WRSunken
);
935 WMResizeWidget(frame
, 250, 250);
936 WMMoveWidget(frame
, 25, 25);
938 WMRegisterViewForDraggedTypes(WMWidgetView(frame
), types
);
939 WMSetViewDragDestinationProcs(WMWidgetView(frame
), &dragDestProcs
);
941 dir
= opendir("../WindowMaker/Icons");
943 perror("../WindowMaker/Icons");
947 for (i
= 0, j
=0; j
< 8; i
++) {
952 if (strstr(ent
->d_name
, ".xpm")==NULL
) {
956 label
= makeDraggableLabel(frame
, ent
->d_name
,4+(j
/4)*64, 4+(j
%4)*64);
963 WMMapSubwidgets(frame
);
965 WMMapSubwidgets(win
);
966 WMRealizeWidget(win
);
974 /*******************************************************************/
980 int main(int argc
, char **argv
)
986 /* Initialize the application */
987 WMInitializeApplication("Test", &argc
, argv
);
990 * Open connection to the X display.
992 dpy
= XOpenDisplay("");
995 puts("could not open display");
999 /* This is used to disable buffering of X protocol requests.
1000 * Do NOT use it unless when debugging. It will cause a major
1001 * slowdown in your application
1004 XSynchronize(dpy
, True
);
1007 * Create screen descriptor.
1009 scr
= WMCreateScreen(dpy
, DefaultScreen(dpy
));
1012 * Loads the logo of the application.
1014 pixmap
= WMCreatePixmapFromFile(scr
, "logo.xpm");
1017 * Makes the logo be used in standard dialog panels.
1019 WMSetApplicationIconImage(scr
, pixmap
); WMReleasePixmap(pixmap
);
1022 * Do some test stuff.
1024 * Put the testSomething() function you want to test here.
1028 testDragAndDrop(scr
);
1029 testDragAndDrop(scr
);
1043 testGradientButtons(scr
);
1044 testProgressIndicator(scr
);
1048 testOpenFilePanel(scr
);
1050 testScrollView(scr
);
1057 * The main event loop.
1060 WMScreenMainLoop(scr
);