static void sgrabClicked(WMWidget * w, void *data) { _Panel *panel = (_Panel *) data; Display *dpy = WMScreenDisplay(WMWidgetScreen(panel->parent)); char *shortcut; if (w == panel->sclearB) { WMSetTextFieldText(panel->shortT, ""); updateMenuItem(panel, panel->currentItem, panel->shortT); return; } if (!panel->capturing) { panel->capturing = 1; WMSetButtonText(w, _("Cancel")); XGrabKeyboard(dpy, WMWidgetXID(panel->parent), True, GrabModeAsync, GrabModeAsync, CurrentTime); shortcut = capture_shortcut(dpy, &panel->capturing, 0); if (shortcut) { WMSetTextFieldText(panel->shortT, shortcut); updateMenuItem(panel, panel->currentItem, panel->shortT); wfree(shortcut); } } panel->capturing = 0; WMSetButtonText(w, _("Capture")); XUngrabKeyboard(dpy, CurrentTime); }
static void downloadCallback(WMWidget * w, void *data) { _Panel *panel = (_Panel *) data; pid_t newPid; WMButton *button = (WMButton *) w; pid_t *pid; if (button == panel->totB) { pid = &panel->tilePID; } else { pid = &panel->barPID; } if (*pid == 0) { newPid = downloadFile(WMWidgetScreen(w), panel, NULL); if (newPid < 0) { return; } WMSetButtonText(button, _("Stop")); if (button == panel->totB) { AddDeadChildHandler(newPid, finishedTileDownload, data); } else { AddDeadChildHandler(newPid, finishedBarDownload, data); } *pid = newPid; } else { *pid = 0; WMSetButtonText(button, _("Download")); } }
void testBox(WMScreen * scr) { WMWindow *win; WMBox *box, *hbox; WMButton *btn; WMPopUpButton *pop; int i; windowCount++; win = WMCreateWindow(scr, "testBox"); WMSetWindowTitle(win, "Box"); WMSetWindowCloseAction(win, closeAction, NULL); WMResizeWidget(win, 400, 300); box = WMCreateBox(win); WMSetBoxBorderWidth(box, 5); WMSetViewExpandsToParent(WMWidgetView(box), 0, 0, 0, 0); /*WMSetBoxHorizontal(box, True); */ for (i = 0; i < 4; i++) { btn = WMCreateCommandButton(box); WMSetButtonText(btn, "bla"); WMMapWidget(btn); WMAddBoxSubview(box, WMWidgetView(btn), i & 1, True, 20, 0, 5); } pop = WMCreatePopUpButton(box); WMAddPopUpButtonItem(pop, "ewqeq"); WMAddPopUpButtonItem(pop, "ewqeqrewrw"); WMAddBoxSubview(box, WMWidgetView(pop), False, True, 20, 0, 5); WMMapWidget(pop); hbox = WMCreateBox(box); WMSetBoxHorizontal(hbox, True); WMAddBoxSubview(box, WMWidgetView(hbox), False, True, 24, 0, 0); WMMapWidget(hbox); for (i = 0; i < 4; i++) { btn = WMCreateCommandButton(hbox); WMSetButtonText(btn, "bla"); WMMapWidget(btn); WMAddBoxSubview(hbox, WMWidgetView(btn), 1, True, 60, 0, i < 3 ? 5 : 0); } WMRealizeWidget(win); WMMapSubwidgets(win); WMMapWidget(win); }
static void finishedTileDownload(void *data) { _Panel *panel = (_Panel *) data; WMSetButtonText(panel->totB, _("Set")); panel->tilePID = 0; }
void testButton(WMScreen * scr) { WMWindow *win; int i; char *types[] = { "MomentaryPush", "PushOnPushOff", "Toggle", "Switch", "Radio", "MomentaryChange", "OnOff", "MomentaryLigh" }; windowCount++; win = WMCreateWindow(scr, "testButton"); WMResizeWidget(win, 300, 300); WMSetWindowTitle(win, "Buttons"); WMSetWindowCloseAction(win, closeAction, NULL); for (i = 1; i < 9; i++) { WMButton *b; b = WMCreateButton(win, i); WMResizeWidget(b, 150, 24); WMMoveWidget(b, 20, i * 30); WMSetButtonText(b, types[i - 1]); } WMRealizeWidget(win); WMMapSubwidgets(win); WMMapWidget(win); }
static void finishedBarDownload(void *data) { _Panel *panel = (_Panel *) data; WMSetButtonText(panel->botB, _("Set")); panel->barPID = 0; }
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; }
static void createPanel(Panel * p) { _Panel *panel = (_Panel *) p; WMScreen *scr = WMWidgetScreen(panel->parent); WMPixmap *icon; char *buf1, *buf2; int i; RColor color; char *path; color.red = 0xae; color.green = 0xaa; color.blue = 0xae; panel->box = WMCreateBox(panel->parent); WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2); /**************** Mouse Speed ****************/ panel->speedF = WMCreateFrame(panel->box); WMResizeWidget(panel->speedF, 219, 85); WMMoveWidget(panel->speedF, 9, 54); WMSetFrameTitle(panel->speedF, _("Mouse Speed")); panel->speedL = WMCreateLabel(panel->speedF); WMResizeWidget(panel->speedL, 40, 46); WMMoveWidget(panel->speedL, 8, 10); WMSetLabelImagePosition(panel->speedL, WIPImageOnly); path = LocateImage(SPEED_ICON_FILE); if (path) { icon = WMCreateBlendedPixmapFromFile(scr, path, &color); if (icon) { WMSetLabelImage(panel->speedL, icon); WMReleasePixmap(icon); } else { wwarning(_("could not load icon %s"), path); } wfree(path); } panel->speedS = WMCreateSlider(panel->speedF); WMResizeWidget(panel->speedS, 150, 15); WMMoveWidget(panel->speedS, 58, 30); WMSetSliderMinValue(panel->speedS, 0); WMSetSliderMaxValue(panel->speedS, 40); WMSetSliderContinuous(panel->speedS, False); WMSetSliderAction(panel->speedS, speedChange, panel); panel->acceL = WMCreateLabel(panel->speedF); WMResizeWidget(panel->acceL, 50, 16); WMMoveWidget(panel->acceL, 8, 58); WMSetLabelTextAlignment(panel->acceL, WARight); WMSetLabelText(panel->acceL, _("Accel.:")); panel->acceT = WMCreateTextField(panel->speedF); WMResizeWidget(panel->acceT, 40, 20); WMMoveWidget(panel->acceT, 58, 56); WMAddNotificationObserver(returnPressed, panel, WMTextDidEndEditingNotification, panel->acceT); panel->threL = WMCreateLabel(panel->speedF); WMResizeWidget(panel->threL, 80, 16); WMMoveWidget(panel->threL, 98, 58); WMSetLabelTextAlignment(panel->threL, WARight); WMSetLabelText(panel->threL, _("Threshold:")); panel->threT = WMCreateTextField(panel->speedF); WMResizeWidget(panel->threT, 30, 20); WMMoveWidget(panel->threT, 178, 56); WMAddNotificationObserver(returnPressed, panel, WMTextDidEndEditingNotification, panel->threT); WMMapSubwidgets(panel->speedF); /* ************** Grab Modifier **************** */ panel->grabF = WMCreateFrame(panel->box); WMResizeWidget(panel->grabF, 219, 46); WMMoveWidget(panel->grabF, 9, 5); WMSetFrameTitle(panel->grabF, _("Mouse Grab Modifier")); WMSetBalloonTextForView(_("Keyboard modifier to use for actions that\n" "involve dragging windows with the mouse,\n" "clicking inside the window."), WMWidgetView(panel->grabF)); panel->grabP = WMCreatePopUpButton(panel->grabF); WMResizeWidget(panel->grabP, 178, 20); WMMoveWidget(panel->grabP, 20, 17); fillModifierPopUp(panel->grabP); WMMapSubwidgets(panel->grabF); /***************** Doubleclick Delay ****************/ panel->ddelaF = WMCreateFrame(panel->box); WMResizeWidget(panel->ddelaF, 219, 80); WMMoveWidget(panel->ddelaF, 9, 142); WMSetFrameTitle(panel->ddelaF, _("Double-Click Delay")); buf1 = wmalloc(strlen(DELAY_ICON) + 2); buf2 = wmalloc(strlen(DELAY_ICON_S) + 2); for (i = 0; i < wlengthof(panel->ddelaB); i++) { panel->ddelaB[i] = WMCreateCustomButton(panel->ddelaF, WBBStateChangeMask); WMResizeWidget(panel->ddelaB[i], 25, 25); WMMoveWidget(panel->ddelaB[i], 18 + (40 * i), 18); WMSetButtonBordered(panel->ddelaB[i], False); WMSetButtonImagePosition(panel->ddelaB[i], WIPImageOnly); WMSetButtonAction(panel->ddelaB[i], doubleClick, panel); if (i > 0) { WMGroupButtons(panel->ddelaB[0], panel->ddelaB[i]); } sprintf(buf1, DELAY_ICON, i + 1); sprintf(buf2, DELAY_ICON_S, i + 1); path = LocateImage(buf1); if (path) { icon = WMCreatePixmapFromFile(scr, path); if (icon) { WMSetButtonImage(panel->ddelaB[i], icon); WMReleasePixmap(icon); } else { wwarning(_("could not load icon file %s"), path); } wfree(path); } path = LocateImage(buf2); if (path) { icon = WMCreatePixmapFromFile(scr, path); if (icon) { WMSetButtonAltImage(panel->ddelaB[i], icon); WMReleasePixmap(icon); } else { wwarning(_("could not load icon file %s"), path); } wfree(path); } } wfree(buf1); wfree(buf2); panel->tester = CreateDoubleTest(panel->ddelaF, _("Test")); WMResizeWidget(panel->tester, 84, 24); WMMoveWidget(panel->tester, 20, 48); panel->ddelaT = WMCreateTextField(panel->ddelaF); WMResizeWidget(panel->ddelaT, 40, 20); WMMoveWidget(panel->ddelaT, 130, 50); panel->ddelaL = WMCreateLabel(panel->ddelaF); WMResizeWidget(panel->ddelaL, 40, 16); WMMoveWidget(panel->ddelaL, 173, 54); { WMFont *font; WMColor *color; font = WMSystemFontOfSize(scr, 10); color = WMDarkGrayColor(scr); WMSetLabelTextColor(panel->ddelaL, color); WMSetLabelFont(panel->ddelaL, font); WMReleaseFont(font); WMReleaseColor(color); } WMSetLabelText(panel->ddelaL, _("ms")); WMMapSubwidgets(panel->ddelaF); /* ************** Workspace Action Buttons **************** */ panel->menuF = WMCreateFrame(panel->box); WMResizeWidget(panel->menuF, 276, 217); WMMoveWidget(panel->menuF, 236, 5); WMSetFrameTitle(panel->menuF, _("Workspace Mouse Actions")); panel->disaB = WMCreateSwitchButton(panel->menuF); WMResizeWidget(panel->disaB, 254, 18); WMMoveWidget(panel->disaB, 10, 15); WMSetButtonText(panel->disaB, _("Disable mouse actions")); WMSetButtonAction(panel->disaB, toggle_disabling_of_mouse_actions, panel); for (i = 0; i < wlengthof(button_list); i++) { int j; panel->mouse_action[i].label = WMCreateLabel(panel->menuF); WMResizeWidget(panel->mouse_action[i].label, 115, 20); WMMoveWidget(panel->mouse_action[i].label, 4, 37 + 25 * i); WMSetLabelTextAlignment(panel->mouse_action[i].label, WARight); WMSetLabelText(panel->mouse_action[i].label, _(button_list[i].display_label)); panel->mouse_action[i].popup = WMCreatePopUpButton(panel->menuF); WMResizeWidget(panel->mouse_action[i].popup, 145, 20); WMMoveWidget(panel->mouse_action[i].popup, 121, 37 + 25 * i); if (button_list[i].type == T_BUTTON) { for (j = 0; j < wlengthof(button_actions); j++) WMAddPopUpButtonItem(panel->mouse_action[i].popup, _(button_actions[j].label)); } else { for (j = 0; j < wlengthof(wheel_actions); j++) WMAddPopUpButtonItem(panel->mouse_action[i].popup, _(wheel_actions[j].label)); } } WMMapSubwidgets(panel->menuF); WMRealizeWidget(panel->box); WMMapSubwidgets(panel->box); showData(panel); }
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); }
void testGradientButtons(WMScreen * scr) { WMWindow *win; WMButton *btn; WMPixmap *pix1, *pix2; RImage *back; RColor light, dark; WMColor *color, *altColor; windowCount++; /* creates the top-level window */ win = WMCreateWindow(scr, "testGradientButtons"); WMSetWindowTitle(win, "Gradiented Button Demo"); WMResizeWidget(win, 300, 200); WMSetWindowCloseAction(win, closeAction, NULL); light.red = 0x90; light.green = 0x85; light.blue = 0x90; dark.red = 0x35; dark.green = 0x30; dark.blue = 0x35; color = WMCreateRGBColor(scr, 0x5900, 0x5100, 0x5900, True); WMSetWidgetBackgroundColor(win, color); WMReleaseColor(color); back = RRenderGradient(60, 24, &dark, &light, RGRD_DIAGONAL); RBevelImage(back, RBEV_RAISED2); pix1 = WMCreatePixmapFromRImage(scr, back, 0); RReleaseImage(back); back = RRenderGradient(60, 24, &dark, &light, RGRD_DIAGONAL); RBevelImage(back, RBEV_SUNKEN); pix2 = WMCreatePixmapFromRImage(scr, back, 0); RReleaseImage(back); color = WMWhiteColor(scr); altColor = WMCreateNamedColor(scr, "red", True); btn = WMCreateButton(win, WBTMomentaryChange); WMResizeWidget(btn, 60, 24); WMMoveWidget(btn, 20, 100); WMSetButtonBordered(btn, False); WMSetButtonImagePosition(btn, WIPOverlaps); WMSetButtonImage(btn, pix1); WMSetButtonAltImage(btn, pix2); WMSetButtonText(btn, "Cool"); WMSetButtonTextColor(btn, color); WMSetButtonAltTextColor(btn, altColor); WMSetBalloonTextForView("This is a cool button", WMWidgetView(btn)); btn = WMCreateButton(win, WBTMomentaryChange); WMResizeWidget(btn, 60, 24); WMMoveWidget(btn, 90, 100); WMSetButtonBordered(btn, False); WMSetButtonImagePosition(btn, WIPOverlaps); WMSetButtonImage(btn, pix1); WMSetButtonAltImage(btn, pix2); WMSetButtonText(btn, "Button"); WMSetButtonTextColor(btn, color); WMSetBalloonTextForView("Este é outro balão.", WMWidgetView(btn)); WMReleaseColor(color); color = WMCreateNamedColor(scr, "orange", True); btn = WMCreateButton(win, WBTMomentaryChange); WMResizeWidget(btn, 60, 24); WMMoveWidget(btn, 160, 100); WMSetButtonBordered(btn, False); WMSetButtonImagePosition(btn, WIPOverlaps); WMSetButtonImage(btn, pix1); WMSetButtonAltImage(btn, pix2); WMSetButtonText(btn, "Test"); WMSetButtonTextColor(btn, color); WMSetBalloonTextForView("This is yet another button.\nBut the balloon has 3 lines.\nYay!", WMWidgetView(btn)); WMReleaseColor(color); WMReleaseColor(altColor); WMRealizeWidget(win); WMMapSubwidgets(win); WMMapWidget(win); }
static void createPanel(Panel * p) { _Panel *panel = (_Panel *) p; WMScreen *scr = WMWidgetScreen(panel->parent); int i; char *buf1, *buf2; WMPixmap *icon; WMColor *color; WMFont *font; panel->box = WMCreateBox(panel->parent); WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2); /***************** Input Focus Mode *****************/ panel->kfocF = WMCreateFrame(panel->box); WMResizeWidget(panel->kfocF, 240, 125); WMMoveWidget(panel->kfocF, 15, 10); WMSetFrameTitle(panel->kfocF, _("Input Focus Mode")); { WMBox *box = WMCreateBox(panel->kfocF); WMSetViewExpandsToParent(WMWidgetView(box), 10, 15, 10, 10); WMSetBoxHorizontal(box, False); panel->kfocB[0] = WMCreateRadioButton(box); WMSetButtonText(panel->kfocB[0], _("Manual: Click on the window to set " "keyboard input focus.")); WMAddBoxSubview(box, WMWidgetView(panel->kfocB[0]), True, True, 20, 0, 0); panel->kfocB[1] = WMCreateRadioButton(box); WMGroupButtons(panel->kfocB[0], panel->kfocB[1]); WMSetButtonText(panel->kfocB[1], _("Auto: Set keyboard input focus to " "the window under the mouse pointer.")); WMAddBoxSubview(box, WMWidgetView(panel->kfocB[1]), True, True, 20, 0, 0); WMMapSubwidgets(box); WMMapWidget(box); } /***************** Colormap Installation Mode ****************/ panel->cfocF = WMCreateFrame(panel->box); WMResizeWidget(panel->cfocF, 240, 77); WMMoveWidget(panel->cfocF, 15, 143); WMSetFrameTitle(panel->cfocF, _("Install colormap in the window...")); panel->manB = WMCreateRadioButton(panel->cfocF); WMResizeWidget(panel->manB, 225, 20); WMMoveWidget(panel->manB, 10, 20); WMSetButtonText(panel->manB, _("...that has the input focus.")); panel->autB = WMCreateRadioButton(panel->cfocF); WMResizeWidget(panel->autB, 225, 20); WMMoveWidget(panel->autB, 10, 45); WMSetButtonText(panel->autB, _("...that's under the mouse pointer.")); WMGroupButtons(panel->manB, panel->autB); WMMapSubwidgets(panel->cfocF); /***************** Automatic window raise delay *****************/ panel->raisF = WMCreateFrame(panel->box); WMResizeWidget(panel->raisF, 245, 68); WMMoveWidget(panel->raisF, 265, 10); WMSetFrameTitle(panel->raisF, _("Automatic Window Raise Delay")); buf1 = wmalloc(strlen(DELAY_ICON) + 1); buf2 = wmalloc(strlen(DELAY_ICON_S) + 1); for (i = 0; i < 5; i++) { char *path; panel->raisB[i] = WMCreateCustomButton(panel->raisF, WBBStateChangeMask); WMResizeWidget(panel->raisB[i], 25, 25); WMMoveWidget(panel->raisB[i], 12 + (30 * i), 25); WMSetButtonBordered(panel->raisB[i], False); WMSetButtonImagePosition(panel->raisB[i], WIPImageOnly); WMSetButtonAction(panel->raisB[i], pushDelayButton, panel); if (i > 0) WMGroupButtons(panel->raisB[0], panel->raisB[i]); sprintf(buf1, DELAY_ICON, i); sprintf(buf2, DELAY_ICON_S, i); path = LocateImage(buf1); if (path) { icon = WMCreatePixmapFromFile(scr, path); if (icon) { WMSetButtonImage(panel->raisB[i], icon); WMReleasePixmap(icon); } else { wwarning(_("could not load icon file %s"), path); } wfree(path); } path = LocateImage(buf2); if (path) { icon = WMCreatePixmapFromFile(scr, path); if (icon) { WMSetButtonAltImage(panel->raisB[i], icon); WMReleasePixmap(icon); } else { wwarning(_("could not load icon file %s"), path); } wfree(path); } } wfree(buf1); wfree(buf2); panel->raisT = WMCreateTextField(panel->raisF); WMResizeWidget(panel->raisT, 36, 20); WMMoveWidget(panel->raisT, 165, 28); WMAddNotificationObserver(raiseTextChanged, panel, WMTextDidChangeNotification, panel->raisT); color = WMDarkGrayColor(scr); font = WMSystemFontOfSize(scr, 10); panel->raisL = WMCreateLabel(panel->raisF); WMResizeWidget(panel->raisL, 36, 16); WMMoveWidget(panel->raisL, 205, 32); WMSetLabelText(panel->raisL, _("msec")); WMSetLabelTextColor(panel->raisL, color); WMSetLabelFont(panel->raisL, font); WMReleaseColor(color); WMReleaseFont(font); WMMapSubwidgets(panel->raisF); /***************** Options ****************/ panel->optF = WMCreateFrame(panel->box); WMResizeWidget(panel->optF, 245, 132); WMMoveWidget(panel->optF, 265, 88); panel->ignB = WMCreateSwitchButton(panel->optF); WMResizeWidget(panel->ignB, 225, 50); WMMoveWidget(panel->ignB, 10, 4); WMSetButtonText(panel->ignB, _("Do not let applications receive " "the click used to focus windows.")); panel->newB = WMCreateSwitchButton(panel->optF); WMResizeWidget(panel->newB, 225, 35); WMMoveWidget(panel->newB, 10, 49); WMSetButtonText(panel->newB, _("Automatically focus new windows.")); panel->craisB = WMCreateSwitchButton(panel->optF); WMResizeWidget(panel->craisB, 225, 36); WMMoveWidget(panel->craisB, 10, 85); WMSetButtonText(panel->craisB, _("Raise window when switching\nfocus with keyboard.")); WMMapSubwidgets(panel->optF); WMRealizeWidget(panel->box); WMMapSubwidgets(panel->box); showData(panel); }
static void create_tab_window_advanced(WWindow *wwin, InspectorPanel *panel, int frame_width) { int i = 0; char *caption = NULL, *descr = NULL; int flag = 0; panel->moreFrm = WMCreateFrame(panel->win); WMSetFrameTitle(panel->moreFrm, _("Advanced")); WMMoveWidget(panel->moreFrm, 15, 45); WMResizeWidget(panel->moreFrm, frame_width, 265); for (i = 0; i < wlengthof(panel->moreChk); i++) { switch (i) { case 0: caption = _("Do not bind keyboard shortcuts"); flag = WFLAGP(wwin, no_bind_keys); descr = _("Do not bind keyboard shortcuts from Window Maker\n" "when this window is focused. This will allow the\n" "window to receive all key combinations regardless\n" "of your shortcut configuration."); break; case 1: caption = _("Do not bind mouse clicks"); flag = WFLAGP(wwin, no_bind_mouse); descr = _("Do not bind mouse actions, such as `Alt'+drag\n" "in the window (when alt is the modifier you have\n" "configured)."); break; case 2: caption = _("Do not show in the window list"); flag = WFLAGP(wwin, skip_window_list); descr = _("Do not list the window in the window list menu."); break; case 3: caption = _("Do not show in the switch panel"); flag = WFLAGP(wwin, skip_switchpanel); descr = _("Do not include in switch panel while cycling windows."); break; case 4: caption = _("Do not let it take focus"); flag = WFLAGP(wwin, no_focusable); descr = _("Do not let the window take keyboard focus when you\n" "click on it."); break; case 5: caption = _("Keep inside screen"); flag = WFLAGP(wwin, dont_move_off); descr = _("Do not allow the window to move itself completely\n" "outside the screen. For bug compatibility.\n"); break; case 6: caption = _("Ignore 'Hide Others'"); flag = WFLAGP(wwin, no_hide_others); descr = _("Do not hide the window when issuing the\n" "`HideOthers' command."); break; case 7: caption = _("Ignore 'Save Session'"); flag = WFLAGP(wwin, dont_save_session); descr = _("Do not save the associated application in the\n" "session's state, so that it won't be restarted\n" "together with other applications when Window Maker\n" "starts."); break; case 8: caption = _("Emulate application icon"); flag = WFLAGP(wwin, emulate_appicon); descr = _("Make this window act as an application that provides\n" "enough information to Window Maker for a dockable\n" "application icon to be created."); break; case 9: caption = _("Focus across workspaces"); flag = WFLAGP(wwin, focus_across_wksp); descr = _("Allow Window Maker to switch workspace to satisfy\n" "a focus request (annoying)."); break; case 10: caption = _("Do not let it be minimized"); flag = WFLAGP(wwin, no_miniaturizable); descr = _("Do not let the window of this application be\n" "minimized.\n"); break; #ifdef XKB_BUTTON_HINT case 11: caption = _("Disable language button"); flag = WFLAGP(wwin, no_language_button); descr = _("Remove the `toggle language' button of the window."); break; #endif } panel->moreChk[i] = WMCreateSwitchButton(panel->moreFrm); WMMoveWidget(panel->moreChk[i], 10, 20 * (i + 1)); WMResizeWidget(panel->moreChk[i], frame_width - 15, 20); WMSetButtonSelected(panel->moreChk[i], flag); WMSetButtonText(panel->moreChk[i], caption); WMSetBalloonTextForView(descr, WMWidgetView(panel->moreChk[i])); } }
static InspectorPanel *createInspectorForWindow(WWindow *wwin, int xpos, int ypos, Bool showSelectPanel) { WScreen *scr = wwin->screen_ptr; InspectorPanel *panel; Window parent; char *str = NULL, *tmp = NULL; int x, y, btn_width, frame_width; WMButton *selectedBtn = NULL; spec_text = _("The configuration will apply to all\n" "windows that have their WM_CLASS\n" "property set to the above selected\n" "name, when saved."); panel = wmalloc(sizeof(InspectorPanel)); memset(panel, 0, sizeof(InspectorPanel)); panel->destroyed = 0; panel->inspected = wwin; panel->nextPtr = panelList; panelList = panel; panel->win = WMCreateWindow(scr->wmscreen, "windowInspector"); WMResizeWidget(panel->win, PWIDTH, PHEIGHT); /**** create common stuff ****/ /* command buttons */ btn_width = (PWIDTH - (2 * 15) - (2 * 10)) / 3; panel->saveBtn = WMCreateCommandButton(panel->win); WMSetButtonAction(panel->saveBtn, saveSettings, panel); WMMoveWidget(panel->saveBtn, (2 * (btn_width + 10)) + 15, PHEIGHT - 40); WMSetButtonText(panel->saveBtn, _("Save")); WMResizeWidget(panel->saveBtn, btn_width, 28); if (wPreferences.flags.noupdates || !(wwin->wm_class || wwin->wm_instance)) WMSetButtonEnabled(panel->saveBtn, False); panel->applyBtn = WMCreateCommandButton(panel->win); WMSetButtonAction(panel->applyBtn, applySettings, panel); WMMoveWidget(panel->applyBtn, btn_width + 10 + 15, PHEIGHT - 40); WMSetButtonText(panel->applyBtn, _("Apply")); WMResizeWidget(panel->applyBtn, btn_width, 28); panel->revertBtn = WMCreateCommandButton(panel->win); WMSetButtonAction(panel->revertBtn, revertSettings, panel); WMMoveWidget(panel->revertBtn, 15, PHEIGHT - 40); WMSetButtonText(panel->revertBtn, _("Reload")); WMResizeWidget(panel->revertBtn, btn_width, 28); /* page selection popup button */ panel->pagePopUp = WMCreatePopUpButton(panel->win); WMSetPopUpButtonAction(panel->pagePopUp, changePage, panel); WMMoveWidget(panel->pagePopUp, 25, 15); WMResizeWidget(panel->pagePopUp, PWIDTH - 50, 20); WMAddPopUpButtonItem(panel->pagePopUp, _("Window Specification")); WMAddPopUpButtonItem(panel->pagePopUp, _("Window Attributes")); WMAddPopUpButtonItem(panel->pagePopUp, _("Advanced Options")); WMAddPopUpButtonItem(panel->pagePopUp, _("Icon and Initial Workspace")); WMAddPopUpButtonItem(panel->pagePopUp, _("Application Specific")); /**** window spec ****/ frame_width = PWIDTH - (2 * 15); panel->specFrm = WMCreateFrame(panel->win); WMSetFrameTitle(panel->specFrm, _("Window Specification")); WMMoveWidget(panel->specFrm, 15, 65); WMResizeWidget(panel->specFrm, frame_width, 145); panel->defaultRb = WMCreateRadioButton(panel->specFrm); WMMoveWidget(panel->defaultRb, 10, 78); WMResizeWidget(panel->defaultRb, frame_width - (2 * 10), 20); WMSetButtonText(panel->defaultRb, _("Defaults for all windows")); WMSetButtonSelected(panel->defaultRb, False); WMSetButtonAction(panel->defaultRb, selectSpecification, panel); if (wwin->wm_class && wwin->wm_instance) { tmp = wstrconcat(wwin->wm_instance, "."); str = wstrconcat(tmp, wwin->wm_class); panel->bothRb = WMCreateRadioButton(panel->specFrm); WMMoveWidget(panel->bothRb, 10, 18); WMResizeWidget(panel->bothRb, frame_width - (2 * 10), 20); WMSetButtonText(panel->bothRb, str); wfree(tmp); wfree(str); WMGroupButtons(panel->defaultRb, panel->bothRb); if (!selectedBtn) selectedBtn = panel->bothRb; WMSetButtonAction(panel->bothRb, selectSpecification, panel); } if (wwin->wm_instance) { panel->instRb = WMCreateRadioButton(panel->specFrm); WMMoveWidget(panel->instRb, 10, 38); WMResizeWidget(panel->instRb, frame_width - (2 * 10), 20); WMSetButtonText(panel->instRb, wwin->wm_instance); WMGroupButtons(panel->defaultRb, panel->instRb); if (!selectedBtn) selectedBtn = panel->instRb; WMSetButtonAction(panel->instRb, selectSpecification, panel); } if (wwin->wm_class) { panel->clsRb = WMCreateRadioButton(panel->specFrm); WMMoveWidget(panel->clsRb, 10, 58); WMResizeWidget(panel->clsRb, frame_width - (2 * 10), 20); WMSetButtonText(panel->clsRb, wwin->wm_class); WMGroupButtons(panel->defaultRb, panel->clsRb); if (!selectedBtn) selectedBtn = panel->clsRb; WMSetButtonAction(panel->clsRb, selectSpecification, panel); } panel->selWinB = WMCreateCommandButton(panel->specFrm); WMMoveWidget(panel->selWinB, 20, 145 - 24 - 10); WMResizeWidget(panel->selWinB, frame_width - 2 * 10 - 20, 24); WMSetButtonText(panel->selWinB, _("Select window")); WMSetButtonAction(panel->selWinB, selectWindow, panel); panel->specLbl = WMCreateLabel(panel->win); WMMoveWidget(panel->specLbl, 15, 210); WMResizeWidget(panel->specLbl, frame_width, 100); WMSetLabelText(panel->specLbl, spec_text); WMSetLabelWraps(panel->specLbl, True); WMSetLabelTextAlignment(panel->specLbl, WALeft); /**** attributes ****/ create_tab_window_attributes(wwin, panel, frame_width); create_tab_window_advanced(wwin, panel, frame_width); create_tab_icon_workspace(wwin, panel); create_tab_app_specific(wwin, panel, frame_width); /* if the window is a transient, don't let it have a miniaturize button */ if (wwin->transient_for != None && wwin->transient_for != scr->root_win) WMSetButtonEnabled(panel->attrChk[3], False); else WMSetButtonEnabled(panel->attrChk[3], True); if (!wwin->wm_class && !wwin->wm_instance) WMSetPopUpButtonItemEnabled(panel->pagePopUp, 0, False); WMRealizeWidget(panel->win); WMMapSubwidgets(panel->win); WMMapSubwidgets(panel->specFrm); WMMapSubwidgets(panel->attrFrm); WMMapSubwidgets(panel->moreFrm); WMMapSubwidgets(panel->iconFrm); WMMapSubwidgets(panel->wsFrm); if (panel->appFrm) WMMapSubwidgets(panel->appFrm); if (showSelectPanel) { WMSetPopUpButtonSelectedItem(panel->pagePopUp, 0); changePage(panel->pagePopUp, panel); } else { WMSetPopUpButtonSelectedItem(panel->pagePopUp, 1); changePage(panel->pagePopUp, panel); } parent = XCreateSimpleWindow(dpy, scr->root_win, 0, 0, PWIDTH, PHEIGHT, 0, 0, 0); XSelectInput(dpy, parent, KeyPressMask | KeyReleaseMask); panel->parent = parent; XReparentWindow(dpy, WMWidgetXID(panel->win), parent, 0, 0); WMMapWidget(panel->win); XSetTransientForHint(dpy, parent, wwin->client_win); if (xpos == UNDEFINED_POS) { x = wwin->frame_x + wwin->frame->core->width / 2; y = wwin->frame_y + wwin->frame->top_width * 2; if (y + PHEIGHT > scr->scr_height) y = scr->scr_height - PHEIGHT - 30; if (x + PWIDTH > scr->scr_width) x = scr->scr_width - PWIDTH; } else { x = xpos; y = ypos; } panel->frame = wManageInternalWindow(scr, parent, wwin->client_win, "Inspector", x, y, PWIDTH, PHEIGHT); if (!selectedBtn) selectedBtn = panel->defaultRb; WMSetButtonSelected(selectedBtn, True); selectSpecification(selectedBtn, panel); /* kluge to know who should get the key events */ panel->frame->client_leader = WMWidgetXID(panel->win); WSETUFLAG(panel->frame, no_closable, 0); WSETUFLAG(panel->frame, no_close_button, 0); wWindowUpdateButtonImages(panel->frame); wFrameWindowShowButton(panel->frame->frame, WFF_RIGHT_BUTTON); panel->frame->frame->on_click_right = destroyInspector; wWindowMap(panel->frame); showIconFor(WMWidgetScreen(panel->alwChk), panel, wwin->wm_instance, wwin->wm_class, UPDATE_TEXT_FIELD); return panel; }
int main(int argc, char **argv) { Display *dpy; WMScreen *scr; int x, y, i; WMInitializeApplication("Puzzle", &argc, argv); dpy = XOpenDisplay(""); if (!dpy) { printf("could not open display\n"); exit(1); } scr = WMCreateScreen(dpy, DefaultScreen(dpy)); win = WMCreateWindow(scr, "puzzle"); WMResizeWidget(win, WinSize, WinSize); WMSetWindowTitle(win, "zuPzel"); WMSetWindowMinSize(win, 80, 80); WMSetWindowAspectRatio(win, 2, 2, 2, 2); WMSetWindowResizeIncrements(win, Size, Size); WMSetViewNotifySizeChanges(WMWidgetView(win), True); WMAddNotificationObserver(resizeObserver, NULL, WMViewSizeDidChangeNotification, WMWidgetView(win)); for (i = y = 0; y < Size && i < Size*Size-1; y++) { for (x = 0; x < Size && i < Size*Size-1; x++) { char buf[32]; WMColor *color; RColor col; RHSVColor hsv; hsv.hue = i*360/(Size*Size-1); hsv.saturation = 120; hsv.value = 200; RHSVtoRGB(&hsv, &col); color = WMCreateRGBColor(scr, col.red<<8, col.green<<8, col.blue<<8, False); MAP(x,y) = i; Button[i] = WMCreateButton(win, WBTMomentaryLight); WMSetWidgetBackgroundColor(Button[i], color); WMReleaseColor(color); WMSetButtonAction(Button[i], buttonClick, (void*)i); WMResizeWidget(Button[i], WinSize/Size, WinSize/Size); WMMoveWidget(Button[i], x*(WinSize/Size), y*(WinSize/Size)); sprintf(buf, "%i", i+1); WMSetButtonText(Button[i], buf); WMSetButtonTextAlignment(Button[i], WACenter); i++; } } WMMapSubwidgets(win); WMMapWidget(win); WMRealizeWidget(win); ResetGame(); WMScreenMainLoop(scr); return 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); }
static void create_tab_app_specific(WWindow *wwin, InspectorPanel *panel, int frame_width) { WScreen *scr = wwin->screen_ptr; int i = 0, flag = 0, tmp; char *caption = NULL, *descr = NULL; if (wwin->main_window != None) { WApplication *wapp = wApplicationOf(wwin->main_window); panel->appFrm = WMCreateFrame(panel->win); WMSetFrameTitle(panel->appFrm, _("Application Attributes")); WMMoveWidget(panel->appFrm, 15, 50); WMResizeWidget(panel->appFrm, frame_width, 240); for (i = 0; i < wlengthof(panel->appChk); i++) { switch (i) { case 0: caption = _("Start hidden"); flag = WFLAGP(wapp->main_window_desc, start_hidden); descr = _("Automatically hide application when it's started."); break; case 1: caption = _("No application icon"); flag = WFLAGP(wapp->main_window_desc, no_appicon); descr = _("Disable the application icon for the application.\n" "Note that you won't be able to dock it anymore,\n" "and any icons that are already docked will stop\n" "working correctly."); break; case 2: caption = _("Shared application icon"); flag = WFLAGP(wapp->main_window_desc, shared_appicon); descr = _("Use a single shared application icon for all of\n" "the instances of this application.\n"); break; } panel->appChk[i] = WMCreateSwitchButton(panel->appFrm); WMMoveWidget(panel->appChk[i], 10, 20 * (i + 1)); WMResizeWidget(panel->appChk[i], 205, 20); WMSetButtonSelected(panel->appChk[i], flag); WMSetButtonText(panel->appChk[i], caption); WMSetBalloonTextForView(descr, WMWidgetView(panel->appChk[i])); } if (WFLAGP(wwin, emulate_appicon)) { WMSetButtonEnabled(panel->appChk[1], False); WMSetButtonEnabled(panel->moreChk[7], True); } else { WMSetButtonEnabled(panel->appChk[1], True); WMSetButtonEnabled(panel->moreChk[7], False); } } else { if ((wwin->transient_for != None && wwin->transient_for != scr->root_win) || !wwin->wm_class || !wwin->wm_instance) tmp = False; else tmp = True; WMSetButtonEnabled(panel->moreChk[7], tmp); WMSetPopUpButtonItemEnabled(panel->pagePopUp, 4, False); panel->appFrm = NULL; } }
static void create_tab_icon_workspace(WWindow *wwin, InspectorPanel *panel) { int i = 0; /* miniwindow/workspace */ panel->iconFrm = WMCreateFrame(panel->win); WMMoveWidget(panel->iconFrm, 15, 50); WMResizeWidget(panel->iconFrm, PWIDTH - (2 * 15), 170); WMSetFrameTitle(panel->iconFrm, _("Miniwindow Image")); panel->iconLbl = WMCreateLabel(panel->iconFrm); WMMoveWidget(panel->iconLbl, PWIDTH - (2 * 15) - 22 - 64, 20); WMResizeWidget(panel->iconLbl, 64, 64); WMSetLabelRelief(panel->iconLbl, WRGroove); WMSetLabelImagePosition(panel->iconLbl, WIPImageOnly); panel->browseIconBtn = WMCreateCommandButton(panel->iconFrm); WMSetButtonAction(panel->browseIconBtn, chooseIconCallback, panel); WMMoveWidget(panel->browseIconBtn, 22, 32); WMResizeWidget(panel->browseIconBtn, 120, 26); WMSetButtonText(panel->browseIconBtn, _("Browse...")); panel->fileLbl = WMCreateLabel(panel->iconFrm); WMMoveWidget(panel->fileLbl, 20, 85); WMResizeWidget(panel->fileLbl, PWIDTH - (2 * 15) - (2 * 20), 14); WMSetLabelText(panel->fileLbl, _("Icon filename:")); panel->fileText = WMCreateTextField(panel->iconFrm); WMMoveWidget(panel->fileText, 20, 105); WMResizeWidget(panel->fileText, PWIDTH - (2 * 20) - (2 * 15), 20); WMSetTextFieldText(panel->fileText, NULL); WMAddNotificationObserver(textEditedObserver, panel, WMTextDidEndEditingNotification, panel->fileText); panel->alwChk = WMCreateSwitchButton(panel->iconFrm); WMMoveWidget(panel->alwChk, 20, 130); WMResizeWidget(panel->alwChk, PWIDTH - (2 * 15) - (2 * 15), 30); WMSetButtonText(panel->alwChk, _("Ignore client supplied icon")); WMSetButtonSelected(panel->alwChk, WFLAGP(wwin, always_user_icon)); panel->wsFrm = WMCreateFrame(panel->win); WMMoveWidget(panel->wsFrm, 15, 225); WMResizeWidget(panel->wsFrm, PWIDTH - (2 * 15), 70); WMSetFrameTitle(panel->wsFrm, _("Initial Workspace")); WMSetBalloonTextForView(_("The workspace to place the window when it's" "first shown."), WMWidgetView(panel->wsFrm)); panel->wsP = WMCreatePopUpButton(panel->wsFrm); WMMoveWidget(panel->wsP, 20, 30); WMResizeWidget(panel->wsP, PWIDTH - (2 * 15) - (2 * 20), 20); WMAddPopUpButtonItem(panel->wsP, _("Nowhere in particular")); for (i = 0; i < w_global.workspace.count; i++) WMAddPopUpButtonItem(panel->wsP, w_global.workspace.array[i]->name); i = wDefaultGetStartWorkspace(wwin->wm_instance, wwin->wm_class); if (i >= 0 && i <= w_global.workspace.count) WMSetPopUpButtonSelectedItem(panel->wsP, i + 1); else WMSetPopUpButtonSelectedItem(panel->wsP, 0); }
static void createPanel(Panel * p) { _Panel *panel = (_Panel *) p; panel->box = WMCreateBox(panel->parent); WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2); panel->saveB = WMCreateCommandButton(panel->box); WMResizeWidget(panel->saveB, 154, 24); WMMoveWidget(panel->saveB, 15, 10); WMSetButtonText(panel->saveB, _("Save Current Theme")); panel->list = WMCreateList(panel->box); WMResizeWidget(panel->list, 154, 150); WMMoveWidget(panel->list, 15, 40); panel->loadB = WMCreateCommandButton(panel->box); WMResizeWidget(panel->loadB, 74, 24); WMMoveWidget(panel->loadB, 15, 200); WMSetButtonText(panel->loadB, _("Load")); panel->instB = WMCreateCommandButton(panel->box); WMResizeWidget(panel->instB, 74, 24); WMMoveWidget(panel->instB, 95, 200); WMSetButtonText(panel->instB, _("Install")); /**************** Tile of the day ****************/ panel->totF = WMCreateFrame(panel->box); WMResizeWidget(panel->totF, 210, 105); WMMoveWidget(panel->totF, 240, 10); WMSetFrameTitle(panel->totF, _("Tile of The Day")); panel->totL = WMCreateLabel(panel->totF); WMResizeWidget(panel->totL, 67, 67); WMMoveWidget(panel->totL, 25, 25); WMSetLabelRelief(panel->totL, WRSunken); panel->totB = WMCreateCommandButton(panel->totF); WMResizeWidget(panel->totB, 86, 24); WMMoveWidget(panel->totB, 105, 45); WMSetButtonText(panel->totB, _("Download")); WMSetButtonAction(panel->totB, downloadCallback, panel); WMMapSubwidgets(panel->totF); /**************** Bar of the day ****************/ panel->botF = WMCreateFrame(panel->box); WMResizeWidget(panel->botF, 315, 95); WMMoveWidget(panel->botF, 190, 125); WMSetFrameTitle(panel->botF, _("Bar of The Day")); panel->botL = WMCreateLabel(panel->botF); WMResizeWidget(panel->botL, 285, 32); WMMoveWidget(panel->botL, 15, 20); WMSetLabelRelief(panel->botL, WRSunken); panel->botB = WMCreateCommandButton(panel->botF); WMResizeWidget(panel->botB, 86, 24); WMMoveWidget(panel->botB, 110, 60); WMSetButtonText(panel->botB, _("Download")); WMSetButtonAction(panel->botB, downloadCallback, panel); WMMapSubwidgets(panel->botF); WMRealizeWidget(panel->box); WMMapSubwidgets(panel->box); showData(panel); }
void ShowDockAppSettingsPanel(WAppIcon * aicon) { AppSettingsPanel *panel; WScreen *scr = aicon->icon->core->screen_ptr; Window parent; WMFont *font; int x, y; WMBox *vbox; panel = wmalloc(sizeof(AppSettingsPanel)); panel->editedIcon = aicon; aicon->panel = panel; aicon->editing = 1; panel->win = WMCreateWindow(scr->wmscreen, "applicationSettings"); WMResizeWidget(panel->win, PWIDTH, PHEIGHT); panel->iconLabel = WMCreateLabel(panel->win); WMResizeWidget(panel->iconLabel, 64, 64); WMMoveWidget(panel->iconLabel, 10, 10); WMSetLabelImagePosition(panel->iconLabel, WIPImageOnly); panel->nameLabel = WMCreateLabel(panel->win); WMResizeWidget(panel->nameLabel, 190, 18); WMMoveWidget(panel->nameLabel, 80, 35); WMSetLabelTextAlignment(panel->nameLabel, WALeft); font = WMBoldSystemFontOfSize(scr->wmscreen, 14); WMSetLabelFont(panel->nameLabel, font); WMReleaseFont(font); if (aicon->wm_class && strcmp(aicon->wm_class, "DockApp") == 0) WMSetLabelText(panel->nameLabel, aicon->wm_instance); else WMSetLabelText(panel->nameLabel, aicon->wm_class); vbox = WMCreateBox(panel->win); WMResizeWidget(vbox, PWIDTH - 20, PHEIGHT - 84 - 10); WMMoveWidget(vbox, 10, 84); panel->autoLaunchBtn = WMCreateSwitchButton(vbox); WMAddBoxSubview(vbox, WMWidgetView(panel->autoLaunchBtn), False, True, 20, 20, 2); WMSetButtonText(panel->autoLaunchBtn, _("Start when Window Maker is started")); WMSetButtonSelected(panel->autoLaunchBtn, aicon->auto_launch); panel->lockBtn = WMCreateSwitchButton(vbox); WMAddBoxSubview(vbox, WMWidgetView(panel->lockBtn), False, True, 20, 20, 5); WMSetButtonText(panel->lockBtn, _("Lock (prevent accidental removal)")); WMSetButtonSelected(panel->lockBtn, aicon->lock); panel->commandFrame = WMCreateFrame(vbox); WMSetFrameTitle(panel->commandFrame, _("Application path and arguments")); WMAddBoxSubview(vbox, WMWidgetView(panel->commandFrame), False, True, 50, 50, 5); panel->commandField = WMCreateTextField(panel->commandFrame); WMResizeWidget(panel->commandField, 256, 20); WMMoveWidget(panel->commandField, 10, 20); WMSetTextFieldText(panel->commandField, aicon->command); WMMapSubwidgets(panel->commandFrame); panel->pasteCommandFrame = WMCreateFrame(vbox); WMSetFrameTitle(panel->pasteCommandFrame, _("Command for middle-click launch")); WMAddBoxSubview(vbox, WMWidgetView(panel->pasteCommandFrame), False, True, 70, 70, 5); panel->pasteCommandField = WMCreateTextField(panel->pasteCommandFrame); WMResizeWidget(panel->pasteCommandField, 256, 20); WMMoveWidget(panel->pasteCommandField, 10, 20); panel->pasteCommandLabel = WMCreateLabel(panel->pasteCommandFrame); WMResizeWidget(panel->pasteCommandLabel, 256, 18); WMMoveWidget(panel->pasteCommandLabel, 10, 45); WMSetTextFieldText(panel->pasteCommandField, aicon->paste_command); WMSetLabelText(panel->pasteCommandLabel, _("%s will be replaced with current selection")); WMMapSubwidgets(panel->pasteCommandFrame); panel->dndCommandFrame = WMCreateFrame(vbox); WMSetFrameTitle(panel->dndCommandFrame, _("Command for files dropped with DND")); WMAddBoxSubview(vbox, WMWidgetView(panel->dndCommandFrame), False, True, 70, 70, 5); panel->dndCommandField = WMCreateTextField(panel->dndCommandFrame); WMResizeWidget(panel->dndCommandField, 256, 20); WMMoveWidget(panel->dndCommandField, 10, 20); panel->dndCommandLabel = WMCreateLabel(panel->dndCommandFrame); WMResizeWidget(panel->dndCommandLabel, 256, 18); WMMoveWidget(panel->dndCommandLabel, 10, 45); #ifdef XDND WMSetTextFieldText(panel->dndCommandField, aicon->dnd_command); WMSetLabelText(panel->dndCommandLabel, _("%d will be replaced with the file name")); #else WMSetTextFieldEditable(panel->dndCommandField, False); WMSetLabelText(panel->dndCommandLabel, _("DND support was not compiled in")); #endif WMMapSubwidgets(panel->dndCommandFrame); panel->iconFrame = WMCreateFrame(vbox); WMSetFrameTitle(panel->iconFrame, _("Icon Image")); WMAddBoxSubview(vbox, WMWidgetView(panel->iconFrame), False, True, 50, 50, 10); panel->iconField = WMCreateTextField(panel->iconFrame); WMResizeWidget(panel->iconField, 176, 20); WMMoveWidget(panel->iconField, 10, 20); WMSetTextFieldText(panel->iconField, wDefaultGetIconFile(aicon->wm_instance, aicon->wm_class, False)); panel->browseBtn = WMCreateCommandButton(panel->iconFrame); WMResizeWidget(panel->browseBtn, 70, 24); WMMoveWidget(panel->browseBtn, 195, 18); WMSetButtonText(panel->browseBtn, _("Browse...")); WMSetButtonAction(panel->browseBtn, chooseIconCallback, panel); { WMBox *hbox; hbox = WMCreateBox(vbox); WMSetBoxHorizontal(hbox, True); WMAddBoxSubview(vbox, WMWidgetView(hbox), False, True, 24, 24, 0); panel->okBtn = WMCreateCommandButton(hbox); WMSetButtonText(panel->okBtn, _("OK")); WMSetButtonAction(panel->okBtn, panelBtnCallback, panel); WMAddBoxSubviewAtEnd(hbox, WMWidgetView(panel->okBtn), False, True, 80, 80, 0); panel->cancelBtn = WMCreateCommandButton(hbox); WMSetButtonText(panel->cancelBtn, _("Cancel")); WMSetButtonAction(panel->cancelBtn, panelBtnCallback, panel); WMAddBoxSubviewAtEnd(hbox, WMWidgetView(panel->cancelBtn), False, True, 80, 80, 5); WMMapSubwidgets(hbox); } WMRealizeWidget(panel->win); WMMapSubwidgets(panel->win); WMMapSubwidgets(vbox); WMMapSubwidgets(panel->iconFrame); updateSettingsPanelIcon(panel); parent = XCreateSimpleWindow(dpy, scr->root_win, 0, 0, PWIDTH, PHEIGHT, 0, 0, 0); XSelectInput(dpy, parent, KeyPressMask | KeyReleaseMask); XReparentWindow(dpy, WMWidgetXID(panel->win), parent, 0, 0); /* * make things relative to head */ { WMRect rect = wGetRectForHead(scr, wGetHeadForPointerLocation(scr)); y = aicon->y_pos; if (y < 0) y = 0; else if (y + PHEIGHT > rect.pos.y + rect.size.height) y = rect.pos.y + rect.size.height - PHEIGHT - 30; if (aicon->dock && aicon->dock->type == WM_DOCK) { if (aicon->dock->on_right_side) x = rect.pos.x + rect.size.width / 2; else x = rect.pos.x + rect.size.width / 2 - PWIDTH - 2; } else { x = rect.pos.x + (rect.size.width - PWIDTH) / 2; } } panel->wwin = wManageInternalWindow(scr, parent, None, _("Docked Application Settings"), x, y, PWIDTH, PHEIGHT); panel->wwin->client_leader = WMWidgetXID(panel->win); panel->parent = parent; WMMapWidget(panel->win); wWindowMap(panel->wwin); }
static void createPanel(Panel * p) { _Panel *panel = (_Panel *) p; WMScreen *scr = WMWidgetScreen(panel->parent); int i; WMColor *color; WMFont *font; color = WMDarkGrayColor(scr); font = WMSystemFontOfSize(scr, 10); panel->box = WMCreateBox(panel->parent); WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2); /**************** Initial Key Repeat ***************/ panel->delaF = WMCreateFrame(panel->box); WMResizeWidget(panel->delaF, 495, 60); WMMoveWidget(panel->delaF, 15, 10); WMSetFrameTitle(panel->delaF, _("Initial Key Repeat")); for (i = 0; i < 4; i++) { panel->delaB[i] = WMCreateButton(panel->delaF, WBTOnOff); WMResizeWidget(panel->delaB[i], 60, 20); WMMoveWidget(panel->delaB[i], 70 + i * 60, 25); if (i > 0) WMGroupButtons(panel->delaB[0], panel->delaB[i]); switch (i) { case 0: WMSetButtonText(panel->delaB[i], "....a"); break; case 1: WMSetButtonText(panel->delaB[i], "...a"); break; case 2: WMSetButtonText(panel->delaB[i], "..a"); break; case 3: WMSetButtonText(panel->delaB[i], ".a"); break; } } panel->dmsT = WMCreateTextField(panel->delaF); WMResizeWidget(panel->dmsT, 50, 20); WMMoveWidget(panel->dmsT, 345, 25); /* WMSetTextFieldAlignment(panel->dmsT, WARight); */ panel->dmsL = WMCreateLabel(panel->delaF); WMResizeWidget(panel->dmsL, 30, 16); WMMoveWidget(panel->dmsL, 400, 30); WMSetLabelTextColor(panel->dmsL, color); WMSetLabelFont(panel->dmsL, font); WMSetLabelText(panel->dmsL, "msec"); WMMapSubwidgets(panel->delaF); /**************** Key Repeat Rate ***************/ panel->rateF = WMCreateFrame(panel->box); WMResizeWidget(panel->rateF, 495, 60); WMMoveWidget(panel->rateF, 15, 95); WMSetFrameTitle(panel->rateF, _("Key Repeat Rate")); for (i = 0; i < 4; i++) { panel->rateB[i] = WMCreateButton(panel->rateF, WBTOnOff); WMResizeWidget(panel->rateB[i], 60, 20); WMMoveWidget(panel->rateB[i], 70 + i * 60, 25); if (i > 0) WMGroupButtons(panel->rateB[0], panel->rateB[i]); switch (i) { case 0: WMSetButtonText(panel->rateB[i], "a....a"); break; case 1: WMSetButtonText(panel->rateB[i], "a...a"); break; case 2: WMSetButtonText(panel->rateB[i], "a..a"); break; case 3: WMSetButtonText(panel->rateB[i], "a.a"); break; } } panel->rmsT = WMCreateTextField(panel->rateF); WMResizeWidget(panel->rmsT, 50, 20); WMMoveWidget(panel->rmsT, 345, 25); /* WMSetTextFieldAlignment(panel->rmsT, WARight); */ panel->rmsL = WMCreateLabel(panel->rateF); WMResizeWidget(panel->rmsL, 30, 16); WMMoveWidget(panel->rmsL, 400, 30); WMSetLabelTextColor(panel->rmsL, color); WMSetLabelFont(panel->rmsL, font); WMSetLabelText(panel->rmsL, "msec"); WMMapSubwidgets(panel->rateF); panel->testT = WMCreateTextField(panel->box); WMResizeWidget(panel->testT, 480, 20); WMMoveWidget(panel->testT, 20, 180); WMSetTextFieldText(panel->testT, _("Type here to test")); WMReleaseColor(color); WMReleaseFont(font); WMRealizeWidget(panel->box); WMMapSubwidgets(panel->box); }
static void create_tab_window_attributes(WWindow *wwin, InspectorPanel *panel, int frame_width) { int i = 0; char *caption = NULL, *descr = NULL; int flag = 0; panel->attrFrm = WMCreateFrame(panel->win); WMSetFrameTitle(panel->attrFrm, _("Attributes")); WMMoveWidget(panel->attrFrm, 15, 45); WMResizeWidget(panel->attrFrm, frame_width, 250); for (i = 0; i < wlengthof(panel->attrChk); i++) { switch (i) { case 0: caption = _("Disable titlebar"); flag = WFLAGP(wwin, no_titlebar); descr = _("Remove the titlebar of this window.\n" "To access the window commands menu of a window\n" "without it's titlebar, press Control+Esc (or the\n" "equivalent shortcut, if you changed the default\n" "settings)."); break; case 1: caption = _("Disable resizebar"); flag = WFLAGP(wwin, no_resizebar); descr = _("Remove the resizebar of this window."); break; case 2: caption = _("Disable close button"); flag = WFLAGP(wwin, no_close_button); descr = _("Remove the `close window' button of this window."); break; case 3: caption = _("Disable miniaturize button"); flag = WFLAGP(wwin, no_miniaturize_button); descr = _("Remove the `miniaturize window' button of the window."); break; case 4: caption = _("Disable border"); flag = WFLAGP(wwin, no_border); descr = _("Remove the 1 pixel black border around the window."); break; case 5: caption = _("Keep on top (floating)"); flag = WFLAGP(wwin, floating); descr = _("Keep the window over other windows, not allowing\n" "them to cover it."); break; case 6: caption = _("Keep at bottom (sunken)"); flag = WFLAGP(wwin, sunken); descr = _("Keep the window under all other windows."); break; case 7: caption = _("Omnipresent"); flag = WFLAGP(wwin, omnipresent); descr = _("Make window present in all workspaces."); break; case 8: caption = _("Start miniaturized"); flag = WFLAGP(wwin, start_miniaturized); descr = _("Make the window be automatically miniaturized when it's\n" "first shown."); break; case 9: caption = _("Start maximized"); flag = WFLAGP(wwin, start_maximized != 0); descr = _("Make the window be automatically maximized when it's\n" "first shown."); break; case 10: caption = _("Full screen maximization"); flag = WFLAGP(wwin, full_maximize); descr = _("Make the window use the whole screen space when it's\n" "maximized. The titlebar and resizebar will be moved\n" "to outside the screen."); break; } panel->attrChk[i] = WMCreateSwitchButton(panel->attrFrm); WMMoveWidget(panel->attrChk[i], 10, 20 * (i + 1)); WMResizeWidget(panel->attrChk[i], frame_width - 15, 20); WMSetButtonSelected(panel->attrChk[i], flag); WMSetButtonText(panel->attrChk[i], caption); WMSetBalloonTextForView(descr, WMWidgetView(panel->attrChk[i])); } }
static void createPanel(Panel *p) { _Panel *panel = (_Panel*)p; WMScreen *scr = WMWidgetScreen(panel->parent); WMPixmap *icon; int i; char *buf1, *buf2; char *path; panel->box = WMCreateBox(panel->parent); WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2); /***************** Menu Scroll Speed ****************/ panel->scrF = WMCreateFrame(panel->box); WMResizeWidget(panel->scrF, 235, 90); WMMoveWidget(panel->scrF, 25, 20); WMSetFrameTitle(panel->scrF, _("Menu Scrolling Speed")); buf1 = wmalloc(strlen(SPEED_IMAGE)+1); buf2 = wmalloc(strlen(SPEED_IMAGE_S)+1); for (i = 0; i < 5; i++) { panel->scrB[i] = WMCreateCustomButton(panel->scrF, WBBStateChangeMask); WMResizeWidget(panel->scrB[i], 40, 40); WMMoveWidget(panel->scrB[i], 15+(40*i), 30); WMSetButtonBordered(panel->scrB[i], False); WMSetButtonImagePosition(panel->scrB[i], WIPImageOnly); if (i > 0) { WMGroupButtons(panel->scrB[0], panel->scrB[i]); } sprintf(buf1, SPEED_IMAGE, i); sprintf(buf2, SPEED_IMAGE_S, i); path = LocateImage(buf1); if (path) { icon = WMCreatePixmapFromFile(scr, path); if (icon) { WMSetButtonImage(panel->scrB[i], icon); WMReleasePixmap(icon); } else { wwarning(_("could not load icon file %s"), path); } wfree(path); } path = LocateImage(buf2); if (path) { icon = WMCreatePixmapFromFile(scr, path); if (icon) { WMSetButtonAltImage(panel->scrB[i], icon); WMReleasePixmap(icon); } else { wwarning(_("could not load icon file %s"), path); } wfree(path); } } wfree(buf1); wfree(buf2); WMMapSubwidgets(panel->scrF); /***************** Submenu Alignment ****************/ panel->aliF = WMCreateFrame(panel->box); WMResizeWidget(panel->aliF, 220, 90); WMMoveWidget(panel->aliF, 280, 20); WMSetFrameTitle(panel->aliF, _("Submenu Alignment")); panel->alinB = WMCreateButton(panel->aliF, WBTOnOff); WMResizeWidget(panel->alinB, 48, 48); WMMoveWidget(panel->alinB, 56, 25); WMSetButtonImagePosition(panel->alinB, WIPImageOnly); path = LocateImage(MENU_ALIGN1); if (path) { icon = WMCreatePixmapFromFile(scr, path); if (icon) { WMSetButtonImage(panel->alinB, icon); WMReleasePixmap(icon); } else { wwarning(_("could not load icon file %s"), path); } wfree(path); } panel->aliyB = WMCreateButton(panel->aliF, WBTOnOff); WMResizeWidget(panel->aliyB, 48, 48); WMMoveWidget(panel->aliyB, 120, 25); WMSetButtonImagePosition(panel->aliyB, WIPImageOnly); path = LocateImage(MENU_ALIGN2); if (path) { icon = WMCreatePixmapFromFile(scr, path); if (icon) { WMSetButtonImage(panel->aliyB, icon); WMReleasePixmap(icon); } else { wwarning(_("could not load icon file %s"), path); } wfree(path); } WMGroupButtons(panel->alinB, panel->aliyB); WMMapSubwidgets(panel->aliF); /***************** Options ****************/ panel->optF = WMCreateFrame(panel->box); WMResizeWidget(panel->optF, 475, 80); WMMoveWidget(panel->optF, 25, 130); panel->wrapB = WMCreateSwitchButton(panel->optF); WMResizeWidget(panel->wrapB, 440, 32); WMMoveWidget(panel->wrapB, 25, 8); WMSetButtonText(panel->wrapB, _("Always open submenus inside the screen, instead of scrolling.\nNote: this is annoying.")); panel->autoB = WMCreateSwitchButton(panel->optF); WMResizeWidget(panel->autoB, 440, 32); WMMoveWidget(panel->autoB, 25, 45); WMSetButtonText(panel->autoB, _("Scroll off-screen menus when pointer is moved over them.")); WMMapSubwidgets(panel->optF); WMRealizeWidget(panel->box); WMMapSubwidgets(panel->box); showData(panel); }
static void createPanel(Panel *p) { _Panel *panel = (_Panel *) p; WMScreen *scr = WMWidgetScreen(panel->parent); char *buf1, *buf2; WMPixmap *icon, *altIcon; RImage *xis = NULL; int i; RContext *rc = WMScreenRContext(scr); WMFont *font = WMSystemFontOfSize(scr, 10); char *path; path = LocateImage(ARQUIVO_XIS); if (path) { xis = RLoadImage(rc, path, 0); if (!xis) wwarning(_("could not load image file %s"), path); wfree(path); } panel->box = WMCreateBox(panel->parent); WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2); /*********** Icon Slide Speed **********/ panel->icoF = WMCreateFrame(panel->box); WMResizeWidget(panel->icoF, 212, 45); WMMoveWidget(panel->icoF, 15, 10); WMSetFrameTitle(panel->icoF, _("Icon Slide Speed")); /*********** Shade Animation Speed **********/ panel->shaF = WMCreateFrame(panel->box); WMResizeWidget(panel->shaF, 212, 45); WMMoveWidget(panel->shaF, 15, 65); WMSetFrameTitle(panel->shaF, _("Shade Animation Speed")); buf1 = wmalloc(strlen(SPEED_IMAGE) + 1); buf2 = wmalloc(strlen(SPEED_IMAGE_S) + 1); for (i = 0; i < 5; i++) { panel->icoB[i] = WMCreateCustomButton(panel->icoF, WBBStateChangeMask); panel->shaB[i] = WMCreateCustomButton(panel->shaF, WBBStateChangeMask); WMResizeWidget(panel->icoB[i], 40, 24); WMMoveWidget(panel->icoB[i], 2 + (40 * i), 15); WMResizeWidget(panel->shaB[i], 40, 24); WMMoveWidget(panel->shaB[i], 2 + (40 * i), 15); WMSetButtonBordered(panel->icoB[i], False); WMSetButtonImagePosition(panel->icoB[i], WIPImageOnly); if (i > 0) { WMGroupButtons(panel->icoB[0], panel->icoB[i]); } WMSetButtonBordered(panel->shaB[i], False); WMSetButtonImagePosition(panel->shaB[i], WIPImageOnly); if (i > 0) { WMGroupButtons(panel->shaB[0], panel->shaB[i]); } sprintf(buf1, SPEED_IMAGE, i); sprintf(buf2, SPEED_IMAGE_S, i); path = LocateImage(buf1); if (path) { icon = WMCreatePixmapFromFile(scr, path); if (icon) { WMSetButtonImage(panel->icoB[i], icon); WMSetButtonImage(panel->shaB[i], icon); WMReleasePixmap(icon); } else { wwarning(_("could not load icon file %s"), path); } wfree(path); } path = LocateImage(buf2); if (path) { icon = WMCreatePixmapFromFile(scr, path); if (icon) { WMSetButtonAltImage(panel->icoB[i], icon); WMSetButtonAltImage(panel->shaB[i], icon); WMReleasePixmap(icon); } else { wwarning(_("could not load icon file %s"), path); } wfree(path); } } wfree(buf1); wfree(buf2); WMMapSubwidgets(panel->icoF); WMMapSubwidgets(panel->shaF); /***************** Smoothed Scaling *****************/ panel->smoF = WMCreateFrame(panel->box); WMResizeWidget(panel->smoF, 94, 100); WMMoveWidget(panel->smoF, 420, 10); WMSetFrameTitle(panel->smoF, _("Smooth Scaling")); panel->smoB = WMCreateButton(panel->smoF, WBTToggle); WMResizeWidget(panel->smoB, 64, 64); WMMoveWidget(panel->smoB, 15, 23); WMSetButtonImagePosition(panel->smoB, WIPImageOnly); path = LocateImage(SMOOTH_IMAGE); if (path) { RImage *image, *scaled; image = RLoadImage(WMScreenRContext(scr), path, 0); wfree(path); scaled = RScaleImage(image, 61, 61); icon = WMCreatePixmapFromRImage(scr, scaled, 128); RReleaseImage(scaled); if (icon) { WMSetButtonImage(panel->smoB, icon); WMReleasePixmap(icon); } scaled = RSmoothScaleImage(image, 61, 61); icon = WMCreatePixmapFromRImage(scr, scaled, 128); RReleaseImage(scaled); if (icon) { WMSetButtonAltImage(panel->smoB, icon); WMReleasePixmap(icon); } RReleaseImage(image); } WMSetBalloonTextForView(_("Smooth scaled background images, neutralizing\n" "the `pixelization' effect. This will slow\n" "down loading of background images considerably."), WMWidgetView(panel->smoB)); WMMapSubwidgets(panel->smoF); /***************** Titlebar Style Size ****************/ panel->titlF = WMCreateFrame(panel->box); WMResizeWidget(panel->titlF, 212, 97); WMMoveWidget(panel->titlF, 15, 120); WMSetFrameTitle(panel->titlF, _("Titlebar Style")); panel->oldsB = WMCreateButton(panel->titlF, WBTOnOff); WMResizeWidget(panel->oldsB, 60, 40); WMMoveWidget(panel->oldsB, 16, 32); WMSetButtonImagePosition(panel->oldsB, WIPImageOnly); path = LocateImage(OLDS_IMAGE); if (path) { icon = WMCreatePixmapFromFile(scr, path); if (icon) { WMSetButtonImage(panel->oldsB, icon); WMReleasePixmap(icon); } wfree(path); } panel->newsB = WMCreateButton(panel->titlF, WBTOnOff); WMResizeWidget(panel->newsB, 60, 40); WMMoveWidget(panel->newsB, 76, 32); WMSetButtonImagePosition(panel->newsB, WIPImageOnly); path = LocateImage(NEWS_IMAGE); if (path) { icon = WMCreatePixmapFromFile(scr, path); if (icon) { WMSetButtonImage(panel->newsB, icon); WMReleasePixmap(icon); } wfree(path); } panel->nextB = WMCreateButton(panel->titlF, WBTOnOff); WMResizeWidget(panel->nextB, 60, 40); WMMoveWidget(panel->nextB, 136, 32); WMSetButtonImagePosition(panel->nextB, WIPImageOnly); path = LocateImage(NEXT_IMAGE); if (path) { icon = WMCreatePixmapFromFile(scr, path); if (icon) { WMSetButtonImage(panel->nextB, icon); WMReleasePixmap(icon); } wfree(path); } WMGroupButtons(panel->newsB, panel->oldsB); WMGroupButtons(panel->newsB, panel->nextB); WMMapSubwidgets(panel->titlF); /**************** Features ******************/ panel->animF = WMCreateFrame(panel->box); WMResizeWidget(panel->animF, 173, 100); WMMoveWidget(panel->animF, 237, 10); WMSetFrameTitle(panel->animF, _("Animations")); panel->animB = WMCreateButton(panel->animF, WBTToggle); WMResizeWidget(panel->animB, 64, 64); WMMoveWidget(panel->animB, 15, 23); WMSetButtonFont(panel->animB, font); WMSetButtonText(panel->animB, _("Animations")); WMSetButtonImagePosition(panel->animB, WIPAbove); CreateImages(scr, rc, xis, ANIM_IMAGE, &altIcon, &icon); if (icon) { WMSetButtonImage(panel->animB, icon); WMReleasePixmap(icon); } if (altIcon) { WMSetButtonAltImage(panel->animB, altIcon); WMReleasePixmap(altIcon); } WMSetBalloonTextForView(_("Disable/enable animations such as those shown\n" "for window miniaturization, shading etc."), WMWidgetView(panel->animB)); panel->supB = WMCreateButton(panel->animF, WBTToggle); WMResizeWidget(panel->supB, 64, 64); WMMoveWidget(panel->supB, 94, 23); WMSetButtonFont(panel->supB, font); WMSetButtonText(panel->supB, _("Superfluous")); WMSetButtonImagePosition(panel->supB, WIPAbove); CreateImages(scr, rc, xis, SUPERF_IMAGE, &altIcon, &icon); if (icon) { WMSetButtonImage(panel->supB, icon); WMReleasePixmap(icon); } if (altIcon) { WMSetButtonAltImage(panel->supB, altIcon); WMReleasePixmap(altIcon); } WMSetBalloonTextForView(_("Disable/enable `superfluous' features and\n" "animations. These include the `ghosting' of the\n" "dock when it's being moved to another side and\n" "the explosion animation when undocking icons."), WMWidgetView(panel->supB)); WMMapSubwidgets(panel->animF); /*********** Dithering **********/ panel->cmapSize = 4; panel->dithF = WMCreateFrame(panel->box); WMResizeWidget(panel->dithF, 277, 97); WMMoveWidget(panel->dithF, 237, 120); WMSetFrameTitle(panel->dithF, _("Dithering colormap for 8bpp")); WMSetBalloonTextForView(_("Number of colors to reserve for Window Maker\n" "on displays that support only 8bpp (PseudoColor)."), WMWidgetView(panel->dithF)); panel->dithB = WMCreateSwitchButton(panel->dithF); WMResizeWidget(panel->dithB, 235, 32); WMMoveWidget(panel->dithB, 15, 15); WMSetButtonText(panel->dithB, _("Disable dithering in any visual/depth")); panel->dithL = WMCreateLabel(panel->dithF); WMResizeWidget(panel->dithL, 75, 16); WMMoveWidget(panel->dithL, 98, 50); WMSetLabelTextAlignment(panel->dithL, WACenter); WMSetLabelText(panel->dithL, "64"); panel->dithS = WMCreateSlider(panel->dithF); WMResizeWidget(panel->dithS, 95, 16); WMMoveWidget(panel->dithS, 90, 65); WMSetSliderMinValue(panel->dithS, 2); WMSetSliderMaxValue(panel->dithS, 6); WMSetSliderContinuous(panel->dithS, True); WMSetSliderAction(panel->dithS, updateLabel, panel); panel->dith1L = WMCreateLabel(panel->dithF); WMResizeWidget(panel->dith1L, 80, 35); WMMoveWidget(panel->dith1L, 5, 50); WMSetLabelTextAlignment(panel->dith1L, WACenter); WMSetLabelFont(panel->dith1L, font); WMSetLabelText(panel->dith1L, _("More colors for\napplications")); panel->dith2L = WMCreateLabel(panel->dithF); WMResizeWidget(panel->dith2L, 80, 35); WMMoveWidget(panel->dith2L, 190, 50); WMSetLabelTextAlignment(panel->dith2L, WACenter); WMSetLabelFont(panel->dith2L, font); WMSetLabelText(panel->dith2L, _("More colors for\nWindow Maker")); WMMapSubwidgets(panel->dithF); WMRealizeWidget(panel->box); WMMapSubwidgets(panel->box); if (xis) RReleaseImage(xis); WMReleaseFont(font); showData(panel); }
static void createPanel(_Panel * p) { _Panel *panel = (_Panel *) p; WMScreen *scr = WMWidgetScreen(panel->parent); WMColor *black = WMBlackColor(scr); WMColor *white = WMWhiteColor(scr); WMColor *gray = WMGrayColor(scr); WMFont *bold = WMBoldSystemFontOfSize(scr, 12); WMFont *font = WMSystemFontOfSize(scr, 12); WMLabel *label; int width; menuDelegate.data = panel; panel->boldFont = bold; panel->normalFont = font; panel->black = black; panel->white = white; panel->gray = gray; { Pixmap pix; Display *dpy = WMScreenDisplay(scr); GC gc; WMPixmap *pixm; pixm = WMCreatePixmap(scr, 7, 7, WMScreenDepth(scr), True); pix = WMGetPixmapXID(pixm); XDrawLine(dpy, pix, WMColorGC(black), 0, 3, 6, 3); XDrawLine(dpy, pix, WMColorGC(black), 3, 0, 3, 6); /* XDrawLine(dpy, pix, WMColorGC(black), 1, 0, 3, 3); XDrawLine(dpy, pix, WMColorGC(black), 1, 6, 3, 3); XDrawLine(dpy, pix, WMColorGC(black), 0, 0, 0, 6); */ pix = WMGetPixmapMaskXID(pixm); gc = XCreateGC(dpy, pix, 0, NULL); XSetForeground(dpy, gc, 0); XFillRectangle(dpy, pix, gc, 0, 0, 7, 7); XSetForeground(dpy, gc, 1); XDrawLine(dpy, pix, gc, 0, 3, 6, 3); XDrawLine(dpy, pix, gc, 3, 0, 3, 6); panel->markerPix[ExternalInfo] = pixm; panel->markerPix[PipeInfo] = pixm; panel->markerPix[PLPipeInfo] = pixm; panel->markerPix[DirectoryInfo] = pixm; panel->markerPix[WSMenuInfo] = pixm; panel->markerPix[WWindowListInfo] = pixm; XFreeGC(dpy, gc); } panel->box = WMCreateBox(panel->parent); WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2); panel->typeP = WMCreatePopUpButton(panel->box); WMResizeWidget(panel->typeP, 150, 20); WMMoveWidget(panel->typeP, 10, 10); WMAddPopUpButtonItem(panel->typeP, _("New Items")); WMAddPopUpButtonItem(panel->typeP, _("Sample Commands")); WMAddPopUpButtonItem(panel->typeP, _("Sample Submenus")); WMSetPopUpButtonAction(panel->typeP, changedItemPad, panel); WMSetPopUpButtonSelectedItem(panel->typeP, 0); { WEditMenu *pad; pad = makeFactoryMenu(panel->box, 150); WMMoveWidget(pad, 10, 40); putNewItem(panel, pad, ExecInfo, _("Run Program")); putNewItem(panel, pad, CommandInfo, _("Internal Command")); putNewSubmenu(pad, _("Submenu")); putNewItem(panel, pad, ExternalInfo, _("External Submenu")); putNewItem(panel, pad, PipeInfo, _("Generated Submenu")); putNewItem(panel, pad, PLPipeInfo, _("Generated PL Menu")); putNewItem(panel, pad, DirectoryInfo, _("Directory Contents")); putNewItem(panel, pad, WSMenuInfo, _("Workspace Menu")); putNewItem(panel, pad, WWindowListInfo, _("Window List Menu")); panel->itemPad[0] = pad; } { WEditMenu *pad; ItemData *data; WMScrollView *sview; sview = WMCreateScrollView(panel->box); WMResizeWidget(sview, 150, 180); WMMoveWidget(sview, 10, 40); WMSetScrollViewHasVerticalScroller(sview, True); pad = makeFactoryMenu(panel->box, 130); WMSetScrollViewContentView(sview, WMWidgetView(pad)); data = putNewItem(panel, pad, ExecInfo, _("XTerm")); data->param.exec.command = "xterm -sb -sl 2000 -bg black -fg white"; data = putNewItem(panel, pad, ExecInfo, _("rxvt")); data->param.exec.command = "rxvt"; data = putNewItem(panel, pad, ExecInfo, _("ETerm")); data->param.exec.command = "eterm"; data = putNewItem(panel, pad, ExecInfo, _("Run...")); data->param.exec.command = _("%A(Run,Type command to run)"); data = putNewItem(panel, pad, ExecInfo, _("Firefox")); data->param.exec.command = "firefox"; data = putNewItem(panel, pad, ExecInfo, _("gimp")); data->param.exec.command = "gimp"; data = putNewItem(panel, pad, ExecInfo, _("epic")); data->param.exec.command = "xterm -e epic"; data = putNewItem(panel, pad, ExecInfo, _("ee")); data->param.exec.command = "ee"; data = putNewItem(panel, pad, ExecInfo, _("xv")); data->param.exec.command = "xv"; data = putNewItem(panel, pad, ExecInfo, _("Evince")); data->param.exec.command = "evince"; data = putNewItem(panel, pad, ExecInfo, _("ghostview")); data->param.exec.command = "gv"; data = putNewItem(panel, pad, CommandInfo, _("Exit Window Maker")); data->param.command.command = 3; WMMapWidget(pad); panel->itemPad[1] = sview; } { WEditMenu *pad, *smenu; ItemData *data; WMScrollView *sview; sview = WMCreateScrollView(panel->box); WMResizeWidget(sview, 150, 180); WMMoveWidget(sview, 10, 40); WMSetScrollViewHasVerticalScroller(sview, True); pad = makeFactoryMenu(panel->box, 130); WMSetScrollViewContentView(sview, WMWidgetView(pad)); data = putNewItem(panel, pad, ExternalInfo, _("Debian Menu")); data->param.pipe.command = "/etc/GNUstep/Defaults/menu.hook"; data = putNewItem(panel, pad, PipeInfo, _("RedHat Menu")); data->param.pipe.command = "wmconfig --output wmaker"; data = putNewItem(panel, pad, PipeInfo, _("Menu Conectiva")); data->param.pipe.command = "wmconfig --output wmaker"; data = putNewItem(panel, pad, DirectoryInfo, _("Themes")); data->param.directory.command = "setstyle"; data->param.directory.directory = "/usr/share/WindowMaker/Themes /usr/local/share/WindowMaker/Themes $HOME/GNUstep/Library/WindowMaker/Themes"; data->param.directory.stripExt = 1; data = putNewItem(panel, pad, DirectoryInfo, _("Bg Images (scale)")); data->param.directory.command = "wmsetbg -u -s"; data->param.directory.directory = "/opt/kde2/share/wallpapers /usr/share/WindowMaker/Backgrounds $HOME/GNUstep/Library/WindowMaker/Backgrounds"; data->param.directory.stripExt = 1; data = putNewItem(panel, pad, DirectoryInfo, _("Bg Images (tile)")); data->param.directory.command = "wmsetbg -u -t"; data->param.directory.directory = "/opt/kde2/share/wallpapers /usr/share/WindowMaker/Backgrounds $HOME/GNUstep/Library/WindowMaker/Backgrounds"; data->param.directory.stripExt = 1; smenu = putNewSubmenu(pad, _("Assorted XTerms")); data = putNewItem(panel, smenu, ExecInfo, _("XTerm Yellow on Blue")); data->param.exec.command = "xterm -sb -sl 2000 -bg midnightblue -fg yellow"; data = putNewItem(panel, smenu, ExecInfo, _("XTerm White on Black")); data->param.exec.command = "xterm -sb -sl 2000 -bg black -fg white"; data = putNewItem(panel, smenu, ExecInfo, _("XTerm Black on White")); data->param.exec.command = "xterm -sb -sl 2000 -bg white -fg black"; data = putNewItem(panel, smenu, ExecInfo, _("XTerm Black on Beige")); data->param.exec.command = "xterm -sb -sl 2000 -bg '#bbbb99' -fg black"; data = putNewItem(panel, smenu, ExecInfo, _("XTerm White on Green")); data->param.exec.command = "xterm -sb -sl 2000 -bg '#228822' -fg white"; data = putNewItem(panel, smenu, ExecInfo, _("XTerm White on Olive")); data->param.exec.command = "xterm -sb -sl 2000 -bg '#335533' -fg white"; data = putNewItem(panel, smenu, ExecInfo, _("XTerm Blue on Blue")); data->param.exec.command = "xterm -sb -sl 2000 -bg '#112244' -fg '#88aabb'"; data = putNewItem(panel, smenu, ExecInfo, _("XTerm BIG FONTS")); data->param.exec.command = "xterm -sb -sl 2000 -bg black -fg white -fn 10x20"; WMMapWidget(pad); panel->itemPad[2] = sview; } width = FRAME_WIDTH - 20 - 150 - 10 - 2; panel->optionsF = WMCreateFrame(panel->box); WMResizeWidget(panel->optionsF, width, FRAME_HEIGHT - 15); WMMoveWidget(panel->optionsF, 10 + 150 + 10, 5); width -= 20; /* command */ panel->commandF = WMCreateFrame(panel->optionsF); WMResizeWidget(panel->commandF, width, 50); WMMoveWidget(panel->commandF, 10, 20); WMSetFrameTitle(panel->commandF, _("Program to Run")); WMSetFrameTitlePosition(panel->commandF, WTPAtTop); panel->commandT = WMCreateTextField(panel->commandF); WMResizeWidget(panel->commandT, width - 95, 20); WMMoveWidget(panel->commandT, 10, 20); panel->browseB = WMCreateCommandButton(panel->commandF); WMResizeWidget(panel->browseB, 70, 24); WMMoveWidget(panel->browseB, width - 80, 18); WMSetButtonText(panel->browseB, _("Browse")); WMSetButtonAction(panel->browseB, browseForFile, panel); WMAddNotificationObserver(dataChanged, panel, WMTextDidChangeNotification, panel->commandT); #if 0 panel->xtermC = WMCreateSwitchButton(panel->commandF); WMResizeWidget(panel->xtermC, width - 20, 20); WMMoveWidget(panel->xtermC, 10, 50); WMSetButtonText(panel->xtermC, _("Run the program inside a Xterm")); #endif WMMapSubwidgets(panel->commandF); /* path */ panel->pathF = WMCreateFrame(panel->optionsF); WMResizeWidget(panel->pathF, width, 150); WMMoveWidget(panel->pathF, 10, 40); WMSetFrameTitle(panel->pathF, _("Path for Menu")); panel->pathT = WMCreateTextField(panel->pathF); WMResizeWidget(panel->pathT, width - 20, 20); WMMoveWidget(panel->pathT, 10, 20); WMAddNotificationObserver(dataChanged, panel, WMTextDidChangeNotification, panel->pathT); label = WMCreateLabel(panel->pathF); WMResizeWidget(label, width - 20, 80); WMMoveWidget(label, 10, 50); WMSetLabelText(label, _("Enter the path for a file containing a menu\n" "or a list of directories with the programs you\n" "want to have listed in the menu. Ex:\n" "~/GNUstep/Library/WindowMaker/menu\n" "or\n" "/usr/bin ~/xbin")); WMMapSubwidgets(panel->pathF); /* pipe */ panel->pipeF = WMCreateFrame(panel->optionsF); WMResizeWidget(panel->pipeF, width, 155); WMMoveWidget(panel->pipeF, 10, 30); WMSetFrameTitle(panel->pipeF, _("Command")); panel->pipeT = WMCreateTextField(panel->pipeF); WMResizeWidget(panel->pipeT, width - 20, 20); WMMoveWidget(panel->pipeT, 10, 20); WMAddNotificationObserver(dataChanged, panel, WMTextDidChangeNotification, panel->pipeT); label = WMCreateLabel(panel->pipeF); WMResizeWidget(label, width - 20, 40); WMMoveWidget(label, 10, 50); WMSetLabelText(label, _("Enter a command that outputs a menu\n" "definition to stdout when invoked.")); panel->pipeCacheB = WMCreateSwitchButton(panel->pipeF); WMResizeWidget(panel->pipeCacheB, width - 20, 40); WMMoveWidget(panel->pipeCacheB, 10, 110); WMSetButtonText(panel->pipeCacheB, _("Cache menu contents after opening for\n" "the first time")); WMMapSubwidgets(panel->pipeF); /* proplist pipe */ panel->plpipeF = WMCreateFrame(panel->optionsF); WMResizeWidget(panel->plpipeF, width, 155); WMMoveWidget(panel->plpipeF, 10, 30); WMSetFrameTitle(panel->plpipeF, _("Command")); panel->plpipeT = WMCreateTextField(panel->plpipeF); WMResizeWidget(panel->plpipeT, width - 20, 20); WMMoveWidget(panel->plpipeT, 10, 20); WMAddNotificationObserver(dataChanged, panel, WMTextDidChangeNotification, panel->plpipeT); label = WMCreateLabel(panel->plpipeF); WMResizeWidget(label, width - 20, 40); WMMoveWidget(label, 10, 50); WMSetLabelText(label, _("Enter a command that outputs a proplist menu\n" "definition to stdout when invoked.")); panel->plpipeCacheB = WMCreateSwitchButton(panel->plpipeF); WMResizeWidget(panel->plpipeCacheB, width - 20, 40); WMMoveWidget(panel->plpipeCacheB, 10, 110); WMSetButtonText(panel->plpipeCacheB, _("Cache menu contents after opening for\n" "the first time")); WMMapSubwidgets(panel->plpipeF); /* directory menu */ panel->dcommandF = WMCreateFrame(panel->optionsF); WMResizeWidget(panel->dcommandF, width, 90); WMMoveWidget(panel->dcommandF, 10, 25); WMSetFrameTitle(panel->dcommandF, _("Command to Open Files")); panel->dcommandT = WMCreateTextField(panel->dcommandF); WMResizeWidget(panel->dcommandT, width - 20, 20); WMMoveWidget(panel->dcommandT, 10, 20); WMAddNotificationObserver(dataChanged, panel, WMTextDidChangeNotification, panel->dcommandT); label = WMCreateLabel(panel->dcommandF); WMResizeWidget(label, width - 20, 45); WMMoveWidget(label, 10, 40); WMSetLabelText(label, _("Enter the command you want to use to open the\n" "files in the directories listed below.")); WMMapSubwidgets(panel->dcommandF); panel->dpathF = WMCreateFrame(panel->optionsF); WMResizeWidget(panel->dpathF, width, 80); WMMoveWidget(panel->dpathF, 10, 125); WMSetFrameTitle(panel->dpathF, _("Directories with Files")); panel->dpathT = WMCreateTextField(panel->dpathF); WMResizeWidget(panel->dpathT, width - 20, 20); WMMoveWidget(panel->dpathT, 10, 20); WMAddNotificationObserver(dataChanged, panel, WMTextDidChangeNotification, panel->dpathT); panel->dstripB = WMCreateSwitchButton(panel->dpathF); WMResizeWidget(panel->dstripB, width - 20, 20); WMMoveWidget(panel->dstripB, 10, 50); WMSetButtonText(panel->dstripB, _("Strip extensions from file names")); WMSetButtonAction(panel->dstripB, buttonClicked, panel); WMMapSubwidgets(panel->dpathF); /* shortcut */ panel->shortF = WMCreateFrame(panel->optionsF); WMResizeWidget(panel->shortF, width, 50); WMMoveWidget(panel->shortF, 10, 160); WMSetFrameTitle(panel->shortF, _("Keyboard Shortcut")); panel->shortT = WMCreateTextField(panel->shortF); WMResizeWidget(panel->shortT, width - 20 - 150, 20); WMMoveWidget(panel->shortT, 10, 20); WMAddNotificationObserver(dataChanged, panel, WMTextDidChangeNotification, panel->shortT); panel->sgrabB = WMCreateCommandButton(panel->shortF); WMResizeWidget(panel->sgrabB, 70, 24); WMMoveWidget(panel->sgrabB, width - 80, 18); WMSetButtonText(panel->sgrabB, _("Capture")); WMSetButtonAction(panel->sgrabB, sgrabClicked, panel); panel->sclearB = WMCreateCommandButton(panel->shortF); WMResizeWidget(panel->sclearB, 70, 24); WMMoveWidget(panel->sclearB, width - 155, 18); WMSetButtonText(panel->sclearB, _("Clear")); WMSetButtonAction(panel->sclearB, sgrabClicked, panel); WMMapSubwidgets(panel->shortF); /* internal command */ panel->icommandL = WMCreateList(panel->optionsF); WMResizeWidget(panel->icommandL, width, 80); WMMoveWidget(panel->icommandL, 10, 20); WMSetListAction(panel->icommandL, icommandLClicked, panel); WMAddNotificationObserver(dataChanged, panel, WMListSelectionDidChangeNotification, panel->icommandL); WMInsertListItem(panel->icommandL, 0, _("Arrange Icons")); WMInsertListItem(panel->icommandL, 1, _("Hide All Windows Except For The Focused One")); WMInsertListItem(panel->icommandL, 2, _("Show All Windows")); WMInsertListItem(panel->icommandL, 3, _("Exit Window Maker")); WMInsertListItem(panel->icommandL, 4, _("Exit X Session")); WMInsertListItem(panel->icommandL, 5, _("Restart Window Maker")); WMInsertListItem(panel->icommandL, 6, _("Start Another Window Manager : (")); WMInsertListItem(panel->icommandL, 7, _("Save Current Session")); WMInsertListItem(panel->icommandL, 8, _("Clear Saved Session")); WMInsertListItem(panel->icommandL, 9, _("Refresh Screen")); WMInsertListItem(panel->icommandL, 10, _("Open Info Panel")); WMInsertListItem(panel->icommandL, 11, _("Open Copyright Panel")); panel->paramF = WMCreateFrame(panel->optionsF); WMResizeWidget(panel->paramF, width, 50); WMMoveWidget(panel->paramF, 10, 105); WMSetFrameTitle(panel->paramF, _("Window Manager to Start")); panel->paramT = WMCreateTextField(panel->paramF); WMResizeWidget(panel->paramT, width - 20, 20); WMMoveWidget(panel->paramT, 10, 20); WMAddNotificationObserver(dataChanged, panel, WMTextDidChangeNotification, panel->paramT); WMMapSubwidgets(panel->paramF); panel->quickB = WMCreateSwitchButton(panel->optionsF); WMResizeWidget(panel->quickB, width, 20); WMMoveWidget(panel->quickB, 10, 120); WMSetButtonText(panel->quickB, _("Do not confirm action.")); WMSetButtonAction(panel->quickB, buttonClicked, panel); label = WMCreateLabel(panel->optionsF); WMResizeWidget(label, width + 5, FRAME_HEIGHT - 50); WMMoveWidget(label, 7, 20); WMSetLabelText(label, _("Instructions:\n\n" " - drag items from the left to the menu to add new items\n" " - drag items out of the menu to remove items\n" " - drag items in menu to change their position\n" " - drag items with Control pressed to copy them\n" " - double click in a menu item to change the label\n" " - click on a menu item to change related information")); WMMapWidget(label); WMRealizeWidget(panel->box); WMMapSubwidgets(panel->box); WMMapWidget(panel->box); { int i; for (i = 0; i < wlengthof(panel->itemPad); i++) WMUnmapWidget(panel->itemPad[i]); } changedItemPad(panel->typeP, panel); panel->sections[NoInfo][0] = label; panel->sections[ExecInfo][0] = panel->commandF; panel->sections[ExecInfo][1] = panel->shortF; panel->sections[CommandInfo][0] = panel->icommandL; panel->sections[CommandInfo][1] = panel->shortF; panel->sections[ExternalInfo][0] = panel->pathF; panel->sections[PipeInfo][0] = panel->pipeF; panel->sections[PLPipeInfo][0] = panel->plpipeF; panel->sections[DirectoryInfo][0] = panel->dpathF; panel->sections[DirectoryInfo][1] = panel->dcommandF; panel->currentType = NoInfo; showData(panel); { WMPoint pos; pos = WMGetViewScreenPosition(WMWidgetView(panel->box)); if (pos.x < 200) { pos.x += FRAME_WIDTH + 20; } else { pos.x = 10; } pos.y = WMAX(pos.y - 100, 0); if (panel->menu) WEditMenuShowAt(panel->menu, pos.x, pos.y); } }
int main (int argc, char **argv){ WMFrame *glframe; WMScreen *screen; WMWindow *window; WMButton *Button; /* Xlib and glX variables */ Window win; XVisualInfo *xvVisualInfo; Colormap cmColorMap; XSetWindowAttributes winAttr; GLXContext glXContext; getargs(argc,argv); WMInitializeApplication("GLWindow", &argc, argv); display = XOpenDisplay(""); screen = WMCreateScreen(display, DefaultScreen(display)); if(!glXQueryExtension(display, NULL, NULL)){wwarning("X server does not have GLX\n"); return 0; } window = WMCreateWindow(screen, "Main"); WMResizeWidget(window, CONTENTW+2*CONTENTMARGIN, CONTENTH+2*CONTENTMARGIN*CONTENTH/CONTENTW); WMSetWindowAspectRatio(window, CONTENTW,CONTENTH,CONTENTW,CONTENTH); WMSetWindowCloseAction(window, closeAll, NULL); WMSetWindowTitle(window,"GL Frame"); WMRealizeWidget(window); datacouple.window=window; WMSetViewNotifySizeChanges(WMWidgetView(window), True); WMAddNotificationObserver(resizeHandler, &datacouple, WMViewSizeDidChangeNotification, WMWidgetView(window)); glframe = WMCreateFrame(window); datacouple.frame=glframe; WMResizeWidget(glframe, CONTENTW, CONTENTH); WMMoveWidget(glframe, CONTENTMARGIN,CONTENTMARGIN); WMRealizeWidget(glframe); Button=WMCreateButton(window, WBTMomentaryPush); WMSetButtonAction(Button, DoRotate,&win); WMSetButtonText(Button,"Turn"); WMMoveWidget(Button, CONTENTMARGIN,2); WMRealizeWidget(Button); WMMapWidget(Button); /* get the frame's X window value */ win =W_VIEW_DRAWABLE(WMWidgetView(glframe)); WMCreateEventHandler(WMWidgetView(glframe), ExposureMask|StructureNotifyMask,redo,&win); xvVisualInfo = glXChooseVisual(display, DefaultScreen(display), Attr); if(xvVisualInfo == NULL) {wwarning("No visualinfo\n");return 0;} cmColorMap = XCreateColormap(display,RootWindow(display, DefaultScreen(display)), xvVisualInfo->visual, AllocNone); winAttr.colormap = cmColorMap; winAttr.border_pixel = 0; winAttr.background_pixel = 0; winAttr.event_mask = ExposureMask | ButtonPressMask |StructureNotifyMask| KeyPressMask; XChangeWindowAttributes(display,win,CWBorderPixel | CWColormap | CWEventMask,&winAttr); glXContext = glXCreateContext(display, xvVisualInfo, None, True); if(!glXContext) {wwarning("glX cannot create rendering context\n");return 0;} glXMakeCurrent(display, win, glXContext); WMMapWidget(glframe); init(); setsize(CONTENTW,CONTENTH); WMMapWidget(window); WMScreenMainLoop(screen); return 0; }