void CPanelPreferences::CreateControls() { CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple(); CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced(); wxASSERT(pSkinSimple); wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple)); wxASSERT(pSkinAdvanced); wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced)); wxSize textCtrlSize = getTextCtrlSize(wxT("999.99")); wxSize timeCtrlSize = getTextCtrlSize(wxT("23:59 ")); CPanelPreferences* itemDialog1 = this; wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); itemDialog1->SetSizer(itemBoxSizer2); m_bUsingLocalPrefs = doesLocalPrefsFileExist(); if (! web_prefs_url->IsEmpty()) { wxStaticBox* topSectionStaticBox = new wxStaticBox(); topSectionStaticBox->SetBackgroundStyle(wxBG_STYLE_TRANSPARENT); topSectionStaticBox->Create(this, -1, wxEmptyString); wxStaticBoxSizer* topSectionSizer = new wxStaticBoxSizer( topSectionStaticBox, wxVERTICAL ); wxBoxSizer* topControlsSizer = new wxBoxSizer( wxHORIZONTAL ); topSectionSizer->Add(topControlsSizer); wxBitmap warningBmp = GetScaledBitmapFromXPMData(warning_xpm); CTransparentStaticBitmap* bmpWarning = new CTransparentStaticBitmap( topSectionStaticBox, wxID_ANY, warningBmp, wxDefaultPosition, wxDefaultSize, 0 ); bmpWarning->SetMinSize( warningBmp.GetSize() ); topControlsSizer->Add( bmpWarning, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0 ); wxBoxSizer* legendSizer = new wxBoxSizer( wxVERTICAL ); if (m_bUsingLocalPrefs) { legendSizer->Add( new CTransparentStaticText( topSectionStaticBox, wxID_ANY, _("Using local preferences.\n" "Click \"Use web prefs\" to use web-based preferences from" ), wxDefaultPosition, wxDefaultSize, 0 ), 0, wxALL, 1 ); } else { legendSizer->Add( new CTransparentStaticText( topSectionStaticBox, wxID_ANY, _("Using web-based preferences from"), wxDefaultPosition, wxDefaultSize, 0 ), 0, wxALL, 1 ); } legendSizer->Add( new CTransparentHyperlinkCtrl( topSectionStaticBox, wxID_ANY, *web_prefs_url, *web_prefs_url, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE, wxHyperlinkCtrlNameStr, &m_backgroundBitmap ), 0, wxLEFT, 5 ); if (!m_bUsingLocalPrefs) { legendSizer->Add( new CTransparentStaticText( topSectionStaticBox, wxID_ANY, _("Set values and click Save to use local preferences instead."), wxDefaultPosition, wxDefaultSize, 0 ), 0, wxALL, 1 ); } #if 1 topSectionSizer->AddSpacer( 10 ); CTransparentStaticLine* itemStaticLine8 = new CTransparentStaticLine( topSectionStaticBox, wxID_ANY, wxDefaultPosition, wxSize(ADJUSTFORXDPI(300), 1), wxLI_HORIZONTAL|wxNO_BORDER ); itemStaticLine8->SetLineColor(pSkinSimple->GetStaticLineColor()); topSectionSizer->Add(itemStaticLine8, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, ADJUSTFORXDPI(20)); topSectionSizer->AddSpacer( 10 ); CTransparentStaticText* itemStaticText7 = new CTransparentStaticText( topSectionStaticBox, wxID_ANY, _("For additional settings, select Computing Preferences in the Advanced View."), wxDefaultPosition, wxDefaultSize, 0 ); topSectionSizer->Add(itemStaticText7, 0, wxALL, 0); topSectionSizer->AddSpacer( 10 ); #endif topControlsSizer->Add( legendSizer, 1, wxALL, 1 ); m_btnClear = new wxButton( topSectionStaticBox, ID_SGPREFERENCESCLEAR, _("Use web prefs"), wxDefaultPosition, wxDefaultSize, 0 ); m_btnClear->SetToolTip( _("Restore web-based preferences and close the dialog.") ); if (!m_bUsingLocalPrefs) { m_btnClear->Hide(); } topControlsSizer->Add( m_btnClear, 0, wxALIGN_BOTTOM|wxALL, 4 ); #ifdef __WXMAC__ itemBoxSizer2->Add( topSectionSizer, 0, wxTOP|wxLEFT|wxRIGHT|wxEXPAND, 10 ); #else itemBoxSizer2->Add( topSectionSizer, 0, wxALL|wxEXPAND, 5 ); #endif } wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL); itemBoxSizer2->Add(itemBoxSizer11, 0, wxLEFT, ADJUSTFORXDPI(20)); wxString ProcOnBatteriesTT(_("Check this to suspend computing on portables when running on battery power.")); m_chkProcOnBatteries = new CTransparentCheckBox( itemDialog1, ID_CHKPROCONBATTERIES, _("Suspend when computer is on battery"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxCheckBoxNameStr, &m_backgroundBitmap ); m_chkProcOnBatteries->SetToolTip(ProcOnBatteriesTT); itemBoxSizer11->Add(m_chkProcOnBatteries, 0, wxALL, 5 ); wxString ProcInUseTT(_("Check this to suspend computing and file transfers when you're using the computer.")); m_chkProcInUse = new CTransparentCheckBox( itemDialog1, ID_CHKPROCINUSE, _("Suspend when computer is in use"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxCheckBoxNameStr, &m_backgroundBitmap ); m_chkProcInUse->SetToolTip(ProcInUseTT); itemBoxSizer11->Add(m_chkProcInUse, 0, wxALL, 5 ); // min idle time wxString ProcIdleForTT(_("This determines when the computer is considered 'in use'.")); CTransparentStaticText* staticText24 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("'In use' means mouse/keyboard input in last"), wxDefaultPosition, wxDefaultSize, 0 ); m_txtProcIdleFor = new wxTextCtrl( itemDialog1, ID_TXTPROCIDLEFOR, wxEmptyString, wxDefaultPosition, textCtrlSize, wxTE_RIGHT ); CTransparentStaticText* staticText25 = new CTransparentStaticText(itemDialog1, wxID_ANY, _("minutes"), wxDefaultPosition, wxDefaultSize, 0 ); addNewRowToSizer(itemBoxSizer11, ProcIdleForTT, staticText24, m_txtProcIdleFor, staticText25); /*xgettext:no-c-format*/ wxString MaxCPUTimeTT(_("Suspend/resume computing every few seconds to reduce CPU temperature and energy usage. Example: 75% means compute for 3 seconds, wait for 1 second, and repeat.")); CTransparentStaticText* staticText22 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("Use at most"), wxDefaultPosition, wxDefaultSize, 0 ); m_txtProcUseCPUTime = new wxTextCtrl( itemDialog1, ID_TXTPOCUSECPUTIME, wxEmptyString, wxDefaultPosition, textCtrlSize, wxTE_RIGHT ); /*xgettext:no-c-format*/ CTransparentStaticText* staticText23 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("% of CPU time"), wxDefaultPosition, wxDefaultSize, 0 ); addNewRowToSizer(itemBoxSizer11, MaxCPUTimeTT, staticText22, m_txtProcUseCPUTime, staticText23); wxString andString(_("and")); wxString ProcEveryDayTT(_("Compute only during a particular period each day.")); m_chkProcEveryDay = new CTransparentCheckBox( itemDialog1, ID_CHKPROCEVERYDAY, _("Compute only between"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxCheckBoxNameStr, &m_backgroundBitmap ); m_txtProcEveryDayStart = new wxTextCtrl( itemDialog1, ID_TXTPROCEVERYDAYSTART, wxEmptyString, wxDefaultPosition, timeCtrlSize, wxTE_RIGHT ); CTransparentStaticText* staticText26 = new CTransparentStaticText( itemDialog1, wxID_ANY, andString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE ); m_txtProcEveryDayStop = new wxTextCtrl( itemDialog1, ID_TXTPROCEVERYDAYSTOP, wxEmptyString, wxDefaultPosition, timeCtrlSize, wxTE_RIGHT ); addNewRowToSizer( itemBoxSizer11, ProcEveryDayTT, m_chkProcEveryDay, m_txtProcEveryDayStart, staticText26, m_txtProcEveryDayStop ); wxString NetEveryDayTT(_("Transfer files only during a particular period each day.")); m_chkNetEveryDay = new CTransparentCheckBox( itemDialog1, ID_CHKNETEVERYDAY, _("Transfer files only between"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxCheckBoxNameStr, &m_backgroundBitmap ); m_txtNetEveryDayStart = new wxTextCtrl( itemDialog1, ID_TXTNETEVERYDAYSTART, wxEmptyString, wxDefaultPosition, timeCtrlSize, 0 ); CTransparentStaticText* staticText37 = new CTransparentStaticText( itemDialog1, wxID_ANY, andString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE ); m_txtNetEveryDayStop = new wxTextCtrl( itemDialog1, ID_TXTNETEVERYDAYSTOP, wxEmptyString, wxDefaultPosition, timeCtrlSize, 0 ); addNewRowToSizer(itemBoxSizer11, NetEveryDayTT, m_chkNetEveryDay, m_txtNetEveryDayStart, staticText37, m_txtNetEveryDayStop); wxString DiskMaxSpaceTT = wxEmptyString; DiskMaxSpaceTT.Printf(_("Limit the total amount of disk space used by %s."), pSkinAdvanced->GetApplicationShortName().c_str()); m_chkDiskMaxSpace = new CTransparentCheckBox ( itemDialog1, ID_CHKDISKMAXSPACE, _("Use no more than"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxCheckBoxNameStr, &m_backgroundBitmap ); m_txtDiskMaxSpace = new wxTextCtrl( itemDialog1, ID_TXTDISKMAXSPACE,wxEmptyString, wxDefaultPosition, getTextCtrlSize(wxT("9999.99")), wxTE_RIGHT ); CTransparentStaticText* staticText41 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("GB of disk space"), wxDefaultPosition, wxDefaultSize, 0 ); addNewRowToSizer(itemBoxSizer11, DiskMaxSpaceTT, m_chkDiskMaxSpace, m_txtDiskMaxSpace, staticText41); wxBoxSizer* itemBoxSizer44 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(itemBoxSizer44, 0, wxALIGN_RIGHT|wxALL, ADJUSTFORXDPI(5)); wxButton* itemButton44 = new wxButton( itemDialog1, wxID_OK, _("Save"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton44->SetToolTip( _("Save all values and close the dialog.") ); if (m_bUsingLocalPrefs) { itemButton44->SetDefault(); } itemBoxSizer44->Add(itemButton44, 0, wxALIGN_CENTER_VERTICAL|wxALL, ADJUSTFORXDPI(5)); wxButton* itemButton45 = new wxButton( itemDialog1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton45->SetToolTip( _("Close the dialog without saving.") ); if (!m_bUsingLocalPrefs) { itemButton45->SetDefault(); } itemBoxSizer44->Add(itemButton45, 0, wxALIGN_CENTER_VERTICAL|wxALL, ADJUSTFORXDPI(5)); #ifndef __WXMSW__ #ifdef __WXMAC__ wxButton* itemButton46 = new wxButton( this, ID_SIMPLE_HELP, _("Help"), wxDefaultPosition, wxDefaultSize, 0 ); #ifdef wxUSE_TOOLTIPS wxString helpTip; helpTip.Printf(_("Get help with %s"), pSkinAdvanced->GetApplicationShortName().c_str()); itemButton46->SetToolTip(helpTip); #endif #else wxContextHelpButton* itemButton46 = new wxContextHelpButton(this); #endif itemBoxSizer44->Add(itemButton46, 0, wxALIGN_CENTER_VERTICAL|wxALL, ADJUSTFORXDPI(5)); #endif // Set validators m_vTimeValidator = new wxTextValidator(wxFILTER_INCLUDE_CHAR_LIST); m_vTimeValidator->SetCharIncludes(wxT("0123456789:")); m_txtProcIdleFor->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); m_txtProcEveryDayStart->SetValidator(*m_vTimeValidator); m_txtProcEveryDayStop->SetValidator(*m_vTimeValidator); m_txtProcUseCPUTime->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); m_txtNetEveryDayStart->SetValidator(*m_vTimeValidator); m_txtNetEveryDayStop->SetValidator(*m_vTimeValidator); m_txtDiskMaxSpace->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); ////@end CPanelPreferences content construction }
void CProjectsComponent::ReskinInterface() { CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple(); wxASSERT(pSkinSimple); wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple)); //Set Background color only SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor()); //right button btnArwRight->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor()); btnArwRight->SetBitmapLabel(*(pSkinSimple->GetRightArrowButton()->GetBitmap())); btnArwRight->SetBitmapSelected(*(pSkinSimple->GetRightArrowButton()->GetBitmapClicked())); //left button btnArwLeft->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor()); btnArwLeft->SetBitmapLabel(*(pSkinSimple->GetLeftArrowButton()->GetBitmap())); btnArwLeft->SetBitmapSelected(*(pSkinSimple->GetLeftArrowButton()->GetBitmapClicked())); // add project btn btnAddProj->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor()); btnAddProj->SetBitmapLabel(*(pSkinSimple->GetAttachProjectButton()->GetBitmap())); btnAddProj->SetBitmapSelected(*(pSkinSimple->GetAttachProjectButton()->GetBitmapClicked())); // synchronize btn btnSynchronize->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor()); btnSynchronize->SetBitmapLabel(*(pSkinSimple->GetSynchronizeButton()->GetBitmap())); btnSynchronize->SetBitmapSelected(*(pSkinSimple->GetSynchronizeButton()->GetBitmapClicked())); // help btn btnHelp->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor()); btnHelp->SetBitmapLabel(*(pSkinSimple->GetHelpButton()->GetBitmap())); btnHelp->SetBitmapSelected(*(pSkinSimple->GetHelpButton()->GetBitmapClicked())); // messages btn btnMessages->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor()); btnMessages->SetBitmapLabel(*(pSkinSimple->GetMessagesLink()->GetBitmap())); btnMessages->SetBitmapSelected(*(pSkinSimple->GetMessagesLink()->GetBitmap())); // alert messages btn btnAlertMessages->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor()); btnAlertMessages->SetBitmapLabel(*(pSkinSimple->GetMessagesAlertLink()->GetBitmap())); btnAlertMessages->SetBitmapSelected(*(pSkinSimple->GetMessagesAlertLink()->GetBitmap())); // pause btn btnPause->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor()); btnPause->SetBitmapLabel(*(pSkinSimple->GetSuspendLink()->GetBitmap())); btnPause->SetBitmapSelected(*(pSkinSimple->GetSuspendLink()->GetBitmap())); // resume btn btnResume->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor()); btnResume->SetBitmapLabel(*(pSkinSimple->GetResumeLink()->GetBitmap())); btnResume->SetBitmapSelected(*(pSkinSimple->GetResumeLink()->GetBitmap())); // preferences btn btnPreferences->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor()); btnPreferences->SetBitmapLabel(*(pSkinSimple->GetPreferencesLink()->GetBitmap())); btnPreferences->SetBitmapSelected(*(pSkinSimple->GetPreferencesLink()->GetBitmap())); // advance view btn btnAdvancedView->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor()); btnAdvancedView->SetBitmapLabel(*(pSkinSimple->GetAdvancedLink()->GetBitmap())); btnAdvancedView->SetBitmapSelected(*(pSkinSimple->GetAdvancedLink()->GetBitmap())); //set line colors lnMyProjTop->SetLineColor(pSkinSimple->GetStaticLineColor()); lnMyProjBtm->SetLineColor(pSkinSimple->GetStaticLineColor()); // spacers i_spacer1->LoadImage(*(pSkinSimple->GetSpacerImage()->GetBitmap())); i_spacer2->LoadImage(*(pSkinSimple->GetSpacerImage()->GetBitmap())); i_spacer2->LoadImage(*(pSkinSimple->GetSpacerImage()->GetBitmap())); // Rebuild stat menus and reload icons for(int m = 0; m < (int)m_statProjects.size(); m++){ StatImageLoader *i_statImage = m_statProjects.at(m); i_statImage->LoadImage(); i_statImage->RebuildMenu(); } }
void CProjectsComponent::CreateComponent() { Freeze(); CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple(); wxASSERT(pSkinSimple); wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple)); //Set Background color SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor()); //Static content in my Projects section // add project button wxToolTip *ttAddProject = new wxToolTip(_("Volunteer for any or all of 30+ projects in many areas of science")); btnAddProj=new wxBitmapButton( this, ID_WIZARDATTACH, *pSkinSimple->GetAttachProjectButton()->GetBitmap(), wxPoint(214,7), wxSize(81,18), wxBU_AUTODRAW ); if ( pSkinSimple->GetAttachProjectButton()->GetBitmapClicked() != NULL ) { btnAddProj->SetBitmapSelected( *pSkinSimple->GetAttachProjectButton()->GetBitmapClicked() ); } btnAddProj->SetToolTip(ttAddProject); // syncronize button, hidden by default. wxToolTip *ttSynchronize = new wxToolTip(_("Synchronize projects with account manager system")); btnSynchronize=new wxBitmapButton( this, ID_WIZARDUPDATE, *pSkinSimple->GetSynchronizeButton()->GetBitmap(), wxPoint(214,7), wxSize(81,18), wxBU_AUTODRAW ); if ( pSkinSimple->GetSynchronizeButton()->GetBitmapClicked() != NULL ) { btnSynchronize->SetBitmapSelected( *pSkinSimple->GetSynchronizeButton()->GetBitmapClicked() ); } btnSynchronize->SetToolTip(ttSynchronize); btnSynchronize->Show(false); /// Help wxToolTip *ttHelp = new wxToolTip(_("Get help with BOINC")); btnHelp=new wxBitmapButton( this, ID_SIMPLE_HELP, *pSkinSimple->GetHelpButton()->GetBitmap(), wxPoint(300,7), wxSize( (*pSkinSimple->GetHelpButton()->GetBitmap()).GetWidth(), (*pSkinSimple->GetHelpButton()->GetBitmap()).GetHeight() ), wxBU_AUTODRAW ); if ( pSkinSimple->GetHelpButton()->GetBitmapClicked() != NULL ) { btnHelp->SetBitmapSelected( *pSkinSimple->GetHelpButton()->GetBitmapClicked() ); } btnHelp->SetToolTip(ttHelp); /// Line lnMyProjTop = new CTransparentStaticLine(this, wxID_ANY, wxPoint(29,29),wxSize(292,1)); lnMyProjTop->SetLineColor(pSkinSimple->GetStaticLineColor()); //// Arrow Btns btnArwLeft = new wxBitmapButton( this, -1, *pSkinSimple->GetLeftArrowButton()->GetBitmap(), wxPoint(29,47), wxSize(20,20), wxBU_AUTODRAW ); if ( pSkinSimple->GetLeftArrowButton()->GetBitmapClicked() != NULL ) { btnArwLeft->SetBitmapSelected(*pSkinSimple->GetLeftArrowButton()->GetBitmapClicked()); } btnArwLeft->Show(false);//on creation this one is always false btnArwRight = new wxBitmapButton( this, -1, *pSkinSimple->GetRightArrowButton()->GetBitmap(), wxPoint(301,47), wxSize(20,20), wxBU_AUTODRAW ); if ( pSkinSimple->GetRightArrowButton()->GetBitmapClicked() != NULL ) { btnArwRight->SetBitmapSelected(*pSkinSimple->GetRightArrowButton()->GetBitmapClicked()); } btnArwRight->Show(false); // //// Messages Play Pause Btns wxToolTip *ttMessages = new wxToolTip(_("Open a window to view messages")); btnMessages = new CLinkButton( this, ID_SIMPLE_MESSAGES, *pSkinSimple->GetMessagesLink()->GetBitmap(), wxPoint(11,86), wxSize(70,20), wxBU_AUTODRAW ); btnMessages->SetToolTip(ttMessages); wxToolTip *ttAlertMessages = new wxToolTip(_("Open a window to view messages")); btnAlertMessages = new CLinkButton( this, ID_SIMPLE_MESSAGES_ALERT, *(pSkinSimple->GetMessagesAlertLink()->GetBitmap()), wxPoint(11,86), wxSize(70,20), wxBU_AUTODRAW ); btnAlertMessages->SetToolTip(ttAlertMessages); btnAlertMessages->Show(false); //spacer w_sp1 = new wxWindow(this,-1,wxPoint(83,91),wxSize(2,11)); i_spacer1 = new ImageLoader(w_sp1); i_spacer1->LoadImage(*(pSkinSimple->GetSpacerImage()->GetBitmap())); // pause btn wxToolTip *ttPause = new wxToolTip(_("Stop all activity")); btnPause = new CLinkButton( this, ID_SIMPLE_SUSPEND, *pSkinSimple->GetSuspendLink()->GetBitmap(), wxPoint(85,86), wxSize(59,20), wxBU_AUTODRAW ); btnPause->SetToolTip(ttPause); // resume btn wxToolTip *ttResume = new wxToolTip(_("Resume activity")); btnResume = new CLinkButton( this, ID_SIMPLE_RESUME, *(pSkinSimple->GetResumeLink()->GetBitmap()), wxPoint(85,86), wxSize(59,20), wxBU_AUTODRAW ); btnResume->SetToolTip(ttResume); //spacer w_sp2 = new wxWindow(this,-1,wxPoint(144,91),wxSize(2,11)); i_spacer2 = new ImageLoader(w_sp2); i_spacer2->LoadImage(*(pSkinSimple->GetSpacerImage()->GetBitmap())); // Pref Btn wxToolTip *ttPreferences = new wxToolTip(_("Open a window to set your preferences")); btnPreferences = new CLinkButton( this, ID_SIMPLE_PREFERENCES, *(pSkinSimple->GetPreferencesLink()->GetBitmap()), wxPoint(149,86), wxSize(81,20), wxBU_AUTODRAW ); btnPreferences->SetToolTip(ttPreferences); //spacer w_sp3 = new wxWindow(this,-1,wxPoint(230,91),wxSize(2,11)); i_spacer3 = new ImageLoader(w_sp3); i_spacer3->LoadImage(*(pSkinSimple->GetSpacerImage()->GetBitmap())); // Advanced View wxToolTip *ttAdvView = new wxToolTip(_("Switch to the BOINC advanced view")); btnAdvancedView = new CLinkButton( this, ID_CHANGEGUI, *(pSkinSimple->GetAdvancedLink()->GetBitmap()), wxPoint(233,86), wxSize(101,20), wxBU_AUTODRAW ); btnAdvancedView->SetToolTip(ttAdvView); /// Line lnMyProjBtm = new CTransparentStaticLine(this, wxID_ANY, wxPoint(29,83),wxSize(292,1)); lnMyProjBtm->SetLineColor(pSkinSimple->GetStaticLineColor()); Thaw(); }
void CPanelPreferences::CreateControls() { CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple(); CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced(); wxASSERT(pSkinSimple); wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple)); wxASSERT(pSkinAdvanced); wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced)); CPanelPreferences* itemDialog1 = this; wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); itemDialog1->SetSizer(itemBoxSizer2); wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(1, 1, 0, 0); itemBoxSizer2->Add(itemFlexGridSizer3, 0, wxGROW|wxALL, 5); CTransparentStaticText* itemStaticText4 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("Skin"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticText4->SetFont(wxFont(LARGE_FONT, wxSWISS, wxNORMAL, wxBOLD, false, _T("Arial"))); itemFlexGridSizer3->Add(itemStaticText4, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(itemBoxSizer5, 0, wxALIGN_LEFT|wxLEFT|wxBOTTOM, 20); CTransparentStaticText* itemStaticText6 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("Skin:"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticText6->SetFont(wxFont(TINY_FONT, wxSWISS, wxNORMAL, wxNORMAL, false, _T("Arial"))); itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5); wxString* m_SkinSelectorCtrlStrings = NULL; m_SkinSelectorCtrl = new wxComboBox( itemDialog1, ID_SKINSELECTOR, _T(""), wxDefaultPosition, wxSize(-1, -1), 0, m_SkinSelectorCtrlStrings, wxCB_READONLY ); itemBoxSizer5->Add(m_SkinSelectorCtrl, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5); CTransparentStaticLine* itemStaticLine8 = new CTransparentStaticLine( itemDialog1, wxID_ANY, wxDefaultPosition, wxSize(300, 1), wxLI_HORIZONTAL|wxNO_BORDER ); itemStaticLine8->SetLineColor(pSkinSimple->GetStaticLineColor()); itemBoxSizer2->Add(itemStaticLine8, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, 20); wxFlexGridSizer* itemFlexGridSizer9 = new wxFlexGridSizer(1, 1, 0, 0); itemFlexGridSizer9->AddGrowableCol(0); itemBoxSizer2->Add(itemFlexGridSizer9, 0, wxGROW|wxALL, 5); CTransparentStaticText* itemStaticText10 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("Preferences"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); itemStaticText10->SetFont(wxFont(LARGE_FONT, wxSWISS, wxNORMAL, wxBOLD, false, _T("Arial"))); itemFlexGridSizer9->Add(itemStaticText10, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL); itemBoxSizer2->Add(itemBoxSizer11, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT, 20); wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer11->Add(itemBoxSizer12, 0, wxALIGN_LEFT|wxALL, 0); m_CustomizePreferencesCtrl = new wxCheckBox( itemDialog1, ID_CUSTOMIZEPREFERENCES, wxT(""), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_CustomizePreferencesCtrl->SetValue(false); itemBoxSizer12->Add(m_CustomizePreferencesCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); CTransparentStaticTextAssociate* itemStaticText14 = new CTransparentStaticTextAssociate( itemDialog1, wxID_ANY, _("I want to customize my preferences for this computer only."), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticText14->SetFont(wxFont(SMALL_FONT, wxSWISS, wxNORMAL, wxNORMAL, false, _T("Arial"))); itemStaticText14->AssociateWindow(m_CustomizePreferencesCtrl); itemBoxSizer12->Add(itemStaticText14, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5); CTransparentStaticText* itemStaticText15 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("Customized Preferences"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticText15->SetFont(wxFont(MEDIUM_FONT, wxSWISS, wxNORMAL, wxBOLD, false, _T("Arial"))); itemBoxSizer11->Add(itemStaticText15, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5); wxFlexGridSizer* itemFlexGridSizer15 = new wxFlexGridSizer(7, 2, 0, 0); itemFlexGridSizer15->AddGrowableRow(0); itemFlexGridSizer15->AddGrowableRow(1); itemFlexGridSizer15->AddGrowableRow(2); itemFlexGridSizer15->AddGrowableRow(3); itemFlexGridSizer15->AddGrowableRow(4); itemFlexGridSizer15->AddGrowableRow(5); itemFlexGridSizer15->AddGrowableRow(6); itemFlexGridSizer15->AddGrowableCol(0); itemFlexGridSizer15->AddGrowableCol(1); itemBoxSizer11->Add(itemFlexGridSizer15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0); CTransparentStaticText* itemStaticText16 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("Do work only between:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); itemStaticText16->SetFont(wxFont(SMALL_FONT, wxSWISS, wxNORMAL, wxNORMAL, false, _T("Arial"))); itemStaticText16->Wrap(250); itemFlexGridSizer15->Add(itemStaticText16, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxHORIZONTAL); itemFlexGridSizer15->Add(itemBoxSizer17, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 0); wxString* m_WorkBetweenBeginCtrlStrings = NULL; m_WorkBetweenBeginCtrl = new wxComboBox( itemDialog1, ID_WORKBETWEENBEGIN, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_WorkBetweenBeginCtrlStrings, wxCB_READONLY ); m_WorkBetweenBeginCtrl->Enable(false); itemBoxSizer17->Add(m_WorkBetweenBeginCtrl, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); CTransparentStaticText* itemStaticText19 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("and"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticText19->SetFont(wxFont(SMALL_FONT, wxSWISS, wxNORMAL, wxNORMAL, false, _T("Arial"))); itemBoxSizer17->Add(itemStaticText19, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxString* m_WorkBetweenEndCtrlStrings = NULL; m_WorkBetweenEndCtrl = new wxComboBox( itemDialog1, ID_WORKBETWEENEND, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_WorkBetweenEndCtrlStrings, wxCB_READONLY ); m_WorkBetweenEndCtrl->Enable(false); itemBoxSizer17->Add(m_WorkBetweenEndCtrl, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5); CTransparentStaticText* itemStaticText21 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("Connect to internet only between:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); itemStaticText21->SetFont(wxFont(SMALL_FONT, wxSWISS, wxNORMAL, wxNORMAL, false, _T("Arial"))); itemStaticText21->Wrap(250); itemFlexGridSizer15->Add(itemStaticText21, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxHORIZONTAL); itemFlexGridSizer15->Add(itemBoxSizer22, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 0); wxString* m_ConnectBetweenBeginCtrlStrings = NULL; m_ConnectBetweenBeginCtrl = new wxComboBox( itemDialog1, ID_CONNECTBETWEENBEGIN, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_ConnectBetweenBeginCtrlStrings, wxCB_READONLY ); m_ConnectBetweenBeginCtrl->Enable(false); itemBoxSizer22->Add(m_ConnectBetweenBeginCtrl, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); CTransparentStaticText* itemStaticText24 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("and"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticText24->SetFont(wxFont(SMALL_FONT, wxSWISS, wxNORMAL, wxNORMAL, false, _T("Arial"))); itemBoxSizer22->Add(itemStaticText24, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxString* m_ConnectBetweenEndCtrlStrings = NULL; m_ConnectBetweenEndCtrl = new wxComboBox( itemDialog1, ID_CONNECTBETWEENEND, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_ConnectBetweenEndCtrlStrings, wxCB_READONLY ); m_ConnectBetweenEndCtrl->Enable(false); itemBoxSizer22->Add(m_ConnectBetweenEndCtrl, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5); CTransparentStaticText* itemStaticText26 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("Use no more than:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); itemStaticText26->SetFont(wxFont(SMALL_FONT, wxSWISS, wxNORMAL, wxNORMAL, false, _T("Arial"))); itemStaticText26->Wrap(250); itemFlexGridSizer15->Add(itemStaticText26, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxBoxSizer* itemBoxSizer27 = new wxBoxSizer(wxHORIZONTAL); itemFlexGridSizer15->Add(itemBoxSizer27, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 0); wxString* m_MaxDiskUsageCtrlStrings = NULL; m_MaxDiskUsageCtrl = new wxComboBox( itemDialog1, ID_MAXDISKUSAGE, _T(""), wxDefaultPosition, wxSize(-1, -1), 0, m_MaxDiskUsageCtrlStrings, wxCB_READONLY ); m_MaxDiskUsageCtrl->Enable(false); itemBoxSizer27->Add(m_MaxDiskUsageCtrl, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); CTransparentStaticText* itemStaticText29 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("of disk space"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticText29->SetFont(wxFont(SMALL_FONT, wxSWISS, wxNORMAL, wxNORMAL, false, _T("Arial"))); itemBoxSizer27->Add(itemStaticText29, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); CTransparentStaticText* itemStaticText30 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("Use no more than:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); itemStaticText30->SetFont(wxFont(SMALL_FONT, wxSWISS, wxNORMAL, wxNORMAL, false, _T("Arial"))); itemStaticText30->Wrap(250); itemFlexGridSizer15->Add(itemStaticText30, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxBoxSizer* itemBoxSizer31 = new wxBoxSizer(wxHORIZONTAL); itemFlexGridSizer15->Add(itemBoxSizer31, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 0); wxString* m_MaxCPUUsageCtrlStrings = NULL; m_MaxCPUUsageCtrl = new wxComboBox( itemDialog1, ID_MAXCPUUSAGE, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_MaxCPUUsageCtrlStrings, wxCB_READONLY ); m_MaxCPUUsageCtrl->Enable(false); itemBoxSizer31->Add(m_MaxCPUUsageCtrl, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); CTransparentStaticText* itemStaticText33 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("of the processor"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticText33->SetFont(wxFont(SMALL_FONT, wxSWISS, wxNORMAL, wxNORMAL, false, _T("Arial"))); itemBoxSizer31->Add(itemStaticText33, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); CTransparentStaticText* itemStaticText37 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("Do work while on battery?"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); itemStaticText37->SetFont(wxFont(SMALL_FONT, wxSWISS, wxNORMAL, wxNORMAL, false, _T("Arial"))); itemStaticText37->Wrap(250); itemFlexGridSizer15->Add(itemStaticText37, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxBoxSizer* itemBoxSizer38 = new wxBoxSizer(wxHORIZONTAL); itemFlexGridSizer15->Add(itemBoxSizer38, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 0); m_WorkWhileOnBatteryCtrl = new wxCheckBox( itemDialog1, ID_WORKWHILEONBATTERY, _T(""), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_WorkWhileOnBatteryCtrl->SetValue(false); m_WorkWhileOnBatteryCtrl->Enable(false); itemBoxSizer38->Add(m_WorkWhileOnBatteryCtrl, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); CTransparentStaticText* itemStaticText40 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("Do work after idle for:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); itemStaticText40->SetFont(wxFont(SMALL_FONT, wxSWISS, wxNORMAL, wxNORMAL, false, _T("Arial"))); itemStaticText40->Wrap(250); itemFlexGridSizer15->Add(itemStaticText40, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxBoxSizer* itemBoxSizer41 = new wxBoxSizer(wxHORIZONTAL); itemFlexGridSizer15->Add(itemBoxSizer41, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 0); wxString* m_WorkWhenIdleCtrlStrings = NULL; m_WorkWhenIdleCtrl = new wxComboBox( itemDialog1, ID_WORKWHENIDLE, _T(""), wxDefaultPosition, wxSize(-1, -1), 0, m_WorkWhenIdleCtrlStrings, wxCB_READONLY ); m_WorkWhenIdleCtrl->Enable(false); itemBoxSizer41->Add(m_WorkWhenIdleCtrl, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); CTransparentStaticText* itemStaticText43 = new CTransparentStaticText( itemDialog1, wxID_ANY, _("minutes"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticText43->SetFont(wxFont(SMALL_FONT, wxSWISS, wxNORMAL, wxNORMAL, false, _T("Arial"))); itemBoxSizer41->Add(itemStaticText43, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxBoxSizer* itemBoxSizer44 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(itemBoxSizer44, 0, wxALIGN_RIGHT|wxALL, 5); wxButton* itemButton44 = new wxButton( itemDialog1, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer44->Add(itemButton44, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxButton* itemButton45 = new wxButton( itemDialog1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer44->Add(itemButton45, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); #ifndef __WXMSW__ #ifdef __WXMAC__ wxButton* itemButton46 = new wxButton( this, ID_SIMPLE_HELP, _("Help"), wxDefaultPosition, wxDefaultSize, 0 ); #ifdef wxUSE_TOOLTIPS wxString helpTip; helpTip.Printf(_("Get help with %s"), pSkinAdvanced->GetApplicationShortName().c_str()); itemButton46->SetToolTip(helpTip); #endif #else wxContextHelpButton* itemButton46 = new wxContextHelpButton(this); #endif itemBoxSizer44->Add(itemButton46, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); #endif // Set validators m_SkinSelectorCtrl->SetValidator( wxGenericValidator(& m_strSkinSelector) ); m_CustomizePreferencesCtrl->SetValidator( wxGenericValidator(& m_bCustomizedPreferences) ); m_WorkBetweenBeginCtrl->SetValidator( wxGenericValidator(& m_strWorkBetweenBegin) ); m_WorkBetweenEndCtrl->SetValidator( wxGenericValidator(& m_strWorkBetweenEnd) ); m_ConnectBetweenBeginCtrl->SetValidator( wxGenericValidator(& m_strConnectBetweenBegin) ); m_ConnectBetweenEndCtrl->SetValidator( wxGenericValidator(& m_strConnectBetweenEnd) ); m_MaxDiskUsageCtrl->SetValidator( wxGenericValidator(& m_strMaxDiskUsage) ); m_MaxCPUUsageCtrl->SetValidator( wxGenericValidator(& m_strMaxCPUUsage) ); m_WorkWhileOnBatteryCtrl->SetValidator( wxGenericValidator(& m_bWorkWhileOnBattery) ); m_WorkWhenIdleCtrl->SetValidator( wxGenericValidator(& m_strWorkWhenIdle) ); ////@end CPanelPreferences content construction }