void ControlPanelGroupDialog::setToggles() { Widget widget; List plist; int i, size = this->toggleList[0].getSize(); boolean state=false, set = this->lastIndex; ControlPanel *cp; if(set) this->panelManager->getPanelGroup(this->lastIndex, &plist); for(i = 1; i <= size; i++) { widget = (Widget)this->toggleList[1].getElement(i); XtVaGetValues(widget, XmNuserData, &cp, NULL); XtVaSetValues(widget, XmNset, cp->isManaged(), NULL); if(set) state = plist.isMember((void*)cp->getInstanceNumber()); widget = (Widget)this->toggleList[0].getElement(i); XtVaSetValues(widget, XmNset, set AND state, NULL); } }
void ControlPanelAccessDialog::makeToggles() { int i, inst; Boolean set; Widget widget, lastwidget = NULL; // NULL stops scary cc warnings ControlPanel *cp; Network *network = this->panelManager->getNetwork(); PanelGroupManager * pgm = network->getPanelGroupManager(); char *gname, *pname; XtUnmanageChild(this->sform); ListIterator li(this->toggleList[0]); int size = network->getPanelCount(); if(this->toggleList[0].getSize() > 0) { while( (widget = (Widget)li.getNext()) ) XtDestroyWidget(widget); li.setList(this->toggleList[1]); while( (widget = (Widget)li.getNext()) ) XtDestroyWidget(widget); this->toggleList[0].clear(); this->toggleList[1].clear(); } if(this->separator) { XtDestroyWidget(this->separator); this->separator = NULL; } if(this->toggleList[2].getSize() > 0) { li.setList(this->toggleList[2]); while( (widget = (Widget)li.getNext()) ) XtDestroyWidget(widget); this->toggleList[2].clear(); } if(size == 0) return; for(i = 0; i < size; i++) { cp = network->getPanelByIndex(i+1); inst = cp->getInstanceNumber(); set = this->panelManager->isAccessiblePanel(inst); pname = (char*)cp->getPanelNameString(); if(IsBlankString(pname)) pname = "Control Panel"; widget = XmCreateToggleButton(this->sform, pname, NULL, 0); XtVaSetValues(widget, XmNset, set, XmNindicatorType, XmN_OF_MANY, XmNalignment, XmALIGNMENT_BEGINNING, XmNshadowThickness,0, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment,XmATTACH_POSITION, XmNrightPosition, 80, XmNtopOffset, 2, XmNleftOffset, 2, NULL); if(i == 0) XtVaSetValues(widget, XmNtopAttachment,XmATTACH_FORM,NULL); else XtVaSetValues(widget, XmNtopAttachment,XmATTACH_WIDGET, XmNtopWidget, lastwidget, NULL); if(this->panelManager->getControlPanel() == cp) XtVaSetValues(widget, XmNsensitive, False, XmNset, False, NULL); this->toggleList[0].appendElement((void*)widget); XtManageChild(widget); set = cp->isManaged(); widget = XmCreateToggleButton(this->sform, "...", NULL, 0); XtVaSetValues(widget, XmNuserData, cp, XmNset, set, XmNindicatorOn, False, XmNfillOnSelect, False, XmNrightAttachment,XmATTACH_FORM, XmNleftAttachment,XmATTACH_POSITION, XmNleftPosition, 80, XmNtopOffset, 2, XmNleftOffset, 5, XmNindicatorSize, 1, XmNspacing, 0, NULL); if(i == 0) XtVaSetValues(widget, XmNtopAttachment,XmATTACH_FORM,NULL); else XtVaSetValues(widget, XmNtopAttachment,XmATTACH_WIDGET, XmNtopWidget, lastwidget, NULL); if(this->panelManager->getControlPanel() == cp) XtVaSetValues(widget, XmNsensitive, False, NULL); XtAddCallback(widget, XmNvalueChangedCallback, (XtCallbackProc)ControlPanelAccessDialog_OpenPanelCB, (XtPointer)this); this->toggleList[1].appendElement((void*)widget); XtManageChild(widget); lastwidget = widget; } size = pgm->getGroupCount(); if(size == 0) { XtManageChild(this->sform); return; } this->separator = XtVaCreateManagedWidget("separator", xmSeparatorGadgetClass, this->sform, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 2, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 2, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, lastwidget, XmNtopOffset, 5, NULL); for(i = 1; i <= size; i++) { gname = (char*)pgm->getPanelGroup(i, NULL); set = this->panelManager->isAccessibleGroup(gname); widget = XmCreateToggleButton(this->sform, gname, NULL, 0); XtVaSetValues(widget, XmNset, set, XmNindicatorType, XmN_OF_MANY, XmNalignment, XmALIGNMENT_BEGINNING, XmNshadowThickness,0, XmNleftAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_WIDGET, XmNtopOffset, 2, XmNleftOffset, 2, NULL); if(i == 1) XtVaSetValues(widget, XmNtopWidget, this->separator, XmNtopOffset, 5, NULL); else XtVaSetValues(widget, XmNtopWidget, lastwidget, NULL); this->toggleList[2].appendElement((void*)widget); XtManageChild(widget); lastwidget = widget; } XtManageChild(this->sform); }
void ControlPanelGroupDialog::makeToggles() { int i; Boolean set = FALSE, state = FALSE; Widget widget, lastwidget = NULL; // NULL stops scary cc warnings ControlPanel *cp; List glist; char *pname; Network *network = this->panelManager->getNetwork(); ListIterator li(this->toggleList[0]); int size = network->getPanelCount(); XtUnmanageChild(this->sform); if(this->toggleList[0].getSize() > 0) { while( (widget = (Widget)li.getNext()) ) XtDestroyWidget(widget); li.setList(this->toggleList[1]); while( (widget = (Widget)li.getNext()) ) XtDestroyWidget(widget); this->toggleList[0].clear(); this->toggleList[1].clear(); } if(size == 0) { this->unmanage(); return; } set = this->lastIndex AND this->panelManager->getGroupCount() AND this->panelManager->getPanelGroup(this->lastIndex, &glist); for(i = 0; i < size; i++) { cp = network->getPanelByIndex(i+1); /*inst = cp->getInstanceNumber();*/ if(set) state = glist.isMember((void*)cp->getInstanceNumber()); else state = FALSE; pname = (char*)cp->getPanelNameString(); if(IsBlankString(pname)) pname = "Control Panel"; widget = XmCreateToggleButton(this->sform, pname, NULL, 0); XtVaSetValues(widget, XmNset, state, XmNindicatorType, XmN_OF_MANY, XmNalignment, XmALIGNMENT_BEGINNING, XmNshadowThickness,0, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment,XmATTACH_POSITION, XmNrightPosition, 70, XmNtopOffset, 2, XmNleftOffset, 2, NULL); if(i == 0) XtVaSetValues(widget, XmNtopAttachment,XmATTACH_FORM,NULL); else XtVaSetValues(widget, XmNtopAttachment,XmATTACH_WIDGET, XmNtopWidget, lastwidget, NULL); this->toggleList[0].appendElement((void*)widget); XtManageChild(widget); state = cp->isManaged(); widget = XmCreateToggleButton(this->sform, "...", NULL, 0); XtVaSetValues(widget, XmNuserData, cp, XmNset, state, XmNindicatorOn, False, XmNfillOnSelect, False, XmNrightAttachment,XmATTACH_FORM, XmNleftAttachment,XmATTACH_POSITION, XmNleftPosition, 70, XmNindicatorSize, 1, XmNtopOffset, 2, XmNleftOffset, 5, NULL); if(i == 0) XtVaSetValues(widget, XmNtopAttachment,XmATTACH_FORM,NULL); else XtVaSetValues(widget, XmNtopAttachment,XmATTACH_WIDGET, XmNtopWidget, lastwidget, NULL); XtAddCallback(widget, XmNvalueChangedCallback, (XtCallbackProc)ControlPanelGroupDialog_OpenPanelCB, (XtPointer)this); this->toggleList[1].appendElement((void*)widget); XtManageChild(widget); lastwidget = widget; } XtManageChild(this->sform); }