mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-01 11:32:34 +01:00
Gah!. New incompatible change in wtext.c broke the compilation of code
using WMText widget
This commit is contained in:
@@ -41,14 +41,14 @@ void
|
|||||||
testOpenFilePanel(WMScreen *scr)
|
testOpenFilePanel(WMScreen *scr)
|
||||||
{
|
{
|
||||||
WMOpenPanel *panel;
|
WMOpenPanel *panel;
|
||||||
|
|
||||||
/* windowCount++; */
|
/* windowCount++; */
|
||||||
|
|
||||||
/* get the shared Open File panel */
|
/* get the shared Open File panel */
|
||||||
panel = WMGetOpenPanel(scr);
|
panel = WMGetOpenPanel(scr);
|
||||||
|
|
||||||
WMRunModalFilePanelForDirectory(panel, NULL, "/usr/local", NULL, NULL);
|
WMRunModalFilePanelForDirectory(panel, NULL, "/usr/local", NULL, NULL);
|
||||||
|
|
||||||
/* free the panel to save some memory. Not needed otherwise. */
|
/* free the panel to save some memory. Not needed otherwise. */
|
||||||
WMFreeFilePanel(WMGetOpenPanel(scr));
|
WMFreeFilePanel(WMGetOpenPanel(scr));
|
||||||
}
|
}
|
||||||
@@ -58,13 +58,13 @@ void
|
|||||||
testFontPanel(WMScreen *scr)
|
testFontPanel(WMScreen *scr)
|
||||||
{
|
{
|
||||||
WMFontPanel *panel;
|
WMFontPanel *panel;
|
||||||
|
|
||||||
/*windowCount++;*/
|
/*windowCount++;*/
|
||||||
|
|
||||||
panel = WMGetFontPanel(scr);
|
panel = WMGetFontPanel(scr);
|
||||||
|
|
||||||
WMShowFontPanel(panel);
|
WMShowFontPanel(panel);
|
||||||
|
|
||||||
/* WMFreeFontPanel(panel);*/
|
/* WMFreeFontPanel(panel);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ testFrame(WMScreen *scr)
|
|||||||
};
|
};
|
||||||
|
|
||||||
windowCount++;
|
windowCount++;
|
||||||
|
|
||||||
win = WMCreateWindow(scr, "testFrame");
|
win = WMCreateWindow(scr, "testFrame");
|
||||||
WMSetWindowTitle(win, "Frame");
|
WMSetWindowTitle(win, "Frame");
|
||||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||||
@@ -107,11 +107,11 @@ testFrame(WMScreen *scr)
|
|||||||
WMSetFrameTitle(frame, titles[i]);
|
WMSetFrameTitle(frame, titles[i]);
|
||||||
WMSetFrameTitlePosition(frame, pos[i]);
|
WMSetFrameTitlePosition(frame, pos[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
WMRealizeWidget(win);
|
WMRealizeWidget(win);
|
||||||
WMMapSubwidgets(win);
|
WMMapSubwidgets(win);
|
||||||
WMMapWidget(win);
|
WMMapWidget(win);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ testButton(WMScreen *scr)
|
|||||||
};
|
};
|
||||||
|
|
||||||
windowCount++;
|
windowCount++;
|
||||||
|
|
||||||
win = WMCreateWindow(scr, "testButton");
|
win = WMCreateWindow(scr, "testButton");
|
||||||
WMResizeWidget(win, 300, 300);
|
WMResizeWidget(win, 300, 300);
|
||||||
WMSetWindowTitle(win, "Buttons");
|
WMSetWindowTitle(win, "Buttons");
|
||||||
@@ -271,7 +271,7 @@ testGradientButtons(WMScreen *scr)
|
|||||||
WMColor *color, *altColor;
|
WMColor *color, *altColor;
|
||||||
|
|
||||||
windowCount++;
|
windowCount++;
|
||||||
|
|
||||||
/* creates the top-level window */
|
/* creates the top-level window */
|
||||||
win = WMCreateWindow(scr, "testGradientButtons");
|
win = WMCreateWindow(scr, "testGradientButtons");
|
||||||
WMSetWindowTitle(win, "Gradiented Button Demo");
|
WMSetWindowTitle(win, "Gradiented Button Demo");
|
||||||
@@ -283,11 +283,11 @@ testGradientButtons(WMScreen *scr)
|
|||||||
dark.red = 0x35;
|
dark.red = 0x35;
|
||||||
dark.green = 0x30;
|
dark.green = 0x30;
|
||||||
dark.blue = 0x35;
|
dark.blue = 0x35;
|
||||||
|
|
||||||
color = WMCreateRGBColor(scr, 0x5900, 0x5100, 0x5900, True);
|
color = WMCreateRGBColor(scr, 0x5900, 0x5100, 0x5900, True);
|
||||||
WMSetWidgetBackgroundColor(win, color);
|
WMSetWidgetBackgroundColor(win, color);
|
||||||
WMReleaseColor(color);
|
WMReleaseColor(color);
|
||||||
|
|
||||||
back = RRenderGradient(60, 24, &dark, &light, RGRD_DIAGONAL);
|
back = RRenderGradient(60, 24, &dark, &light, RGRD_DIAGONAL);
|
||||||
RBevelImage(back, RBEV_RAISED2);
|
RBevelImage(back, RBEV_RAISED2);
|
||||||
pix1 = WMCreatePixmapFromRImage(scr, back, 0);
|
pix1 = WMCreatePixmapFromRImage(scr, back, 0);
|
||||||
@@ -362,16 +362,16 @@ testScrollView(WMScreen *scr)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
windowCount++;
|
windowCount++;
|
||||||
|
|
||||||
/* creates the top-level window */
|
/* creates the top-level window */
|
||||||
win = WMCreateWindow(scr, "testScroll");
|
win = WMCreateWindow(scr, "testScroll");
|
||||||
WMSetWindowTitle(win, "Scrollable View");
|
WMSetWindowTitle(win, "Scrollable View");
|
||||||
|
|
||||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||||
|
|
||||||
/* set the window size */
|
/* set the window size */
|
||||||
WMResizeWidget(win, 300, 300);
|
WMResizeWidget(win, 300, 300);
|
||||||
|
|
||||||
/* creates a scrollable view inside the top-level window */
|
/* creates a scrollable view inside the top-level window */
|
||||||
sview = WMCreateScrollView(win);
|
sview = WMCreateScrollView(win);
|
||||||
WMResizeWidget(sview, 200, 200);
|
WMResizeWidget(sview, 200, 200);
|
||||||
@@ -395,12 +395,12 @@ testScrollView(WMScreen *scr)
|
|||||||
}
|
}
|
||||||
WMMapSubwidgets(f);
|
WMMapSubwidgets(f);
|
||||||
WMMapWidget(f);
|
WMMapWidget(f);
|
||||||
|
|
||||||
WMSetScrollViewContentView(sview, WMWidgetView(f));
|
WMSetScrollViewContentView(sview, WMWidgetView(f));
|
||||||
|
|
||||||
/* make the windows of the widgets be actually created */
|
/* make the windows of the widgets be actually created */
|
||||||
WMRealizeWidget(win);
|
WMRealizeWidget(win);
|
||||||
|
|
||||||
/* Map all child widgets of the top-level be mapped.
|
/* Map all child widgets of the top-level be mapped.
|
||||||
* You must call this for each container widget (like frames),
|
* You must call this for each container widget (like frames),
|
||||||
* even if they are childs of the top-level window.
|
* even if they are childs of the top-level window.
|
||||||
@@ -432,7 +432,7 @@ testColorWell(WMScreen *scr)
|
|||||||
WMResizeWidget(well2, 60, 40);
|
WMResizeWidget(well2, 60, 40);
|
||||||
WMMoveWidget(well2, 200, 100);
|
WMMoveWidget(well2, 200, 100);
|
||||||
WMSetColorWellColor(well2, WMCreateRGBColor(scr, 0, 0, 0x8888, True));
|
WMSetColorWellColor(well2, WMCreateRGBColor(scr, 0, 0, 0x8888, True));
|
||||||
|
|
||||||
WMRealizeWidget(win);
|
WMRealizeWidget(win);
|
||||||
WMMapSubwidgets(win);
|
WMMapSubwidgets(win);
|
||||||
WMMapWidget(win);
|
WMMapWidget(win);
|
||||||
@@ -452,7 +452,7 @@ testSlider(WMScreen *scr)
|
|||||||
WMSlider *s;
|
WMSlider *s;
|
||||||
|
|
||||||
windowCount++;
|
windowCount++;
|
||||||
|
|
||||||
win = WMCreateWindow(scr, "testSlider");
|
win = WMCreateWindow(scr, "testSlider");
|
||||||
WMResizeWidget(win, 300, 300);
|
WMResizeWidget(win, 300, 300);
|
||||||
WMSetWindowTitle(win, "Sliders");
|
WMSetWindowTitle(win, "Sliders");
|
||||||
@@ -483,11 +483,11 @@ testTextField(WMScreen *scr)
|
|||||||
WMTextField *field, *field2;
|
WMTextField *field, *field2;
|
||||||
|
|
||||||
windowCount++;
|
windowCount++;
|
||||||
|
|
||||||
win = WMCreateWindow(scr, "testTextField");
|
win = WMCreateWindow(scr, "testTextField");
|
||||||
WMResizeWidget(win, 400, 300);
|
WMResizeWidget(win, 400, 300);
|
||||||
|
|
||||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||||
|
|
||||||
field = WMCreateTextField(win);
|
field = WMCreateTextField(win);
|
||||||
WMResizeWidget(field, 200, 20);
|
WMResizeWidget(field, 200, 20);
|
||||||
@@ -501,48 +501,50 @@ testTextField(WMScreen *scr)
|
|||||||
WMRealizeWidget(win);
|
WMRealizeWidget(win);
|
||||||
WMMapSubwidgets(win);
|
WMMapSubwidgets(win);
|
||||||
WMMapWidget(win);
|
WMMapWidget(win);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
void
|
void
|
||||||
testText(WMScreen *scr)
|
testText(WMScreen *scr)
|
||||||
{
|
{
|
||||||
WMWindow *win;
|
WMWindow *win;
|
||||||
WMText *text;
|
WMText *text;
|
||||||
FILE *file = fopen("../README", "r");
|
FILE *file = fopen("../README", "r");
|
||||||
|
|
||||||
windowCount++;
|
windowCount++;
|
||||||
|
|
||||||
win = WMCreateWindow(scr, "testText");
|
win = WMCreateWindow(scr, "testText");
|
||||||
WMResizeWidget(win, 500, 300);
|
WMResizeWidget(win, 500, 300);
|
||||||
|
|
||||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||||
|
|
||||||
text = WMCreateText(win);
|
text = WMCreateText(win);
|
||||||
WMResizeWidget(text, 480, 280);
|
WMResizeWidget(text, 480, 280);
|
||||||
WMMoveWidget(text, 10, 10);
|
WMMoveWidget(text, 10, 10);
|
||||||
WMSetTextHasVerticalScroller(text, True);
|
WMSetTextHasVerticalScroller(text, True);
|
||||||
WMSetTextEditable(text, False);
|
WMSetTextEditable(text, False);
|
||||||
|
|
||||||
if(file) {
|
if(file) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
WMFreezeText(text);
|
WMFreezeText(text);
|
||||||
while(fgets(buf, 1023, file))
|
while(fgets(buf, 1023, file))
|
||||||
WMAppendTextStream(text, buf);
|
WMAppendTextStream(text, buf);
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
WMThawText(text);
|
WMThawText(text);
|
||||||
WMRefreshText(text, 0, 0);
|
WMRefreshText(text, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
WMAppendTextStream(text, "<HTML><i>Where's</i> the <b>README</b>?");
|
WMAppendTextStream(text, "<HTML><i>Where's</i> the <b>README</b>?");
|
||||||
}
|
}
|
||||||
|
|
||||||
WMRealizeWidget(win);
|
WMRealizeWidget(win);
|
||||||
WMMapSubwidgets(win);
|
WMMapSubwidgets(win);
|
||||||
WMMapWidget(win);
|
WMMapWidget(win);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -552,11 +554,11 @@ testProgressIndicator(WMScreen *scr)
|
|||||||
WMProgressIndicator *pPtr;
|
WMProgressIndicator *pPtr;
|
||||||
|
|
||||||
windowCount++;
|
windowCount++;
|
||||||
|
|
||||||
win = WMCreateWindow(scr, "testProgressIndicator");
|
win = WMCreateWindow(scr, "testProgressIndicator");
|
||||||
WMResizeWidget(win, 292, 32);
|
WMResizeWidget(win, 292, 32);
|
||||||
|
|
||||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||||
|
|
||||||
pPtr = WMCreateProgressIndicator(win);
|
pPtr = WMCreateProgressIndicator(win);
|
||||||
WMMoveWidget(pPtr, 8, 8);
|
WMMoveWidget(pPtr, 8, 8);
|
||||||
@@ -565,7 +567,7 @@ testProgressIndicator(WMScreen *scr)
|
|||||||
WMRealizeWidget(win);
|
WMRealizeWidget(win);
|
||||||
WMMapSubwidgets(win);
|
WMMapSubwidgets(win);
|
||||||
WMMapWidget(win);
|
WMMapWidget(win);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -576,11 +578,11 @@ testPullDown(WMScreen *scr)
|
|||||||
WMPopUpButton *pop, *pop2;
|
WMPopUpButton *pop, *pop2;
|
||||||
|
|
||||||
windowCount++;
|
windowCount++;
|
||||||
|
|
||||||
win = WMCreateWindow(scr, "pullDown");
|
win = WMCreateWindow(scr, "pullDown");
|
||||||
WMResizeWidget(win, 400, 300);
|
WMResizeWidget(win, 400, 300);
|
||||||
|
|
||||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||||
|
|
||||||
pop = WMCreatePopUpButton(win);
|
pop = WMCreatePopUpButton(win);
|
||||||
WMResizeWidget(pop, 100, 20);
|
WMResizeWidget(pop, 100, 20);
|
||||||
@@ -604,7 +606,7 @@ testPullDown(WMScreen *scr)
|
|||||||
WMRealizeWidget(win);
|
WMRealizeWidget(win);
|
||||||
WMMapSubwidgets(win);
|
WMMapSubwidgets(win);
|
||||||
WMMapWidget(win);
|
WMMapWidget(win);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -618,11 +620,11 @@ testTabView(WMScreen *scr)
|
|||||||
WMLabel *label;
|
WMLabel *label;
|
||||||
|
|
||||||
windowCount++;
|
windowCount++;
|
||||||
|
|
||||||
win = WMCreateWindow(scr, "testTabs");
|
win = WMCreateWindow(scr, "testTabs");
|
||||||
WMResizeWidget(win, 400, 300);
|
WMResizeWidget(win, 400, 300);
|
||||||
|
|
||||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||||
|
|
||||||
tabv = WMCreateTabView(win);
|
tabv = WMCreateTabView(win);
|
||||||
WMMoveWidget(tabv, 50, 50);
|
WMMoveWidget(tabv, 50, 50);
|
||||||
@@ -668,7 +670,7 @@ testTabView(WMScreen *scr)
|
|||||||
WMAddItemInTabView(tabv, tab);
|
WMAddItemInTabView(tabv, tab);
|
||||||
WMSetTabViewItemLabel(tab, "Something");
|
WMSetTabViewItemLabel(tab, "Something");
|
||||||
|
|
||||||
|
|
||||||
frame = WMCreateFrame(win);
|
frame = WMCreateFrame(win);
|
||||||
WMSetFrameRelief(frame, WRFlat);
|
WMSetFrameRelief(frame, WRFlat);
|
||||||
label = WMCreateLabel(frame);
|
label = WMCreateLabel(frame);
|
||||||
@@ -692,11 +694,11 @@ testTabView(WMScreen *scr)
|
|||||||
WMSetLabelText(label, "Label fjweqklrj qwl");
|
WMSetLabelText(label, "Label fjweqklrj qwl");
|
||||||
WMMapWidget(label);
|
WMMapWidget(label);
|
||||||
tab = WMCreateTabViewItemWithIdentifier(0);
|
tab = WMCreateTabViewItemWithIdentifier(0);
|
||||||
WMSetTabViewItemView(tab, WMWidgetView(frame));
|
WMSetTabViewItemView(tab, WMWidgetView(frame));
|
||||||
WMAddItemInTabView(tabv, tab);
|
WMAddItemInTabView(tabv, tab);
|
||||||
WMSetTabViewItemLabel(tab, "Weee!");
|
WMSetTabViewItemLabel(tab, "Weee!");
|
||||||
|
|
||||||
|
|
||||||
WMRealizeWidget(win);
|
WMRealizeWidget(win);
|
||||||
WMMapSubwidgets(win);
|
WMMapSubwidgets(win);
|
||||||
WMMapWidget(win);
|
WMMapWidget(win);
|
||||||
@@ -724,14 +726,14 @@ splitViewConstrainProc(WMSplitView *sPtr, int indView,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
resizeSplitView(XEvent *event, void *data)
|
resizeSplitView(XEvent *event, void *data)
|
||||||
{
|
{
|
||||||
WMSplitView *sPtr = (WMSplitView*)data;
|
WMSplitView *sPtr = (WMSplitView*)data;
|
||||||
|
|
||||||
if (event->type == ConfigureNotify) {
|
if (event->type == ConfigureNotify) {
|
||||||
int width = event->xconfigure.width - 10;
|
int width = event->xconfigure.width - 10;
|
||||||
|
|
||||||
if (width < WMGetSplitViewDividerThickness(sPtr))
|
if (width < WMGetSplitViewDividerThickness(sPtr))
|
||||||
width = WMGetSplitViewDividerThickness(sPtr);
|
width = WMGetSplitViewDividerThickness(sPtr);
|
||||||
|
|
||||||
@@ -747,7 +749,7 @@ appendSubviewButtonAction(WMWidget *self, void *data)
|
|||||||
WMSplitView *sPtr = (WMSplitView*)data;
|
WMSplitView *sPtr = (WMSplitView*)data;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
WMLabel *label = WMCreateLabel(sPtr);
|
WMLabel *label = WMCreateLabel(sPtr);
|
||||||
|
|
||||||
sprintf(buf, "Subview %d", WMGetSplitViewSubviewsCount(sPtr) + 1);
|
sprintf(buf, "Subview %d", WMGetSplitViewSubviewsCount(sPtr) + 1);
|
||||||
WMSetLabelText(label, buf);
|
WMSetLabelText(label, buf);
|
||||||
WMSetLabelRelief(label, WRSunken);
|
WMSetLabelRelief(label, WRSunken);
|
||||||
@@ -761,7 +763,7 @@ removeSubviewButtonAction(WMWidget *self, void *data)
|
|||||||
{
|
{
|
||||||
WMSplitView *sPtr = (WMSplitView*)data;
|
WMSplitView *sPtr = (WMSplitView*)data;
|
||||||
int count = WMGetSplitViewSubviewsCount(sPtr);
|
int count = WMGetSplitViewSubviewsCount(sPtr);
|
||||||
|
|
||||||
if (count > 2) {
|
if (count > 2) {
|
||||||
WMView *view = WMGetSplitViewSubviewAt(sPtr, count-1);
|
WMView *view = WMGetSplitViewSubviewAt(sPtr, count-1);
|
||||||
WMDestroyWidget(WMWidgetOfView(view));
|
WMDestroyWidget(WMWidgetOfView(view));
|
||||||
@@ -792,16 +794,16 @@ testSplitView(WMScreen *scr)
|
|||||||
WMButton *button;
|
WMButton *button;
|
||||||
|
|
||||||
windowCount++;
|
windowCount++;
|
||||||
|
|
||||||
win = WMCreateWindow(scr, "testTabs");
|
win = WMCreateWindow(scr, "testTabs");
|
||||||
WMResizeWidget(win, 300, 400);
|
WMResizeWidget(win, 300, 400);
|
||||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||||
|
|
||||||
frame = WMCreateFrame(win);
|
frame = WMCreateFrame(win);
|
||||||
WMSetFrameRelief(frame, WRSunken);
|
WMSetFrameRelief(frame, WRSunken);
|
||||||
WMMoveWidget(frame, 5, 5);
|
WMMoveWidget(frame, 5, 5);
|
||||||
WMResizeWidget(frame, 290, 40);
|
WMResizeWidget(frame, 290, 40);
|
||||||
|
|
||||||
splitv1 = WMCreateSplitView(win);
|
splitv1 = WMCreateSplitView(win);
|
||||||
WMMoveWidget(splitv1, 5, 50);
|
WMMoveWidget(splitv1, 5, 50);
|
||||||
WMResizeWidget(splitv1, 290, 345);
|
WMResizeWidget(splitv1, 290, 345);
|
||||||
@@ -814,25 +816,25 @@ testSplitView(WMScreen *scr)
|
|||||||
WMSetButtonAction(button, appendSubviewButtonAction, splitv1);
|
WMSetButtonAction(button, appendSubviewButtonAction, splitv1);
|
||||||
WMMoveWidget(button, 10, 8);
|
WMMoveWidget(button, 10, 8);
|
||||||
WMMapWidget(button);
|
WMMapWidget(button);
|
||||||
|
|
||||||
button = WMCreateCommandButton(frame);
|
button = WMCreateCommandButton(frame);
|
||||||
WMSetButtonText(button, "-");
|
WMSetButtonText(button, "-");
|
||||||
WMSetButtonAction(button, removeSubviewButtonAction, splitv1);
|
WMSetButtonAction(button, removeSubviewButtonAction, splitv1);
|
||||||
WMMoveWidget(button, 80, 8);
|
WMMoveWidget(button, 80, 8);
|
||||||
WMMapWidget(button);
|
WMMapWidget(button);
|
||||||
|
|
||||||
button = WMCreateCommandButton(frame);
|
button = WMCreateCommandButton(frame);
|
||||||
WMSetButtonText(button, "=");
|
WMSetButtonText(button, "=");
|
||||||
WMMoveWidget(button, 150, 8);
|
WMMoveWidget(button, 150, 8);
|
||||||
WMSetButtonAction(button, adjustSubviewsButtonAction, splitv1);
|
WMSetButtonAction(button, adjustSubviewsButtonAction, splitv1);
|
||||||
WMMapWidget(button);
|
WMMapWidget(button);
|
||||||
|
|
||||||
button = WMCreateCommandButton(frame);
|
button = WMCreateCommandButton(frame);
|
||||||
WMSetButtonText(button, "#");
|
WMSetButtonText(button, "#");
|
||||||
WMMoveWidget(button, 220, 8);
|
WMMoveWidget(button, 220, 8);
|
||||||
WMSetButtonAction(button, orientationButtonAction, splitv1);
|
WMSetButtonAction(button, orientationButtonAction, splitv1);
|
||||||
WMMapWidget(button);
|
WMMapWidget(button);
|
||||||
|
|
||||||
label = WMCreateLabel(splitv1);
|
label = WMCreateLabel(splitv1);
|
||||||
WMSetLabelText(label, "Subview 1");
|
WMSetLabelText(label, "Subview 1");
|
||||||
WMSetLabelRelief(label, WRSunken);
|
WMSetLabelRelief(label, WRSunken);
|
||||||
@@ -860,7 +862,7 @@ testSplitView(WMScreen *scr)
|
|||||||
WMSetLabelRelief(label, WRSunken);
|
WMSetLabelRelief(label, WRSunken);
|
||||||
WMMapWidget(label);
|
WMMapWidget(label);
|
||||||
WMAddSplitViewSubview(splitv2, WMWidgetView(label));
|
WMAddSplitViewSubview(splitv2, WMWidgetView(label));
|
||||||
|
|
||||||
WMMapWidget(splitv2);
|
WMMapWidget(splitv2);
|
||||||
WMAddSplitViewSubview(splitv1, WMWidgetView(splitv2));
|
WMAddSplitViewSubview(splitv1, WMWidgetView(splitv2));
|
||||||
|
|
||||||
@@ -888,10 +890,10 @@ getImage(WMScreen *scr, char *file)
|
|||||||
{
|
{
|
||||||
char buffer[1000];
|
char buffer[1000];
|
||||||
WMPixmap *pix;
|
WMPixmap *pix;
|
||||||
|
|
||||||
sprintf(buffer, "../../WindowMaker/Icons/%s", file);
|
sprintf(buffer, "../../WindowMaker/Icons/%s", file);
|
||||||
pix = WMCreatePixmapFromFile(scr, buffer);
|
pix = WMCreatePixmapFromFile(scr, buffer);
|
||||||
|
|
||||||
return pix;
|
return pix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -904,7 +906,7 @@ iconMouseStuff(XEvent *event, void *cdata)
|
|||||||
WMLabel *label = (WMLabel*)cdata;
|
WMLabel *label = (WMLabel*)cdata;
|
||||||
DNDStuff *stuff = WMGetHangedData(label);
|
DNDStuff *stuff = WMGetHangedData(label);
|
||||||
WMPoint where;
|
WMPoint where;
|
||||||
|
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
stuff->x = event->xbutton.x;
|
stuff->x = event->xbutton.x;
|
||||||
@@ -917,12 +919,12 @@ iconMouseStuff(XEvent *event, void *cdata)
|
|||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
if (!stuff->mouseDown)
|
if (!stuff->mouseDown)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (abs(stuff->x - event->xmotion.x)>4
|
if (abs(stuff->x - event->xmotion.x)>4
|
||||||
|| abs(stuff->y - event->xmotion.y)>4) {
|
|| abs(stuff->y - event->xmotion.y)>4) {
|
||||||
|
|
||||||
where = WMGetViewScreenPosition(WMWidgetView(label));
|
where = WMGetViewScreenPosition(WMWidgetView(label));
|
||||||
|
|
||||||
WMDragImageFromView(WMWidgetView(label),
|
WMDragImageFromView(WMWidgetView(label),
|
||||||
WMGetLabelImage(label),
|
WMGetLabelImage(label),
|
||||||
NULL, /* XXX */
|
NULL, /* XXX */
|
||||||
@@ -939,11 +941,11 @@ static void
|
|||||||
endedDragImage(WMView *self, WMPixmap *image, WMPoint point, Bool deposited)
|
endedDragImage(WMView *self, WMPixmap *image, WMPoint point, Bool deposited)
|
||||||
{
|
{
|
||||||
DNDStuff *stuff = WMGetHangedData(WMWidgetOfView(self));
|
DNDStuff *stuff = WMGetHangedData(WMWidgetOfView(self));
|
||||||
|
|
||||||
if (deposited) {
|
if (deposited) {
|
||||||
WMDestroyWidget(WMWidgetOfView(self));
|
WMDestroyWidget(WMWidgetOfView(self));
|
||||||
}
|
}
|
||||||
|
|
||||||
stuff->mouseDown = False;
|
stuff->mouseDown = False;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -998,21 +1000,21 @@ performDragOperation(WMView *self, WMDraggingInfo *info, WMData *data)
|
|||||||
{
|
{
|
||||||
char *file = (char*)WMDataBytes(data);
|
char *file = (char*)WMDataBytes(data);
|
||||||
WMPoint pos;
|
WMPoint pos;
|
||||||
|
|
||||||
pos = WMGetDraggingInfoImageLocation(info);
|
pos = WMGetDraggingInfoImageLocation(info);
|
||||||
|
|
||||||
if (file!=NULL) {
|
if (file!=NULL) {
|
||||||
WMLabel *label;
|
WMLabel *label;
|
||||||
WMPoint pos2 = WMGetViewScreenPosition(self);
|
WMPoint pos2 = WMGetViewScreenPosition(self);
|
||||||
|
|
||||||
|
|
||||||
label = makeDraggableLabel(WMWidgetOfView(self), file,
|
label = makeDraggableLabel(WMWidgetOfView(self), file,
|
||||||
pos.x-pos2.x, pos.y-pos2.y);
|
pos.x-pos2.x, pos.y-pos2.y);
|
||||||
WMRealizeWidget(label);
|
WMRealizeWidget(label);
|
||||||
WMMapWidget(label);
|
WMMapWidget(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1043,24 +1045,24 @@ makeDraggableLabel(WMWidget *w, char *file, int x, int y)
|
|||||||
DNDStuff *stuff;
|
DNDStuff *stuff;
|
||||||
WMLabel *label;
|
WMLabel *label;
|
||||||
WMPixmap *image = getImage(WMWidgetScreen(w), file);
|
WMPixmap *image = getImage(WMWidgetScreen(w), file);
|
||||||
|
|
||||||
stuff = wmalloc(sizeof(DNDStuff));
|
stuff = wmalloc(sizeof(DNDStuff));
|
||||||
stuff->mouseDown = False;
|
stuff->mouseDown = False;
|
||||||
|
|
||||||
stuff->filename = wstrdup(file);
|
stuff->filename = wstrdup(file);
|
||||||
|
|
||||||
label = WMCreateLabel(w);
|
label = WMCreateLabel(w);
|
||||||
WMResizeWidget(label, 48, 48);
|
WMResizeWidget(label, 48, 48);
|
||||||
WMMoveWidget(label, x, y);
|
WMMoveWidget(label, x, y);
|
||||||
|
|
||||||
WMSetViewDragSourceProcs(WMWidgetView(label), &dragSourceProcs);
|
WMSetViewDragSourceProcs(WMWidgetView(label), &dragSourceProcs);
|
||||||
|
|
||||||
WMHangData(label, stuff);
|
WMHangData(label, stuff);
|
||||||
|
|
||||||
WMCreateEventHandler(WMWidgetView(label),
|
WMCreateEventHandler(WMWidgetView(label),
|
||||||
ButtonPressMask|ButtonReleaseMask|ButtonMotionMask,
|
ButtonPressMask|ButtonReleaseMask|ButtonMotionMask,
|
||||||
iconMouseStuff, label);
|
iconMouseStuff, label);
|
||||||
|
|
||||||
|
|
||||||
if (image != NULL) {
|
if (image != NULL) {
|
||||||
WMSetLabelImagePosition(label, WIPImageOnly);
|
WMSetLabelImagePosition(label, WIPImageOnly);
|
||||||
@@ -1102,31 +1104,31 @@ testDragAndDrop(WMScreen *scr)
|
|||||||
|
|
||||||
WMRegisterViewForDraggedTypes(WMWidgetView(frame), types);
|
WMRegisterViewForDraggedTypes(WMWidgetView(frame), types);
|
||||||
WMSetViewDragDestinationProcs(WMWidgetView(frame), &dragDestProcs);
|
WMSetViewDragDestinationProcs(WMWidgetView(frame), &dragDestProcs);
|
||||||
|
|
||||||
dir = opendir("../../WindowMaker/Icons");
|
dir = opendir("../../WindowMaker/Icons");
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
perror("../../WindowMaker/Icons");
|
perror("../../WindowMaker/Icons");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, j=0; j < 8; i++) {
|
for (i = 0, j=0; j < 8; i++) {
|
||||||
ent = readdir(dir);
|
ent = readdir(dir);
|
||||||
if (!ent)
|
if (!ent)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (strstr(ent->d_name, ".xpm")==NULL) {
|
if (strstr(ent->d_name, ".xpm")==NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
label = makeDraggableLabel(frame, ent->d_name,4+(j/4)*64, 4+(j%4)*64);
|
label = makeDraggableLabel(frame, ent->d_name,4+(j/4)*64, 4+(j%4)*64);
|
||||||
|
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
|
||||||
WMMapSubwidgets(frame);
|
WMMapSubwidgets(frame);
|
||||||
|
|
||||||
WMMapSubwidgets(win);
|
WMMapSubwidgets(win);
|
||||||
WMRealizeWidget(win);
|
WMRealizeWidget(win);
|
||||||
WMMapWidget(win);
|
WMMapWidget(win);
|
||||||
@@ -1160,25 +1162,25 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
WMScreen *scr;
|
WMScreen *scr;
|
||||||
WMPixmap *pixmap;
|
WMPixmap *pixmap;
|
||||||
|
|
||||||
|
|
||||||
/* Initialize the application */
|
/* Initialize the application */
|
||||||
WMInitializeApplication("Test", &argc, argv);
|
WMInitializeApplication("Test", &argc, argv);
|
||||||
|
|
||||||
testUD();
|
testUD();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open connection to the X display.
|
* Open connection to the X display.
|
||||||
*/
|
*/
|
||||||
dpy = XOpenDisplay("");
|
dpy = XOpenDisplay("");
|
||||||
|
|
||||||
if (!dpy) {
|
if (!dpy) {
|
||||||
puts("could not open display");
|
puts("could not open display");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is used to disable buffering of X protocol requests.
|
/* This is used to disable buffering of X protocol requests.
|
||||||
* Do NOT use it unless when debugging. It will cause a major
|
* Do NOT use it unless when debugging. It will cause a major
|
||||||
* slowdown in your application
|
* slowdown in your application
|
||||||
*/
|
*/
|
||||||
#if 1
|
#if 1
|
||||||
@@ -1193,15 +1195,15 @@ main(int argc, char **argv)
|
|||||||
* Loads the logo of the application.
|
* Loads the logo of the application.
|
||||||
*/
|
*/
|
||||||
pixmap = WMCreatePixmapFromFile(scr, "logo.xpm");
|
pixmap = WMCreatePixmapFromFile(scr, "logo.xpm");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Makes the logo be used in standard dialog panels.
|
* Makes the logo be used in standard dialog panels.
|
||||||
*/
|
*/
|
||||||
WMSetApplicationIconImage(scr, pixmap); WMReleasePixmap(pixmap);
|
WMSetApplicationIconImage(scr, pixmap); WMReleasePixmap(pixmap);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do some test stuff.
|
* Do some test stuff.
|
||||||
*
|
*
|
||||||
* Put the testSomething() function you want to test here.
|
* Put the testSomething() function you want to test here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1218,12 +1220,12 @@ main(int argc, char **argv)
|
|||||||
testFontPanel(scr);
|
testFontPanel(scr);
|
||||||
|
|
||||||
testScrollView(scr);
|
testScrollView(scr);
|
||||||
|
|
||||||
testButton(scr);
|
testButton(scr);
|
||||||
|
|
||||||
testFrame(scr);
|
testFrame(scr);
|
||||||
|
|
||||||
|
|
||||||
testTabView(scr);
|
testTabView(scr);
|
||||||
|
|
||||||
|
|
||||||
@@ -1241,7 +1243,7 @@ main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* The main event loop.
|
* The main event loop.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WMScreenMainLoop(scr);
|
WMScreenMainLoop(scr);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user