コード例 #1
0
ファイル: wtest.c プロジェクト: awmaker/awmaker
void testScrollView(WMScreen * scr)
{
	WMWindow *win;
	WMScrollView *sview;
	WMFrame *f;
	WMLabel *l;
	char buffer[128];
	int i;

	windowCount++;

	/* creates the top-level window */
	win = WMCreateWindow(scr, "testScroll");
	WMSetWindowTitle(win, "Scrollable View");

	WMSetWindowCloseAction(win, closeAction, NULL);

	/* set the window size */
	WMResizeWidget(win, 300, 300);

	/* creates a scrollable view inside the top-level window */
	sview = WMCreateScrollView(win);
	WMResizeWidget(sview, 200, 200);
	WMMoveWidget(sview, 30, 30);
	WMSetScrollViewRelief(sview, WRSunken);
	WMSetScrollViewHasVerticalScroller(sview, True);
	WMSetScrollViewHasHorizontalScroller(sview, True);

	/* create a frame with a bunch of labels */
	f = WMCreateFrame(win);
	WMResizeWidget(f, 400, 400);
	WMSetFrameRelief(f, WRFlat);

	for (i = 0; i < 20; i++) {
		l = WMCreateLabel(f);
		WMResizeWidget(l, 50, 18);
		WMMoveWidget(l, 10, 20 * i);
		sprintf(buffer, "Label %i", i);
		WMSetLabelText(l, buffer);
		WMSetLabelRelief(l, WRSimple);
	}
	WMMapSubwidgets(f);
	WMMapWidget(f);

	WMSetScrollViewContentView(sview, WMWidgetView(f));

	/* make the windows of the widgets be actually created */
	WMRealizeWidget(win);

	/* Map all child widgets of the top-level be mapped.
	 * You must call this for each container widget (like frames),
	 * even if they are childs of the top-level window.
	 */
	WMMapSubwidgets(win);

	/* map the top-level window */
	WMMapWidget(win);
}
コード例 #2
0
ファイル: wtest.c プロジェクト: awmaker/awmaker
void testSplitView(WMScreen * scr)
{
	WMWindow *win;
	WMSplitView *splitv1, *splitv2;
	WMFrame *frame;
	WMLabel *label;
	WMButton *button;

	windowCount++;

	win = WMCreateWindow(scr, "testTabs");
	WMResizeWidget(win, 300, 400);
	WMSetWindowCloseAction(win, closeAction, NULL);

	frame = WMCreateFrame(win);
	WMSetFrameRelief(frame, WRSunken);
	WMMoveWidget(frame, 5, 5);
	WMResizeWidget(frame, 290, 40);

	splitv1 = WMCreateSplitView(win);
	WMMoveWidget(splitv1, 5, 50);
	WMResizeWidget(splitv1, 290, 345);
	WMSetSplitViewConstrainProc(splitv1, splitViewConstrainProc);
	WMCreateEventHandler(WMWidgetView(win), StructureNotifyMask, resizeSplitView, splitv1);

	button = WMCreateCommandButton(frame);
	WMSetButtonText(button, "+");
	WMSetButtonAction(button, appendSubviewButtonAction, splitv1);
	WMMoveWidget(button, 10, 8);
	WMMapWidget(button);

	button = WMCreateCommandButton(frame);
	WMSetButtonText(button, "-");
	WMSetButtonAction(button, removeSubviewButtonAction, splitv1);
	WMMoveWidget(button, 80, 8);
	WMMapWidget(button);

	button = WMCreateCommandButton(frame);
	WMSetButtonText(button, "=");
	WMMoveWidget(button, 150, 8);
	WMSetButtonAction(button, adjustSubviewsButtonAction, splitv1);
	WMMapWidget(button);

	button = WMCreateCommandButton(frame);
	WMSetButtonText(button, "#");
	WMMoveWidget(button, 220, 8);
	WMSetButtonAction(button, orientationButtonAction, splitv1);
	WMMapWidget(button);

	label = WMCreateLabel(splitv1);
	WMSetLabelText(label, "Subview 1");
	WMSetLabelRelief(label, WRSunken);
	WMMapWidget(label);
	WMAddSplitViewSubview(splitv1, WMWidgetView(label));

	splitv2 = WMCreateSplitView(splitv1);
	WMResizeWidget(splitv2, 150, 150);
	WMSetSplitViewVertical(splitv2, True);

	label = WMCreateLabel(splitv2);
	WMSetLabelText(label, "Subview 2.1");
	WMSetLabelRelief(label, WRSunken);
	WMMapWidget(label);
	WMAddSplitViewSubview(splitv2, WMWidgetView(label));

	label = WMCreateLabel(splitv2);
	WMSetLabelText(label, "Subview 2.2");
	WMSetLabelRelief(label, WRSunken);
	WMMapWidget(label);
	WMAddSplitViewSubview(splitv2, WMWidgetView(label));

	label = WMCreateLabel(splitv2);
	WMSetLabelText(label, "Subview 2.3");
	WMSetLabelRelief(label, WRSunken);
	WMMapWidget(label);
	WMAddSplitViewSubview(splitv2, WMWidgetView(label));

	WMMapWidget(splitv2);
	WMAddSplitViewSubview(splitv1, WMWidgetView(splitv2));

	WMRealizeWidget(win);
	WMMapSubwidgets(win);
	WMMapWidget(win);
}
コード例 #3
0
ファイル: wtest.c プロジェクト: awmaker/awmaker
void testTabView(WMScreen * scr)
{
	WMWindow *win;
	WMTabView *tabv;
	WMTabViewItem *tab;
	WMFrame *frame;
	WMLabel *label;

	windowCount++;

	win = WMCreateWindow(scr, "testTabs");
	WMResizeWidget(win, 400, 300);

	WMSetWindowCloseAction(win, closeAction, NULL);

	tabv = WMCreateTabView(win);
	WMMoveWidget(tabv, 50, 50);
	WMResizeWidget(tabv, 300, 200);

	frame = WMCreateFrame(win);
	WMSetFrameRelief(frame, WRFlat);
	label = WMCreateLabel(frame);
	WMResizeWidget(label, 100, 100);
	WMSetLabelText(label, "Label 1");
	WMMapWidget(label);

	tab = WMCreateTabViewItemWithIdentifier(0);
	WMSetTabViewItemView(tab, WMWidgetView(frame));
	WMAddItemInTabView(tabv, tab);
	WMSetTabViewItemLabel(tab, "Instances");

	frame = WMCreateFrame(win);
	WMSetFrameRelief(frame, WRFlat);
	label = WMCreateLabel(frame);
	WMResizeWidget(label, 40, 50);
	WMSetLabelText(label, "Label 2");
	WMMapWidget(label);

	tab = WMCreateTabViewItemWithIdentifier(0);
	WMSetTabViewItemView(tab, WMWidgetView(frame));
	WMAddItemInTabView(tabv, tab);
	WMSetTabViewItemLabel(tab, "Classes");

	frame = WMCreateFrame(win);
	WMSetFrameRelief(frame, WRFlat);
	label = WMCreateLabel(frame);
	WMResizeWidget(label, 100, 100);
	WMMoveWidget(label, 60, 40);
	WMSetLabelText(label, "Label 3");
	WMMapWidget(label);

	tab = WMCreateTabViewItemWithIdentifier(0);
	WMSetTabViewItemView(tab, WMWidgetView(frame));
	WMAddItemInTabView(tabv, tab);
	WMSetTabViewItemLabel(tab, "Something");

	frame = WMCreateFrame(win);
	WMSetFrameRelief(frame, WRFlat);
	label = WMCreateLabel(frame);
	WMResizeWidget(label, 100, 100);
	WMMoveWidget(label, 160, 40);
	WMSetLabelText(label, "Label 4");
	WMMapWidget(label);

	tab = WMCreateTabViewItemWithIdentifier(0);
	WMSetTabViewItemView(tab, WMWidgetView(frame));
	WMAddItemInTabView(tabv, tab);
	WMSetTabViewItemLabel(tab, "Bla!");

	frame = WMCreateFrame(win);
	WMSetFrameRelief(frame, WRFlat);
	label = WMCreateLabel(frame);
	WMResizeWidget(label, 100, 100);
	WMMoveWidget(label, 160, 40);
	WMSetLabelText(label, "Label fjweqklrj qwl");
	WMMapWidget(label);
	tab = WMCreateTabViewItemWithIdentifier(0);
	WMSetTabViewItemView(tab, WMWidgetView(frame));
	WMAddItemInTabView(tabv, tab);
	WMSetTabViewItemLabel(tab, "Weee!");

	WMRealizeWidget(win);
	WMMapSubwidgets(win);
	WMMapWidget(win);
}
コード例 #4
0
static void
createPanel(Panel *p)
{
    _Panel *panel = (_Panel*)p;
    WMScreen *scr = WMWidgetScreen(panel->parent);
    WMTabViewItem *tab;

    panel->white = WMWhiteColor(scr);
    panel->black = WMBlackColor(scr);
    panel->gray = WMGrayColor(scr);
    panel->red = WMCreateRGBColor(scr, 0xffff, 0, 0, True);
    panel->font = WMSystemFontOfSize(scr, 12);

    panel->box = WMCreateBox(panel->parent);
    WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);


    panel->tabv = WMCreateTabView(panel->box);
    WMMoveWidget(panel->tabv, 12, 10);
    WMResizeWidget(panel->tabv, 500, 215);



    /* icon path */
    panel->icoF = WMCreateFrame(panel->box);
    WMSetFrameRelief(panel->icoF, WRFlat);
    WMResizeWidget(panel->icoF, 230, 210);

    tab = WMCreateTabViewItemWithIdentifier(0);
    WMSetTabViewItemView(tab, WMWidgetView(panel->icoF));
    WMAddItemInTabView(panel->tabv, tab);
    WMSetTabViewItemLabel(tab, _("Icon Search Paths"));

    panel->icoL = WMCreateList(panel->icoF);
    WMResizeWidget(panel->icoL, 480, 147);
    WMMoveWidget(panel->icoL, 10, 10);
    WMSetListUserDrawProc(panel->icoL, paintItem);
    WMHangData(panel->icoL, panel);

    panel->icoaB = WMCreateCommandButton(panel->icoF);
    WMResizeWidget(panel->icoaB, 95, 24);
    WMMoveWidget(panel->icoaB, 293, 165);
    WMSetButtonText(panel->icoaB, _("Add"));
    WMSetButtonAction(panel->icoaB, browseForFile, panel);
    WMSetButtonImagePosition(panel->icoaB, WIPRight);

    panel->icorB = WMCreateCommandButton(panel->icoF);
    WMResizeWidget(panel->icorB, 95, 24);
    WMMoveWidget(panel->icorB, 395, 165);
    WMSetButtonText(panel->icorB, _("Remove"));
    WMSetButtonAction(panel->icorB, pushButton, panel);

    WMMapSubwidgets(panel->icoF);

    /* pixmap path */
    panel->pixF = WMCreateFrame(panel->box);
    WMSetFrameRelief(panel->pixF, WRFlat);
    WMResizeWidget(panel->pixF, 230, 210);

    tab = WMCreateTabViewItemWithIdentifier(0);
    WMSetTabViewItemView(tab, WMWidgetView(panel->pixF));
    WMAddItemInTabView(panel->tabv, tab);
    WMSetTabViewItemLabel(tab, _("Pixmap Search Paths"));

    panel->pixL = WMCreateList(panel->pixF);
    WMResizeWidget(panel->pixL, 480, 147);
    WMMoveWidget(panel->pixL, 10, 10);
    WMSetListUserDrawProc(panel->pixL, paintItem);
    WMHangData(panel->pixL, panel);

    panel->pixaB = WMCreateCommandButton(panel->pixF);
    WMResizeWidget(panel->pixaB, 95, 24);
    WMMoveWidget(panel->pixaB, 293, 165);
    WMSetButtonText(panel->pixaB, _("Add"));
    WMSetButtonAction(panel->pixaB, browseForFile, panel);
    WMSetButtonImagePosition(panel->pixaB, WIPRight);

    panel->pixrB = WMCreateCommandButton(panel->pixF);
    WMResizeWidget(panel->pixrB, 95, 24);
    WMMoveWidget(panel->pixrB, 395, 165);
    WMSetButtonText(panel->pixrB, _("Remove"));
    WMSetButtonAction(panel->pixrB, pushButton, panel);


    WMMapSubwidgets(panel->pixF);

    WMRealizeWidget(panel->box);
    WMMapSubwidgets(panel->box);

    showData(panel);
}