JXDocumentManager::JXDocumentManager ( const JBoolean wantShortcuts ) : itsWantShortcutFlag( wantShortcuts ) { itsDocList = new JArray<DocInfo>; assert( itsDocList != NULL ); itsDocList->SetCompareFunction(CompareDocNames); itsDocList->SetSortOrder(JOrderedSetT::kSortAscending); itsNewDocCount = 0; itsFileMap = new JArray<FileMap>; assert( itsFileMap != NULL ); itsPerformSafetySaveFlag = kJTrue; itsSafetySaveTask = new JXTimerTask(kDefaultSafetySavePeriod); assert( itsSafetySaveTask != NULL ); ListenTo(itsSafetySaveTask); itsUpdateDocMenuTask = NULL; JXDisplay* d = (JXGetApplication())->GetCurrentDisplay(); itsDefaultMenuIcon = new JXImage(d, d->GetColormap(), jx_plain_file_small); assert( itsDefaultMenuIcon != NULL ); JXSetDocumentManager(this); }
void TestDirector::BuildWindow ( const JBoolean isMaster, const JBoolean bufferTestWidget, const JBoolean testWidgetIsImage ) { JXDisplay* display = (JXGetApplication())->GetCurrentDisplay(); JXColormap* colormap = display->GetColormap(); // begin JXLayout JXWindow* window = new JXWindow(this, 400,330, ""); assert( window != NULL ); JXMenuBar* menuBar = new JXMenuBar(window, JXWidget::kHElastic, JXWidget::kFixedTop, 0,0, 400,30); assert( menuBar != NULL ); JXScrollbarSet* scrollbarSet = new JXScrollbarSet(window, JXWidget::kHElastic, JXWidget::kVElastic, 0,30, 400,300); assert( scrollbarSet != NULL ); // end JXLayout window->SetTitle("Test Director"); window->SetWMClass("testjx", "TestDirector"); window->SetMinSize(150,150); if (isMaster) { window->SetCloseAction(JXWindow::kQuitApp); } else { window->SetCloseAction(JXWindow::kCloseDisplay); } itsAnimIconTask = new AnimateWindowIconTask(GetWindow()); assert( itsAnimIconTask != NULL ); ListenTo(window); // for icon animation // menus JXImage* aboutTitleImage = new JXImage(display, kSmileyBitmap[ kHappySmileyIndex ], colormap->GetRedColor()); assert( aboutTitleImage != NULL ); itsAboutMenu = menuBar->AppendTextMenu(aboutTitleImage, kJTrue); itsAboutMenu->SetShortcuts(kAboutMenuShortcuts); itsAboutMenu->SetMenuItems(kAboutMenuStr, "TestDirector"); itsAboutMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsAboutMenu); itsAnimHelpTask = new AnimateHelpMenuTask(itsAboutMenu, kHelpCmd); assert( itsAnimHelpTask != NULL ); itsPrintPSMenu = new JXTextMenu(itsAboutMenu, kPrintPSMenuCmd, menuBar); assert( itsPrintPSMenu != NULL ); itsPrintPSMenu->SetMenuItems(kPrintPSMenuStr); itsPrintPSMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsPrintPSMenu); itsTestMenu = menuBar->AppendTextMenu(kTestMenuTitleStr); itsTestMenu->SetMenuItems(kTestMenuStr); itsTestMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsTestMenu); itsUNMenu = new JXTextMenu(itsTestMenu, kTestUserNotifyMenuCmd, menuBar); assert( itsUNMenu != NULL ); itsUNMenu->SetMenuItems(kUserNotificationMenuStr); itsUNMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsUNMenu); itsCSFMenu = new JXTextMenu(itsTestMenu, kTestChooseSaveFileMenuCmd, menuBar); assert( itsCSFMenu != NULL ); itsCSFMenu->SetMenuItems(kChooseSaveFileMenuStr); itsCSFMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsCSFMenu); itsPGMenu = new JXTextMenu(itsTestMenu, kTestPGMenuCmd, menuBar); assert( itsPGMenu != NULL ); itsPGMenu->SetMenuItems(kProgressDisplayMenuStr); itsPGMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsPGMenu); if (isMaster) { itsDisplayMenu = new JXDisplayMenu(kDisplayMenuName, menuBar, JXWidget::kFixedLeft, JXWidget::kFixedTop, 0,0, 10,10); assert( itsDisplayMenu != NULL ); menuBar->AppendMenu(itsDisplayMenu); } else { itsDisplayMenu = NULL; } itsWidget = new TestWidget(isMaster, testWidgetIsImage, menuBar, scrollbarSet, scrollbarSet->GetScrollEnclosure(), JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 10,10); assert( itsWidget != NULL ); itsWidget->FitToEnclosure(kJTrue, kJTrue); itsWidget->SetSingleFocusWidget(); BuildIconMenus(window, menuBar); // do this -after- constructing JXScrollableWidget (GetWindow())->BufferDrawing(bufferTestWidget); }
void THXBaseConvDirector::BuildWindow() { // begin JXLayout JXWindow* window = new JXWindow(this, 300,130, ""); assert( window != NULL ); SetWindow(window); itsCloseButton = new JXTextButton("Close", window, JXWidget::kFixedRight, JXWidget::kFixedTop, 180,100, 60,20); assert( itsCloseButton != NULL ); itsCloseButton->SetShortcuts("#W^["); itsFromValue = new JXInputField(window, JXWidget::kHElastic, JXWidget::kFixedTop, 110,20, 70,20); assert( itsFromValue != NULL ); JXStaticText* obj1 = new JXStaticText("Convert from:", window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,20, 90,20); assert( obj1 != NULL ); itsHelpButton = new JXTextButton("Help", window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 60,100, 60,20); assert( itsHelpButton != NULL ); itsFromBase = new THXBaseConvMenu(window, JXWidget::kFixedRight, JXWidget::kFixedTop, 190,15, 90,30); assert( itsFromBase != NULL ); JXStaticText* obj2 = new JXStaticText("Result:", window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,60, 90,20); assert( obj2 != NULL ); itsToBase = new THXBaseConvMenu(window, JXWidget::kFixedRight, JXWidget::kFixedTop, 190,55, 90,30); assert( itsToBase != NULL ); itsToValue = new JXStaticText("", kJFalse, kJTrue, NULL, window, JXWidget::kHElastic, JXWidget::kFixedTop, 110,60, 70,20); assert( itsToValue != NULL ); // end JXLayout window->SetTitle("Base Conversion"); window->SetWMClass(THXGetWMClassInstance(), THXGetBaseConvWindowClass()); window->LockCurrentMinSize(); window->SetCloseAction(JXWindow::kDeactivateDirector); window->ShouldFocusWhenShow(kJTrue); window->PlaceAsDialogWindow(); JXDisplay* display = GetDisplay(); JXImage* icon = new JXImage(display, display->GetColormap(), thx_base_conv_window); assert( icon != NULL ); window->SetIcon(icon); itsFromValue->ShouldBroadcastAllTextChanged(kJTrue); // want every keypress ListenTo(itsFromValue); ListenTo(itsFromBase); ListenTo(itsToBase); ListenTo(itsCloseButton); ListenTo(itsHelpButton); }
void WizChatDirector::BuildWindow() { // begin JXLayout JXWindow* window = new JXWindow(this, 600,250, ""); assert( window != NULL ); JXMenuBar* menuBar = new JXMenuBar(window, JXWidget::kHElastic, JXWidget::kFixedTop, 0,0, 600,30); assert( menuBar != NULL ); JXScrollbarSet* scrollbarSet = new JXScrollbarSet(window, JXWidget::kHElastic, JXWidget::kVElastic, 0,30, 600,180); assert( scrollbarSet != NULL ); itsChatInput = new WizChatInput(window, JXWidget::kHElastic, JXWidget::kFixedBottom, 90,210, 510,40); assert( itsChatInput != NULL ); itsChatShortcutMenu = new WizChatShortcutMenu(itsChatInput, window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 0,210, 90,20); assert( itsChatShortcutMenu != NULL ); itsChatTargetMenu = new WizChatTargetMenu(itsChatInput, itsChatShortcutMenu, window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 0,230, 90,20); assert( itsChatTargetMenu != NULL ); // end JXLayout window->SetTitle("Chat"); window->SetMinSize(150, 150); window->SetWMClass(WizGetWMClassInstance(), WizGetChatWindowClass()); JXDisplay* display = GetDisplay(); JXImage* icon = new JXImage(display, display->GetColormap(), jx_un_message); assert( icon != NULL ); window->SetIcon(icon); itsMessageDisplay = new JXStaticText("", kJTrue, kJTrue, scrollbarSet, scrollbarSet->GetScrollEnclosure(), JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 100,100); assert( itsMessageDisplay != NULL ); itsMessageDisplay->FitToEnclosure(); itsChatInput->SetShortcutMenu(itsChatShortcutMenu); ListenTo(itsChatTargetMenu); itsActionsMenu = menuBar->AppendTextMenu(kActionsMenuTitleStr); itsActionsMenu->SetMenuItems(kActionsMenuStr); itsActionsMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsActionsMenu); itsMessageDisplay->AppendEditMenu(menuBar); itsChatInput->ShareEditMenu(itsMessageDisplay); itsPrefsMenu = menuBar->AppendTextMenu(kPrefsMenuTitleStr); itsPrefsMenu->SetMenuItems(kPrefsMenuStr); itsPrefsMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsPrefsMenu); itsHelpMenu = menuBar->AppendTextMenu(kHelpMenuTitleStr); itsHelpMenu->SetMenuItems(kHelpMenuStr); itsHelpMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsHelpMenu); }