void CBEditTextPrefsDialog::SetReverseVideoColors() { JXColormap* cmap = GetColormap(); ChangeColor(CBPrefsManager::kTextColorIndex, cmap->GetWhiteColor()); ChangeColor(CBPrefsManager::kBackColorIndex, cmap->GetBlackColor()); ChangeColor(CBPrefsManager::kCaretColorIndex, cmap->GetWhiteColor()); ChangeColor(CBPrefsManager::kSelColorIndex, cmap->GetBlueColor()); ChangeColor(CBPrefsManager::kSelLineColorIndex, cmap->GetCyanColor()); ChangeColor(CBPrefsManager::kRightMarginColorIndex, cmap->GetGrayColor(80)); }
void ClipboardWidget::Draw ( JXWindowPainter& p, const JRect& rect ) { // We need the colormap in order to specify colors. JXColormap* cmap = GetColormap(); // This is where everything happens // See JPainter.h for available functions // This sets the color of the pen. p.SetPenColor(cmap->GetCyanColor()); // This draws our rectangle. p.Rect(10, 10, 150, 50); // This draws itsText. p.String(20,20,itsText, 130, JPainter::kHAlignCenter, 30, JPainter::kVAlignCenter); }
TestWidget::TestWidget ( const JBoolean isMaster, const JBoolean isImage, JXMenuBar* menuBar, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXScrollableWidget(scrollbarSet, enclosure, hSizing, vSizing, x,y, w,h), itsRNG() { JIndex i; itsFillFlag = kJFalse; itsRandPointCount = 10; itsResizeDialog = NULL; SetBackColor(GetColormap()->GetDefaultBackColor()); // cursors JXDisplay* display = GetDisplay(); itsTrekCursor = display->CreateBuiltInCursor("XC_trek", XC_trek); itsGumbyCursor = display->CreateBuiltInCursor("XC_gumby", XC_gumby); itsBogosityCursor = display->CreateBuiltInCursor("XC_bogosity", XC_bogosity); itsFleurCursor = display->CreateBuiltInCursor("XC_fleur", XC_fleur); SetDefaultCursor(itsTrekCursor); // menus itsActionsMenu = menuBar->AppendTextMenu(kActionsMenuTitleStr); itsActionsMenu->SetTitleFontStyle(GetColormap()->GetWhiteColor()); itsActionsMenu->SetShortcuts(kActionsMenuShortcutStr); itsActionsMenu->SetMenuItems(kActionsMenuStr); itsActionsMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsActionsMenu); itsPointMenu = jnew JXTextMenu(itsActionsMenu, kPointMenuCmd, menuBar); assert( itsPointMenu != NULL ); itsPointMenu->SetMenuItems(kPointMenuStr); itsPointMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsPointMenu); // This tests the JX response to an empty menu. JXTextMenu* emptyMenu = jnew JXTextMenu(itsActionsMenu, kEmptyMenuCmd, menuBar); assert( emptyMenu != NULL ); JXMenu* prevMenu = itsActionsMenu; JIndex prevMenuIndex = kAdviceMenuCmd; for (i=1; i<=kAdviceMenuCount; i++) { JXTextMenu* adviceMenu = jnew JXTextMenu(prevMenu, prevMenuIndex, menuBar); assert( adviceMenu != NULL ); adviceMenu->SetMenuItems(kAdviceMenuStr[i-1]); adviceMenu->SetUpdateAction(JXMenu::kDisableNone); if (i == kAdviceBoldMenuIndex) { adviceMenu->SetItemFontStyle(2, JFontStyle(kJTrue, kJFalse, 0, kJFalse, GetColormap()->GetBlackColor())); } prevMenu = adviceMenu; prevMenuIndex = 2; } BuildXlsfontsMenu(itsActionsMenu, menuBar); // secret menus are a bad idea because the user can't find them! itsSecretMenu = jnew JXTextMenu("", this, kFixedLeft, kFixedTop, 0,0, 10,10); assert( itsSecretMenu != NULL ); itsSecretMenu->SetMenuItems(kSecretMenuStr); itsSecretMenu->SetUpdateAction(JXMenu::kDisableNone); itsSecretMenu->SetToHiddenPopupMenu(kJTrue); // will assert() otherwise itsSecretMenu->Hide(); ListenTo(itsSecretMenu); itsSecretSubmenu = jnew JXTextMenu(itsSecretMenu, kSecretSubmenuIndex, this); assert( itsSecretSubmenu != NULL ); itsSecretSubmenu->SetMenuItems(kSecretSubmenuStr); itsSecretSubmenu->SetUpdateAction(JXMenu::kDisableNone); // we don't ListenTo() it because it's only there for show // image from xpm itsXPMImage = jnew JXImage(GetDisplay(), JXPM(macapp_xpm)); assert( itsXPMImage != NULL ); // partial image from image itsPartialXPMImage = jnew JXImage(*itsXPMImage, JRect(5,5,14,16)); assert( itsPartialXPMImage != NULL ); // home symbol itsHomeImage = jnew JXImage(GetDisplay(), JXPM(home_xpm)); assert( itsHomeImage != NULL ); itsHomeRect = itsHomeImage->GetBounds(); itsHomeRect.Shift(120, 10); // buffer contents of Widget in JXImage itsImageBuffer = NULL; if (isImage) { CreateImageBuffer(); } // initial size SetBounds(400,400); // enclosed objects itsAnimButton = jnew JXTextButton("Start", this, JXWidget::kFixedLeft, JXWidget::kFixedTop, 37,175, 50,30); assert( itsAnimButton != NULL ); itsAnimButton->SetShortcuts("#A"); ListenTo(itsAnimButton); if (isMaster) { itsQuitButton = jnew JXTextButton(JGetString("Quit::TestWidget"), this, JXWidget::kFixedRight, JXWidget::kFixedBottom, x,y, 50,30); assert( itsQuitButton != NULL ); JXColormap* colormap = GetColormap(); itsQuitButton->CenterWithinEnclosure(kJTrue, kJTrue); itsQuitButton->SetFontStyle(JFontStyle(kJTrue, kJFalse, 0, kJFalse, colormap->GetRedColor())); itsQuitButton->SetNormalColor(colormap->GetCyanColor()); itsQuitButton->SetPushedColor(colormap->GetBlueColor()); ListenTo(itsQuitButton); } else { itsQuitButton = NULL; } ExpandToFitContent(); // drops on iconfied window JXWindowIcon* windowIcon; const JBoolean hasIconWindow = GetWindow()->GetIconWidget(&windowIcon); assert( hasIconWindow ); ListenTo(windowIcon); }