예제 #1
0
파일: fontl.c 프로젝트: cneira/wmaker-crm
int main(int argc, char **argv)
{
	Display *dpy;
	WMWindow *win;
	WMScreen *scr;
	WMButton *lab, *l0 = NULL;
	WMLabel *pos;
	int x, y, c;
	char buf[20];

	WMInitializeApplication("FontView", &argc, argv);

	dpy = XOpenDisplay("");
	if (!dpy) {
		wfatal("cant open display");
		exit(0);
	}

	scr = WMCreateSimpleApplicationScreen(dpy);

	win = WMCreateWindow(scr, "main");
	WMResizeWidget(win, 20 * 33, 20 + 20 * 9);
	WMSetWindowTitle(win, "Font Chars");
	WMSetWindowCloseAction(win, quit, NULL);
	pos = WMCreateLabel(win);
	WMResizeWidget(pos, 20 * 33, 20);
	WMMoveWidget(pos, 10, 5);

	c = 0;
	for (y = 0; y < 8; y++) {
		for (x = 0; x < 32; x++, c++) {
			lab = WMCreateCustomButton(win, WBBStateLightMask);
			WMResizeWidget(lab, 20, 20);
			WMMoveWidget(lab, 10 + x * 20, 30 + y * 20);
			sprintf(buf, "%c", c);
			WMSetButtonText(lab, buf);
			WMSetButtonAction(lab, show, pos);
			WMHangData(lab, (void *)(uintptr_t) c);
			if (c > 0) {
				WMGroupButtons(l0, lab);
			} else {
				l0 = lab;
			}
		}
	}
	WMRealizeWidget(win);
	WMMapSubwidgets(win);
	WMMapWidget(win);
	WMScreenMainLoop(scr);
	return 0;
}
예제 #2
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);
}