boolean IconObj::SetOpen(boolean flag) { int pixmapPlacement; int alignment; int isOpened; BaseUI *parent = Parent(); if (ContainerView() == TREE) isOpened = flag; else if (parent && parent->UISubClass() == ICON_LIST || parent->UISubClass() == SCROLLED_ICON_LIST) isOpened = true; else isOpened = flag; if (IconView() == LARGE_ICON) { if (ContainerView() == TREE || (parent->UIClass() == CONTAINER && parent->UISubClass() == SCROLLED_VERTICAL_ROW_COLUMN)) { isOpened = true; pixmapPlacement = GuiPIXMAP_LEFT; } else { pixmapPlacement = GuiPIXMAP_TOP; } if (isOpened) alignment = XmALIGNMENT_BEGINNING; else alignment = LargeIconJustification; } else { alignment = XmALIGNMENT_BEGINNING; pixmapPlacement = GuiPIXMAP_LEFT; } XtVaSetValues(_w, XmNalignment, alignment, GuiNisOpened, isOpened, GuiNpixmapPlacement, pixmapPlacement, NULL); return true; }
void MotifUI::DoContextualHelp() { Widget context_widget, shell; #ifdef NO_CDE XEvent event; static Cursor cursor = (Cursor) NULL; if (cursor == (Cursor) NULL) cursor = XCreateFontCursor(display, XC_question_arrow); #endif BaseUI *window = this; while (window->UIClass() != MAIN_WINDOW) window = window->Parent(); shell = ((MotifUI *)window)->_w; #ifdef NO_CDE context_widget = XmTrackingEvent(shell, cursor, False, &event); if (event.type == KeyPress || event.type == KeyRelease) { int offset; KeySym keySym; // Look for ESC key press and stop if we get one if (event.xkey.state & ShiftMask) offset = 1; else offset = 0; keySym = XLookupKeysym((XKeyEvent *)&event, offset); if (keySym == XK_Escape) return; } if (context_widget != NULL) { #else int returnVal = DtHelpReturnSelectedWidgetId(shell, NULL, &context_widget); if (returnVal == DtHELP_SELECT_VALID) { #endif XmAnyCallbackStruct cb; cb.reason = XmCR_HELP; #ifdef NO_CDE cb.event = &event; #endif while (context_widget != NULL) { // If there is no help at this widget, back track to find help if (XtHasCallbacks(context_widget, XmNhelpCallback) == XtCallbackHasSome) { XtCallCallbacks(context_widget, XmNhelpCallback, &cb); break; } else context_widget = XtParent(context_widget); } } } void MotifUI::WidgetHelpCB(Widget, XtPointer clientData, XtPointer) { MotifUI * obj = (MotifUI *) clientData; obj->HandleHelpRequest(); }
boolean IconObj::SetIcon(IconStyle style) { Pixmap pixmap, mask; int shrinkOutline = false; int pixmapPlacement; int alignment; int isOpened; BaseUI *parent = Parent(); if (ContainerView() == TREE) isOpened = true; else if (parent && parent->UISubClass() == ICON_LIST || parent->UISubClass() == SCROLLED_ICON_LIST) isOpened = true; else isOpened = Open(); switch (style) { case NAME_ONLY: pixmapPlacement = GuiPIXMAP_LEFT; alignment = XmALIGNMENT_BEGINNING; if (_name) { pixmap = XmUNSPECIFIED_PIXMAP; mask = XmUNSPECIFIED_PIXMAP; } else { pixmap = _smallPixmap; mask = _smallMask; } break; case VERY_LARGE_ICON: case LARGE_ICON: case MEDIUM_ICON: if (ContainerView() == TREE || (parent->UIClass() == CONTAINER && parent->UISubClass() == SCROLLED_VERTICAL_ROW_COLUMN)) { isOpened = true; pixmapPlacement = GuiPIXMAP_LEFT; } else pixmapPlacement = GuiPIXMAP_TOP; if (isOpened) alignment = XmALIGNMENT_BEGINNING; else alignment = LargeIconJustification; shrinkOutline = true; if (style == VERY_LARGE_ICON) { if (depth == 1) strcat(_iconFile, ".l.bm"); else strcat(_iconFile, ".l.pm"); GetPixmaps(_w, _iconFile, &pixmap, &mask); _iconFile[strlen(_iconFile) - 5] = '\0'; } else { pixmap = _largePixmap; mask = _largeMask; } break; case DETAILS: SetDetail(); // no break case SMALL_ICON: case TINY_ICON: alignment = XmALIGNMENT_BEGINNING; pixmapPlacement = GuiPIXMAP_LEFT; pixmap = _smallPixmap; mask = _smallMask; break; } if (_previous_style == DETAILS) { XmString xm_string = StringCreate(_name); XtVaSetValues(_w, XmNlabelPixmap, pixmap, GuiNiconMask, mask, XmNlabelString, xm_string, XmNalignment, alignment, GuiNpixmapPlacement, pixmapPlacement, GuiNisOpened, isOpened, GuiNshrinkOutline, shrinkOutline, NULL); StringFree(xm_string); } else XtVaSetValues(_w, XmNlabelPixmap, pixmap, GuiNiconMask, mask, GuiNpixmapPlacement, pixmapPlacement, XmNalignment, alignment, GuiNisOpened, isOpened, GuiNshrinkOutline, shrinkOutline, NULL); _previous_style = style; if (_stateIconName) SetStateIconFile(style); return true; }