MainWindow::MainWindow() : BWindow(BRect(0, 0, 1, 1), TR("Fonts"), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS) { fDefaultsButton = new BButton("defaults", TR("Defaults"), new BMessage(kMsgSetDefaults), B_WILL_DRAW); fDefaultsButton->SetEnabled(false); fRevertButton = new BButton("revert", TR("Revert"), new BMessage(kMsgRevert), B_WILL_DRAW); fRevertButton->SetEnabled(false); // BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_LABEL); BBox* box = new BBox(B_FANCY_BORDER, NULL); fFontsView = new FontView(); // tabView->AddTab(fFontsView); box->AddChild(fFontsView); fFontsView->UpdateFonts(); SetLayout(new BGroupLayout(B_VERTICAL)); const float kInset = 10; AddChild(BGroupLayoutBuilder(B_VERTICAL) .Add(box) // .Add(tabView) .Add(BSpaceLayoutItem::CreateVerticalStrut(kInset)) .Add(BGroupLayoutBuilder(B_HORIZONTAL) .Add(fDefaultsButton) .Add(BSpaceLayoutItem::CreateHorizontalStrut(kInset)) .Add(fRevertButton) .Add(BSpaceLayoutItem::CreateGlue()) ) .SetInsets(kInset, kInset, kInset, kInset) ); if (fSettings.WindowCorner() == BPoint(-1, -1)) { // center window on screen CenterOnScreen(); } else { MoveTo(fSettings.WindowCorner()); // make sure window is on screen BScreen screen(this); if (!screen.Frame().InsetByCopy(10, 10).Intersects(Frame())) CenterOnScreen(); } fRunner = new BMessageRunner(this, new BMessage(kMsgCheckFonts), 3000000); // every 3 seconds fDefaultsButton->SetEnabled(fFontsView->IsDefaultable()); }
ScreenshotWindow::ScreenshotWindow(BWindow* parent, BRect frame) : BWindow(frame, B_TRANSLATE("Screenshot"), B_FLOATING_WINDOW_LOOK, B_FLOATING_SUBSET_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS), fDownloadPending(false), fWorkerThread(-1) { AddToSubset(parent); fScreenshotView = new BitmapView("screenshot view"); fScreenshotView->SetExplicitMaxSize( BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); BGroupView* groupView = new BGroupView(B_VERTICAL); groupView->SetViewColor(0, 0, 0); fScreenshotView->SetLowColor(0, 0, 0); // Build layout BLayoutBuilder::Group<>(this, B_VERTICAL) .AddGroup(groupView) .Add(fScreenshotView) .SetInsets(B_USE_WINDOW_INSETS) .End() ; CenterOnScreen(); }
PrefWindow::PrefWindow(const BMessenger &messenger) : BWindow(BRect(0, 0, 375, 185), B_TRANSLATE("Terminal settings"), B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_AUTO_UPDATE_SIZE_LIMITS), fPreviousPref(new PrefHandler(PrefHandler::Default())), fSavePanel(NULL), fDirty(false), fTerminalMessenger(messenger) { BLayoutBuilder::Group<>(this, B_VERTICAL) .AddGroup(B_VERTICAL) .SetInsets(10, 10, 10, 10) .Add(new AppearancePrefView(B_TRANSLATE("Appearance"), fTerminalMessenger)) .AddGroup(B_HORIZONTAL) .Add(fSaveAsFileButton = new BButton("savebutton", B_TRANSLATE("Save to file" B_UTF8_ELLIPSIS), new BMessage(MSG_SAVEAS_PRESSED), B_WILL_DRAW)) .AddGlue() .Add(fRevertButton = new BButton("revertbutton", B_TRANSLATE("Cancel"), new BMessage(MSG_REVERT_PRESSED), B_WILL_DRAW)) .Add(fSaveButton = new BButton("okbutton", B_TRANSLATE("OK"), new BMessage(MSG_SAVE_PRESSED), B_WILL_DRAW)) .End() .End(); fSaveButton->MakeDefault(true); AddShortcut('Q', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED)); AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED)); CenterOnScreen(); Show(); }
OptionsWindow::OptionsWindow(Controller* controller) : BWindow(kWindowRect, "Encoding Settings", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS|B_AUTO_UPDATE_SIZE_LIMITS) { BBox *encodingBox = new BBox("encoding options"); BBox* frameBox = new BBox("frame rate"); BLayoutBuilder::Group<>(this, B_VERTICAL) .SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) .Add(encodingBox) .Add(frameBox) .End(); encodingBox->SetLabel("Encoding options"); frameBox->SetLabel("Frame rate"); BView* layoutView = BLayoutBuilder::Group<>() .SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) .Add(new MediaFormatView(controller)) .View(); encodingBox->AddChild(layoutView); layoutView = BLayoutBuilder::Group<>() .SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) .Add(new FrameRateView(controller)) .View(); frameBox->AddChild(layoutView); CenterOnScreen(); }
void ScreenshotWindow::_ResizeToFitAndCenter() { // Find out dimensions of the largest screenshot of this package ScreenshotInfoList screenshotInfos; if (fPackage.Get() != NULL) screenshotInfos = fPackage->ScreenshotInfos(); int32 largestScreenshotWidth = 0; int32 largestScreenshotHeight = 0; const uint32 numScreenshots = fPackage->ScreenshotInfos().CountItems(); for (uint32 i = 0; i < numScreenshots; i++) { const ScreenshotInfo& info = screenshotInfos.ItemAtFast(i); if (info.Width() > largestScreenshotWidth) largestScreenshotWidth = info.Width(); if (info.Height() > largestScreenshotHeight) largestScreenshotHeight = info.Height(); } fScreenshotView->SetExplicitMinSize( BSize(largestScreenshotWidth, largestScreenshotHeight)); Layout(false); // TODO: Limit window size to screen size (with a little margin), // the image should then become scrollable. float minWidth; float minHeight; GetSizeLimits(&minWidth, NULL, &minHeight, NULL); ResizeTo(minWidth, minHeight); CenterOnScreen(); }
AsciiWindow::AsciiWindow(void) : DWindow(BRect(0.0f, 0.0f, kWindowWidth, kWindowHeight), B_TRANSLATE("ASCII table"), B_TITLED_WINDOW, B_AUTO_UPDATE_SIZE_LIMITS), fIsZoomed(false), fLastFrame(Frame()) { BListView* listView = new BListView("listView", B_MULTIPLE_SELECTION_LIST, B_WILL_DRAW); BScrollView* listScrollView = new BScrollView("scrollView", listView, 0, false, true, B_NO_BORDER); listView->SetFont(be_fixed_font); listView->AddItem(new BStringItem(B_TRANSLATE(" Dec Hex Oct Code Description"))); listView->AddItem(new BStringItem("")); for (int i = 0; i < 128; i++) { char* row; asprintf(&row, " %3d %2x %3o %3s %s", i, i, i, sAsciiTable[i].code, sAsciiTable[i].description.String()); listView->AddItem(new BStringItem(row)); free(row); } BLayoutBuilder::Group<>(this, B_VERTICAL) .Add(listScrollView) .SetInsets(-1) .End(); CenterOnScreen(); }
void MidiPlayerWindow::InitControls() { Lock(); showScope->SetValue(scopeEnabled ? B_CONTROL_ON : B_CONTROL_OFF); scopeView->SetEnabled(scopeEnabled); inputOff->SetMarked(true); reverbNone->SetMarked(reverb == B_REVERB_NONE); reverbCloset->SetMarked(reverb == B_REVERB_CLOSET); reverbGarage->SetMarked(reverb == B_REVERB_GARAGE); reverbIgor->SetMarked(reverb == B_REVERB_BALLROOM); reverbCavern->SetMarked(reverb == B_REVERB_CAVERN); reverbDungeon->SetMarked(reverb == B_REVERB_DUNGEON); be_synth->SetReverb(reverb); volumeSlider->SetValue(volume); if (windowX != -1 && windowY != -1) MoveTo(windowX, windowY); else CenterOnScreen(); Unlock(); }
StatusWindow::StatusWindow(const char *text, BRect aRect) : BWindow(aRect, B_TRANSLATE("BePDF status"), B_MODAL_WINDOW , B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_NOT_CLOSABLE) { BStringView *stringView = new BStringView("stringView", text); mStatus = new BStatusBar("mStatus"); mStatus->SetMaxValue(1); mTotal = -1; mText = new BStringView("mText", ""); BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .SetInsets(0) .AddGlue() .AddGroup(B_HORIZONTAL) .AddGlue() .Add(stringView) .AddGlue() .End() .AddGlue() .AddGroup(B_HORIZONTAL) .Add(mText) .AddGlue() .End() .Add(mStatus); ResizeTo(500, 100); CenterOnScreen(); Show(); }
CStartDialog::CStartDialog(const wxString &title) : wxWizard( NULL, wxID_ANY, title, wxNullBitmap ) { std::vector<std::vector<wxString> > hitters, pitchers; m_good = true; // CDataImporter importer( "2012_DEMO_DB.8.xlsx" ); // importer.ReadData( hitters, pitchers ); SetIcon( wxICON( BaseballDraft ) ); m_db = new CDb(); m_db->OpenConnection( "draft.db" ); m_league = NULL; if( !m_db->IsConnected() ) wxMessageBox( "Cannot establish connection to database" ); else { // m_db->InsertPlayers( hitters, pitchers ); m_db->GetLeagueList( m_leaguesList ); if( !m_leaguesList.empty() ) { GetPageAreaSizer()->Add( CreateOrSelectLeagueWizard( this, m_leaguesList ) ); CenterOnScreen(); Bind( wxEVT_WIZARD_CANCEL, &CStartDialog::OnExit, this ); m_delete->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &CStartDialog::OnLeagueDelete, this ); m_new->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &CStartDialog::OnLeagueCreated, this ); m_edit->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &CStartDialog::OnLeagueCreated, this ); m_leagues->Bind( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, &CStartDialog::OnSelect, this ); } else { m_good = false; delete m_db; } } }
SettingsWindow::SettingsWindow(BRect frame, SettingsMessage* settings) : BWindow(frame, B_TRANSLATE("Settings"), B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE), fSettings(settings) { fApplyButton = new BButton(B_TRANSLATE("Apply"), new BMessage(MSG_APPLY)); fCancelButton = new BButton(B_TRANSLATE("Cancel"), new BMessage(MSG_CANCEL)); fRevertButton = new BButton(B_TRANSLATE("Revert"), new BMessage(MSG_REVERT)); fOpenFilePanel = NULL; float spacing = be_control_look->DefaultItemSpacing(); BTabView* tabView = new BTabView("settings pages", B_WIDTH_FROM_LABEL); tabView->SetBorder(B_NO_BORDER); BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .SetInsets(0, B_USE_DEFAULT_SPACING, 0, B_USE_WINDOW_SPACING) .Add(tabView) .Add(new BSeparatorView(B_HORIZONTAL)) .AddGroup(B_HORIZONTAL) .SetInsets(B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING, B_USE_WINDOW_SPACING, 0) .Add(fRevertButton) .AddGlue() .Add(fCancelButton) .Add(fApplyButton); tabView->AddTab(_CreateGeneralPage(spacing)); tabView->AddTab(_CreateFontsPage(spacing)); tabView->AddTab(_CreateProxyPage(spacing)); _SetupFontSelectionView(fStandardFontView, new BMessage(MSG_STANDARD_FONT_CHANGED)); _SetupFontSelectionView(fSerifFontView, new BMessage(MSG_SERIF_FONT_CHANGED)); _SetupFontSelectionView(fSansSerifFontView, new BMessage(MSG_SANS_SERIF_FONT_CHANGED)); _SetupFontSelectionView(fFixedFontView, new BMessage(MSG_FIXED_FONT_CHANGED)); fApplyButton->MakeDefault(true); if (!frame.IsValid()) CenterOnScreen(); // load settings from disk _RevertSettings(); // apply to WebKit _ApplySettings(); // Start hidden Hide(); Show(); }
ScreenSaverWindow::ScreenSaverWindow() : BWindow(BRect(50.0f, 50.0f, 50.0f + kWindowWidth, 50.0f + kWindowHeight), B_TRANSLATE_SYSTEM_NAME("ScreenSaver"), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS) { fSettings.Load(); fMinWidth = floorf(be_control_look->DefaultItemSpacing() * (kWindowWidth / kDefaultItemSpacingAt12pt)); font_height fontHeight; be_plain_font->GetHeight(&fontHeight); float textHeight = ceilf(fontHeight.ascent + fontHeight.descent); fMinHeight = ceilf(std::max(kWindowHeight, textHeight * 28)); // Create the password editing window fPasswordWindow = new PasswordWindow(fSettings); fPasswordWindow->Run(); // Create the tab view fTabView = new TabView(); fTabView->SetBorder(B_NO_BORDER); // Create the controls inside the tabs fFadeView = new FadeView(B_TRANSLATE("General"), fSettings); fModulesView = new ModulesView(B_TRANSLATE("Screensavers"), fSettings); fTabView->AddTab(fFadeView); fTabView->AddTab(fModulesView); // Create the topmost background view BView* topView = new BView("topView", B_WILL_DRAW); topView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); topView->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH, B_ALIGN_USE_FULL_HEIGHT)); topView->SetExplicitMinSize(BSize(fMinWidth, fMinHeight)); BLayoutBuilder::Group<>(topView, B_VERTICAL) .SetInsets(0, B_USE_DEFAULT_SPACING, 0, B_USE_WINDOW_SPACING) .Add(fTabView) .End(); SetLayout(new BGroupLayout(B_VERTICAL)); GetLayout()->AddView(topView); fTabView->Select(fSettings.WindowTab()); if (fSettings.WindowFrame().left > 0 && fSettings.WindowFrame().top > 0) MoveTo(fSettings.WindowFrame().left, fSettings.WindowFrame().top); if (fSettings.WindowFrame().Width() > 0 && fSettings.WindowFrame().Height() > 0) { ResizeTo(fSettings.WindowFrame().Width(), fSettings.WindowFrame().Height()); } CenterOnScreen(); }
// ResourceUsageWindow - Constructor ResourceUsageWindow::ResourceUsageWindow(BRect frame, BList &list) : BWindow (frame, B_TRANSLATE("Resource Usage"), B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL , B_NOT_ZOOMABLE|B_NOT_RESIZABLE) { InitWindow(list); CenterOnScreen(); Show(); }
Window::Window() : BWindow(BRect(100, 100, 620, 200), "Alert-Test", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS) { BMenu* sizeMenu = new BMenu("Button size"); sizeMenu->SetLabelFromMarked(true); sizeMenu->SetRadioMode(true); sizeMenu->AddItem(new BMenuItem("As usual", NULL)); sizeMenu->AddItem(new BMenuItem("From widest", NULL)); sizeMenu->AddItem(new BMenuItem("From label", NULL)); sizeMenu->ItemAt(0)->SetMarked(true); fSizeField = new BMenuField("Button size", sizeMenu); BMenu* typeMenu = new BMenu("Alert type"); typeMenu->SetLabelFromMarked(true); typeMenu->SetRadioMode(true); typeMenu->AddItem(new BMenuItem("Empty", NULL)); typeMenu->AddItem(new BMenuItem("Info", NULL)); typeMenu->AddItem(new BMenuItem("Idea", NULL)); typeMenu->AddItem(new BMenuItem("Warning", NULL)); typeMenu->AddItem(new BMenuItem("Stop", NULL)); typeMenu->ItemAt(0)->SetMarked(true); fTypeField = new BMenuField("Alert type", typeMenu); BMenu* spacingMenu = new BMenu("Button spacing"); spacingMenu->SetLabelFromMarked(true); spacingMenu->SetRadioMode(true); spacingMenu->AddItem(new BMenuItem("Even", NULL)); spacingMenu->AddItem(new BMenuItem("Offset", NULL)); spacingMenu->ItemAt(0)->SetMarked(true); fSpacingField = new BMenuField("Button spacing", spacingMenu); fCountSlider = new BSlider("count", "Button count", NULL, 1, 3, B_HORIZONTAL); fCountSlider->SetValue(3); fCountSlider->SetLimitLabels("1", "3"); fCountSlider->SetHashMarkCount(3); fCountSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); fLastStringView = new BStringView("last pressed", ""); fLastStringView->SetAlignment(B_ALIGN_CENTER); BButton* button = new BButton("Show alert", new BMessage(kMsgShowAlert)); BLayoutBuilder::Group<>(this, B_VERTICAL) .Add(fSizeField) .Add(fTypeField) .Add(fSpacingField) .Add(fCountSlider) .AddGlue() .Add(fLastStringView) .Add(button) .SetInsets(B_USE_DEFAULT_SPACING); CenterOnScreen(); SetFlags(Flags() | B_CLOSE_ON_ESCAPE); }
MainWindow::MainWindow() : BWindow(BRect(0, 0, 300, 400), "Caya", B_TITLED_WINDOW, 0), fWorkspaceChanged(false) { fStatusView = new StatusView("statusView"); SearchBarTextControl* searchBox = new SearchBarTextControl(new BMessage(kSearchContact)); fListView = new RosterListView("buddyView"); fListView->SetInvocationMessage(new BMessage(CAYA_OPEN_CHAT_WINDOW)); BScrollView* scrollView = new BScrollView("scrollview", fListView, B_WILL_DRAW, false, true); // Wrench menu BPopUpMenu* wrenchMenu = new BPopUpMenu("Wrench"); (void)wrenchMenu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS, new BMessage(B_ABOUT_REQUESTED))); (void)wrenchMenu->AddItem(new BSeparatorItem()); (void)wrenchMenu->AddItem(new BMenuItem("Preferences" B_UTF8_ELLIPSIS, new BMessage(CAYA_SHOW_SETTINGS))); (void)wrenchMenu->AddItem(new BSeparatorItem()); (void)wrenchMenu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED))); wrenchMenu->SetTargetForItems(this); // Tool icon BResources* res = CayaResources(); BBitmap* toolIcon = IconFromResources(res, kToolIcon); delete res; // Wrench tool button ToolButton* wrench = new ToolButton(NULL, NULL); wrench->SetBitmap(toolIcon); wrench->SetMenu(wrenchMenu); SetLayout(new BGridLayout(1, 2)); AddChild(BGridLayoutBuilder(1, 2) .Add(searchBox, 0, 0) .Add(wrench, 1, 0) .Add(scrollView, 0, 1, 2) .Add(fStatusView, 0, 2, 2) .SetInsets(5, 5, 5, 10) ); AddShortcut('a', B_COMMAND_KEY, new BMessage(B_ABOUT_REQUESTED)); MoveTo(BAlert::AlertPosition(Bounds().Width(), Bounds().Height() / 2)); // Filter messages using Server fServer = new Server(); AddFilter(fServer); CenterOnScreen(); //TODO check for errors here ReplicantStatusView::InstallReplicant(); }
InstConsoleWindow::InstConsoleWindow(Instance *inst, MainWindow* mainWin, bool quitAppOnClose) : wxFrame(NULL, -1, _("MultiMC Console"), wxDefaultPosition, wxSize(620, 250)) { SetAprilFonts(this); m_quitAppOnClose = quitAppOnClose; m_mainWin = mainWin; m_running = nullptr; m_inst = inst; crashReportIsOpen = false; wxPanel *mainPanel = new wxPanel(this, -1); wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL); mainPanel->SetSizer(mainSizer); consoleTextCtrl = new wxTextCtrl(mainPanel, -1, wxEmptyString, wxDefaultPosition, wxSize(200, 100), wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH); mainSizer->Add(consoleTextCtrl, wxSizerFlags(1).Expand().Border(wxALL, 8)); consoleTextCtrl->SetBackgroundColour(*wxWHITE); wxBoxSizer *btnBox = new wxBoxSizer(wxHORIZONTAL); mainSizer->Add(btnBox, 0, wxEXPAND | wxBOTTOM | wxRIGHT | wxLEFT, 8); wxButton *crashReportBtn = new wxButton(mainPanel, ID_GENREPORT, _("Generate Crash &Report")); btnBox->Add(crashReportBtn, wxSizerFlags(0).Align(wxALIGN_LEFT)); btnBox->AddStretchSpacer(); killButton = new wxButton(mainPanel, wxID_DELETE, _("&Kill Minecraft")); btnBox->Add(killButton, wxSizerFlags(0).Align(wxALIGN_RIGHT)); closeButton = new wxButton(mainPanel, wxID_CLOSE, _("&Close")); btnBox->Add(closeButton, wxSizerFlags(0).Align(wxALIGN_RIGHT)); // close is close at this point. there is no linked process yet. SetCloseIsHide(false); consoleIcons = new wxIconArray(); wxMemoryInputStream iconInput1(console, sizeof(console)); wxMemoryInputStream iconInput2(console_error, sizeof(console_error)); wxMemoryInputStream iconInput3(console24, sizeof(console24)); wxMemoryInputStream iconInput4(console_error24, sizeof(console_error24)); wxIcon icon_OK,icon_BAD,icon_OK24,icon_BAD24; icon_OK.CopyFromBitmap(wxBitmap(wxImage(iconInput1))); icon_BAD.CopyFromBitmap(wxBitmap(wxImage(iconInput2))); icon_OK24.CopyFromBitmap(wxBitmap(wxImage(iconInput3))); icon_BAD24.CopyFromBitmap(wxBitmap(wxImage(iconInput4))); consoleIcons->Add(icon_OK); consoleIcons->Add(icon_BAD); consoleIcons->Add(icon_OK24); consoleIcons->Add(icon_BAD24); // Create the task bar icon. trayIcon = new ConsoleIcon(this); SetState(STATE_OK); CenterOnScreen(); }
// -------------------------------------------------------------- NetworkSetupWindow::NetworkSetupWindow(const char *title) : BWindow(BRect(100, 100, 300, 300), title, B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS), fAddonCount(0) { // ---- Profiles section BMenu *profilesPopup = new BPopUpMenu("<none>"); _BuildProfilesMenu(profilesPopup, kMsgProfileSelected); BMenuField *profilesMenuField = new BMenuField("profiles_menu", B_TRANSLATE("Profile:"), profilesPopup); profilesMenuField->SetFont(be_bold_font); profilesMenuField->SetEnabled(false); // ---- Settings section fPanel = new BTabView("showview_box"); fApplyButton = new BButton("apply", B_TRANSLATE("Apply"), new BMessage(kMsgApply)); SetDefaultButton(fApplyButton); fRevertButton = new BButton("revert", B_TRANSLATE("Revert"), new BMessage(kMsgRevert)); // fRevertButton->SetEnabled(false); // Enable boxes resizing modes //fPanel->SetResizingMode(B_FOLLOW_ALL); // Build the layout SetLayout(new BGroupLayout(B_VERTICAL)); AddChild(BGroupLayoutBuilder(B_VERTICAL, B_USE_SMALL_SPACING) .AddGroup(B_HORIZONTAL, B_USE_SMALL_SPACING) .Add(profilesMenuField) .AddGlue() .End() .Add(fPanel) .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING) .Add(fRevertButton) .AddGlue() .Add(fApplyButton) .End() .SetInsets(B_USE_SMALL_SPACING, B_USE_SMALL_SPACING, B_USE_SMALL_SPACING, B_USE_SMALL_SPACING) ); _BuildShowTabView(kMsgAddonShow); fPanel->SetExplicitMinSize(BSize(fMinAddonViewRect.Width(), fMinAddonViewRect.Height())); fAddonView = NULL; CenterOnScreen(); }
void ScreenshotWindow::_ResizeToFitAndCenter() { float minWidth; float minHeight; GetSizeLimits(&minWidth, NULL, &minHeight, NULL); ResizeTo(minWidth, minHeight); CenterOnScreen(); }
MainWindow::MainWindow(BRect frame) : BWindow(frame, "Torrentor!", B_DOCUMENT_WINDOW, B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE ) { SetPulseRate(1000000); // // // SetLayout(new BGroupLayout(B_VERTICAL, 0.0)); CreateMenuBar(); fDownloadView = new DownloadView; // BStringView* fStatusText = new BStringView("status", "Laralala"); // fStatusText->SetAlignment(B_ALIGN_LEFT); // fStatusText->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); /// fStatusText->SetExplicitMinSize(BSize(150, 12)); AddChild(BGroupLayoutBuilder(B_VERTICAL, 0.0) .Add(fMenuBar) .Add(fDownloadView->ScrollView()) /* .Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER)) .Add(BGroupLayoutBuilder(B_HORIZONTAL, spacing) .AddGlue() .Add(fRemoveMissingButton) .Add(fRemoveFinishedButton) .SetInsets(12, 5, 12, 5) )*/ ); // // // fOpenPanel = new BFilePanel(B_OPEN_PANEL, NULL, NULL, B_FILE_NODE, true, NULL, new TorrentRefFilter); // // // fPreferencesWindow = new PreferencesWindow(); // CenterOnScreen(); }
KeyboardWindow::KeyboardWindow() : BWindow(BRect(0, 0, 200, 200), B_TRANSLATE_SYSTEM_NAME("Keyboard"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS) { MoveTo(fSettings.WindowCorner()); // Add the main settings view fSettingsView = new KeyboardView(); BBox* fSettingsBox = new BBox("keyboard_box"); fSettingsBox->AddChild(fSettingsView); // Add the "Default" button.. fDefaultsButton = new BButton(B_TRANSLATE("Defaults"), new BMessage(BUTTON_DEFAULTS)); // Add the "Revert" button... fRevertButton = new BButton(B_TRANSLATE("Revert"), new BMessage(BUTTON_REVERT)); fRevertButton->SetEnabled(false); // Build the layout SetLayout(new BGroupLayout(B_VERTICAL)); AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) .Add(fSettingsBox) .AddGroup(B_HORIZONTAL, 7) .Add(fDefaultsButton) .Add(fRevertButton) .AddGlue() .End() .SetInsets(10, 10, 10, 10) ); BSlider* slider = (BSlider* )FindView("key_repeat_rate"); if (slider !=NULL) slider->SetValue(fSettings.KeyboardRepeatRate()); slider = (BSlider* )FindView("delay_until_key_repeat"); if (slider !=NULL) slider->SetValue(fSettings.KeyboardRepeatDelay()); fDefaultsButton->SetEnabled(fSettings.IsDefaultable()); // center window if it would be off-screen BScreen screen; if (screen.Frame().right < Frame().right || screen.Frame().bottom < Frame().bottom) { CenterOnScreen(); } #ifdef DEBUG fSettings.Dump(); #endif Show(); }
FindOpenFileWindow::FindOpenFileWindow(const char* panelText) : DWindow(BRect(0, 0, 0, 0), TR("Find and open file"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS) { AddCommonFilter(new EscapeCancelFilter()); BView* top = GetBackgroundView(); fNameTextControl = new AutoTextControl("nameText", TR("Open: "), "", new BMessage); fNameTextControl->SetExplicitMinSize( BSize(fNameTextControl->StringWidth("M") * 20, B_SIZE_UNSET)); fSystemCheckBox = new BCheckBox("systembox", TR("Search only system folders"), new BMessage); BButton* cancel = new BButton("cancel", TR("Cancel"), new BMessage(B_QUIT_REQUESTED)); BButton* open = new BButton("open", TR("Open"), new BMessage(M_FIND_FILE)); BLayoutBuilder::Group<>(top, B_VERTICAL) .AddGrid(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) .Add(fNameTextControl->CreateLabelLayoutItem(), 0, 0) .Add(fNameTextControl->CreateTextViewLayoutItem(), 1, 0) .Add(fSystemCheckBox, 1, 1) .End() .AddGlue() .AddGroup(B_HORIZONTAL) .AddGlue() .Add(cancel) .Add(open) .End() .SetInsets(B_USE_WINDOW_INSETS) .End(); BString text = panelText; if (text.CountChars() > 1) { fNameTextControl->SetText(text.String()); int32 position = text.FindLast("."); if (position > 0) fNameTextControl->TextView()->Select(0, position); else fNameTextControl->TextView()->SelectAll(); } else { fNameTextControl->SetText(".h"); fNameTextControl->TextView()->GoToLine(0); } open->MakeDefault(true); fNameTextControl->MakeFocus(true); CenterOnScreen(); }
ScreenshotWindow::ScreenshotWindow(BWindow* parent, BRect frame) : BWindow(frame, B_TRANSLATE("Screenshot"), B_FLOATING_WINDOW_LOOK, B_FLOATING_SUBSET_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS), fBarberPoleShown(false), fDownloadPending(false), fWorkerThread(-1) { AddToSubset(parent); atomic_set(&fCurrentScreenshotIndex, 0); fBarberPole = new BarberPole("barber pole"); fBarberPole->SetExplicitMaxSize(BSize(100, B_SIZE_UNLIMITED)); fBarberPole->Hide(); fIndexView = new BStringView("screenshot index", NULL); fToolBar = new BToolBar(); fToolBar->AddAction(MSG_PREVIOUS_SCREENSHOT, this, sNextButtonIcon->Bitmap(SharedBitmap::SIZE_22), NULL, NULL); fToolBar->AddAction(MSG_NEXT_SCREENSHOT, this, sPreviousButtonIcon->Bitmap(SharedBitmap::SIZE_22), NULL, NULL); fToolBar->AddView(fIndexView); fToolBar->AddGlue(); fToolBar->AddView(fBarberPole); fScreenshotView = new BitmapView("screenshot view"); fScreenshotView->SetExplicitMaxSize( BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); fScreenshotView->SetScaleBitmap(false); BGroupView* groupView = new BGroupView(B_VERTICAL); groupView->SetViewColor(kBackgroundColor); // Build layout BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .SetInsets(0, 3, 0, 0) .Add(fToolBar) .AddStrut(3) .AddGroup(groupView) .Add(fScreenshotView) .SetInsets(B_USE_WINDOW_INSETS) .End() ; fScreenshotView->SetLowColor(kBackgroundColor); // Set after attaching all views to prevent it from being overriden // again by BitmapView::AllAttached() CenterOnScreen(); }
OpenGLWindow::OpenGLWindow() : BWindow(BRect(50, 50, 450, 400), B_TRANSLATE_SYSTEM_NAME("OpenGL"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS) { SetLayout(new BGroupLayout(B_VERTICAL)); fView = new OpenGLView(); GetLayout()->AddView(fView); CenterOnScreen(); }
//------------------------------------------------------------------------------ WelcomePanel::WelcomePanel(wxFrame *frame, const wxString& title, int x, int y, int w, int h) : wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h), // wxRESIZE_BOX is no longer in wxWidgets-3.0 //(wxDEFAULT_FRAME_STYLE & ~ (wxRESIZE_BORDER | wxRESIZE_BOX | wxMAXIMIZE_BOX)) | wxFRAME_FLOAT_ON_PARENT) (wxDEFAULT_FRAME_STYLE & ~ (wxRESIZE_BORDER | wxMAXIMIZE_BOX)) | wxFRAME_FLOAT_ON_PARENT) { SetBackgroundColour(wxNullColour); Create(); CenterOnScreen(wxBOTH); SetFocus(); }
CLoginDlg::CLoginDlg(wxDialog *parent, const wxString &title) : wxDialog(parent, wxID_ANY, title) { wxIcon icoApp(wxString::FromUTF8("./images/icon/jo_browser.ico"), wxBITMAP_TYPE_ICO); SetIcon(icoApp); SetBackgroundColour(wxColor(242, 243, 247)); SetInitialSize(wxSize(500, 300)); wxGridBagSizer *bCtrlSizer = new wxGridBagSizer(3, 4); ///服务器信息 m_staticTextServer = new wxStaticText(this, wxID_ANY, wxT(" 服务器"), wxDefaultPosition, wxSize(100, -1), wxALIGN_RIGHT); m_textServer = new wxTextCtrl(this, wxID_ANY, wxT("192.168.1.106"), wxDefaultPosition, wxSize(200, -1), wxALIGN_LEFT); bCtrlSizer->Add(m_staticTextServer, wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT); bCtrlSizer->Add(m_textServer, wxGBPosition(0, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT); ///用户名 m_staticTextUser = new wxStaticText(this, wxID_ANY, wxT("用户名称"), wxDefaultPosition, wxSize(100, -1), wxALIGN_RIGHT); m_textUser = new wxTextCtrl(this, wxID_ANY, wxT("admin"), wxDefaultPosition, wxSize(200, -1), wxALIGN_LEFT); bCtrlSizer->Add(m_staticTextUser, wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT); bCtrlSizer->Add(m_textUser, wxGBPosition(1, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT); ///密码 m_staticTextPassw = new wxStaticText(this, wxID_ANY, wxT(" 密码"), wxDefaultPosition, wxSize(100, -1), wxALIGN_RIGHT); m_textPassw = new wxTextCtrl(this, wxID_ANY, wxT("admin"), wxDefaultPosition, wxSize(200, -1), wxTE_PASSWORD | wxALIGN_LEFT); bCtrlSizer->Add(m_staticTextPassw, wxGBPosition(2, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT); bCtrlSizer->Add(m_textPassw, wxGBPosition(2, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT); wxBoxSizer *btnSizer = new wxBoxSizer(wxHORIZONTAL); ///登录取消 m_btnLogin = new wxButton(this, wxID_OK, wxT("登录"), wxDefaultPosition, wxDefaultSize, 0); m_btnLogin->SetDefault(); m_btnCancel = new wxButton(this, wxID_CANCEL, wxT("取消"), wxDefaultPosition, wxDefaultSize, 0); btnSizer-> AddSpacer(240); btnSizer->Add(m_btnLogin, 0, wxALIGN_CENTER); btnSizer->AddSpacer(15); btnSizer->Add(m_btnCancel, 1, wxALIGN_CENTER); ///对话框 wxBoxSizer* dlgSizer = new wxBoxSizer(wxVERTICAL); dlgSizer->AddSpacer(60); dlgSizer->Add(bCtrlSizer, 0, wxALIGN_CENTRE); //dlgSizer->AddSpacer(5); dlgSizer->Add(btnSizer, 1, wxALIGN_CENTRE); SetSizer(dlgSizer); Layout(); CenterOnScreen(); m_textServer->SetFocus(); }
PreferencesWindow::PreferencesWindow() : BWindow(kDefaultFrame, "Preferences", B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE), fTorrentPreferences(NULL), fApplyButton(NULL), fIncompleteFileNaming(NULL), fTorrentSaveLocationPath(NULL), fIncompleteDirEnabled(NULL), fIncompleteDirPath(NULL), fListeningPort(NULL), fRandomPort(NULL), fApplyPort(NULL), fEnableForwardingPort(NULL), fMaxConnection(NULL), fApplyMaxConnection(NULL), fTorrentMaxConnection(NULL), fApplyTorrentMaxConnection(NULL), fEnableDHTValue(NULL), fEnablePEXValue(NULL), fEnableUTPValue(NULL), fEnableLPDValue(NULL), fEncryptionMenu(NULL) { SetLayout(new BGroupLayout(B_VERTICAL)); // // Get the torrent session. // @TODO: clean up this mess.. // fTorrentPreferences = static_cast<TorrentorApp*>(be_app)->Preferences(); float spacing = be_control_look->DefaultItemSpacing(); BTabView* tabView = new BTabView("settings pages", B_WIDTH_FROM_LABEL); tabView->AddTab(_CreateTorrentsPage(spacing)); tabView->AddTab(_CreateConnectionPage(spacing)); AddChild(BGroupLayoutBuilder(B_VERTICAL, spacing) .Add(tabView) .SetInsets(spacing, spacing, spacing, spacing) ); CenterOnScreen(); Run(); }
AboutWindow::AboutWindow() : BWindow(BRect(0, 0, 500, 300), B_TRANSLATE("About this system"), B_TITLED_WINDOW, B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_ZOOMABLE) { SetLayout(new BGroupLayout(B_VERTICAL)); AddChild(new AboutView()); // Make sure we take the minimal window size into account when centering BSize size = GetLayout()->MinSize(); ResizeTo(max_c(size.width, Bounds().Width()), max_c(size.height, Bounds().Height())); CenterOnScreen(); }
PackageWindow::PackageWindow(const entry_ref* ref) : BWindow(BRect(100, 100, 600, 300), B_TRANSLATE_SYSTEM_NAME("PackageInstaller"), B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS) { PackageView* view = new PackageView(ref); BLayoutBuilder::Group<>(this, B_VERTICAL, 0.0f) .Add(view) ; CenterOnScreen(); }
wxCurlDialogReturnFlag wxCurlTransferDialog::RunModal() { m_pThread->GetCurlSession()->SetVerbose(m_bVerbose); if (!HasFlag(wxCTDS_CAN_START)) { wxCommandEvent fake; OnStart(fake); // start immediately } CenterOnScreen(); return (wxCurlDialogReturnFlag)wxDialog::ShowModal(); }
CReminderDialog::CReminderDialog(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) : wxDialog(parent, id, title, pos, size, style, name) , m_pStaticSubject(NULL) , m_pStaticStartTime(NULL) , m_pTasksList(NULL) , m_pButtonDismiss(NULL) , m_pButtonSnooze(NULL) , m_pButtonDismissAll(NULL) , m_pButtonOpenItem(NULL) , m_pStaticSnooze(NULL) , m_pComboBoxSnooze(NULL) { SetIcon(wxGetApp().GetMainFrameWindow()->GetIcon()); CenterOnScreen(); }
//------------------------------------------------------------------------------ void InteractiveMatlabDialog::Show() { // add items to middle sizer theDialogSizer->Add(theTopSizer, 0, wxGROW | wxALL, 1); theDialogSizer->Add(theMiddleSizer, 0, wxGROW | wxALL, 1); theDialogSizer->Add(theBottomSizer, 0, wxGROW | wxALL, 1); // tells the enclosing window to adjust to the size of the sizer SetAutoLayout(TRUE); SetSizer(theDialogSizer); //use the sizer for layout theDialogSizer->Fit(this); //loj: if theParent is used it doesn't show the scroll bar theDialogSizer->SetSizeHints(this); //set size hints to honour minimum size CenterOnScreen(wxBOTH); }