本文整理汇总了C++中CSkinSimple类的典型用法代码示例。如果您正苦于以下问题:C++ CSkinSimple类的具体用法?C++ CSkinSimple怎么用?C++ CSkinSimple使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSkinSimple类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxGetApp
void ClientStateIndicator::SetNoActionState(wxString message)
{
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
wxASSERT(pSkinSimple);
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
Freeze();
stateMessage = message;
if ( clientState != CLIENT_STATE_ERROR ) {
//Delete Previous state
DeletePreviousState();
clientState = CLIENT_STATE_ERROR;
i_indBg = new ImageLoader(this);
i_indBg->Move(wxPoint(42,74));
i_indBg->LoadImage(*(pSkinSimple->GetStateIndicatorBackgroundImage()->GetBitmap()));
i_errorInd = new ImageLoader(this);
i_errorInd->Move(wxPoint(rightPosition+24,84));
i_errorInd->LoadImage(*(pSkinSimple->GetErrorIndicatorImage()->GetBitmap()));
i_errorInd->Refresh();
}
Thaw();
}
示例2: WXUNUSED
void CSimpleGUIPanel::OnPaint(wxPaintEvent& WXUNUSED(event)) {
wxPaintDC myDC(this);
if (m_bNewNoticeAlert) {
wxRect r = m_NoticesButton->GetRect();
if (m_bNoticesButtonIsRed) {
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
wxPen oldPen = myDC.GetPen();
wxBrush oldBrush = myDC.GetBrush();
int oldMode = myDC.GetBackgroundMode();
wxPen bgPen(pSkinSimple->GetNoticeAlertColor(), 3);
myDC.SetBackgroundMode(wxSOLID);
myDC.SetPen(bgPen);
myDC.SetBrush(*wxTRANSPARENT_BRUSH);
#ifdef __WXMAC__
r.Inflate(2, 2);
myDC.DrawRoundedRectangle(r.x, r.y, r.width, r.height+1, m_iRedRingRadius);
#elif defined(__WXMSW__)
r.Inflate(3, 3);
myDC.DrawRectangle(r.x, r.y, r.width, r.height);
#else
r.Inflate(3, 3);
myDC.DrawRoundedRectangle(r.x, r.y, r.width, r.height, 6);
#endif
// Restore Mode, Pen and Brush
myDC.SetBackgroundMode(oldMode);
myDC.SetPen(oldPen);
myDC.SetBrush(oldBrush);
}
}
}
示例3: MakeBackgroundBitmap
void CPanelPreferences::OnEraseBackground( wxEraseEvent& event ) {
if (!m_backgroundBitmap) {
MakeBackgroundBitmap();
}
// Create a buffered device context to reduce flicker
wxSize sz = GetClientSize();
wxBufferedDC dc(event.GetDC(), sz, wxBUFFER_CLIENT_AREA);
#if TEST_BACKGROUND_WITH_MAGENTA_FILL
// Fill the dialog with a magenta color so people can detect when something
// is wrong
dc.SetBrush(wxBrush(wxColour(255,0,255)));
dc.SetPen(wxPen(wxColour(255,0,255)));
dc.DrawRectangle(0, 0, sz.GetWidth(), sz.GetHeight());
#else
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
wxASSERT(pSkinSimple);
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
wxColour bgColor(*pSkinSimple->GetDialogBackgroundImage()->GetBackgroundColor());
SetBackgroundColour(bgColor);
#endif
if (m_backgroundBitmap->IsOk()) {
dc.DrawBitmap(*m_backgroundBitmap, 0, 0);
}
}
示例4: wxGetApp
void CProjectsComponent::OnEraseBackground(wxEraseEvent& event){
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
wxASSERT(pSkinSimple);
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
wxDC* dc = event.GetDC();
dc->DrawBitmap(*pSkinSimple->GetProjectAreaBackgroundImage()->GetBitmap(), 0, 0);
}
示例5: wxGetApp
wxBitmap* CSimpleProjectPanel::GetProjectSpecificBitmap(char* project_url) {
char defaultIcnPath[256];
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
wxASSERT(pSkinSimple);
// Only update if it is project specific is found
if(boinc_resolve_filename(GetProjectIconLoc(project_url).c_str(), defaultIcnPath, sizeof(defaultIcnPath)) == 0) {
wxBitmap* projectBM = new wxBitmap();
if ( projectBM->LoadFile(wxString(defaultIcnPath,wxConvUTF8), wxBITMAP_TYPE_ANY) ) {
return projectBM;
}
}
return pSkinSimple->GetProjectImage()->GetBitmap();
}
示例6: wxGetApp
wxBitmap* CSimpleProjectPanel::GetProjectSpecificBitmap(char* project_url) {
char defaultIcnPath[256];
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
wxASSERT(pSkinSimple);
// Only update it if project specific is found
if(boinc_resolve_filename(GetProjectIconLoc(project_url).c_str(), defaultIcnPath, sizeof(defaultIcnPath)) == 0) {
wxBitmap* projectBM;
wxString strIconPath = wxString(defaultIcnPath,wxConvUTF8);
if (wxFile::Exists(strIconPath)) {
#ifdef __WXMSW__
if ((GetXDPIScaling() > 1.05) || (GetYDPIScaling() > 1.05)) {
wxImage img = wxImage(strIconPath, wxBITMAP_TYPE_ANY);
if (img.IsOk()) {
img.Rescale((int) (img.GetWidth()*GetXDPIScaling()),
(int) (img.GetHeight()*GetYDPIScaling()),
wxIMAGE_QUALITY_BILINEAR
);
projectBM = new wxBitmap(img);
if (projectBM->IsOk()) {
return projectBM;
}
}
} else
#endif
{
projectBM = new wxBitmap();
if ( projectBM->LoadFile(strIconPath, wxBITMAP_TYPE_ANY) ) {
return projectBM;
}
}
}
}
return pSkinSimple->GetProjectImage()->GetBitmap();
}
示例7: wxGetApp
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.") );
//.........这里部分代码省略.........
示例8: wxLogTrace
void CSimpleTaskPanel::UpdateTaskSelectionList(bool reskin) {
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleTaskPanel::UpdateTaskSelectionList - Function Begin"));
int i, j, count, newIcon;
TaskSelectionData *selData;
RESULT* result;
RESULT* ctrlResult;
PROJECT* project;
std::vector<bool>is_alive;
bool needRefresh = false;
wxString resname;
CMainDocument* pDoc = wxGetApp().GetDocument();
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
static bool bAlreadyRunning = false;
wxASSERT(pDoc);
wxASSERT(pSkinSimple);
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
if (bAlreadyRunning) {
return;
}
bAlreadyRunning = true;
count = m_TaskSelectionCtrl->GetCount();
// Mark all inactive (this lets us loop only once)
for (i=0; i<count; ++i) {
is_alive.push_back(false);
}
// First update existing entries and add new ones
for(i = 0; i < (int) pDoc->results.results.size(); i++) {
bool found = false;
result = pDoc->result(i);
// only check tasks that are active
if ( result == NULL || !result->active_task ) {
continue;
}
resname = wxEmptyString;
#if SELECTBYRESULTNAME
resname = wxString::FromUTF8(result->name);
#else // SELECTBYRESULTNAME
GetApplicationAndProjectNames(result, &resname, NULL);
#endif // SELECTBYRESULTNAME
// loop through the items already in Task Selection Control to find this result
count = m_TaskSelectionCtrl->GetCount();
for(j = 0; j < count; ++j) {
selData = (TaskSelectionData*)m_TaskSelectionCtrl->GetClientData(j);
if (!strcmp(result->name, selData->result_name) &&
!strcmp(result->project_url, selData->project_url)
) {
selData->result = result;
found = true;
is_alive.at(j) = true;
break; // skip out of this loop
}
}
// if it isn't currently in the list then we have a new one! lets add it
if (!found) {
int alphaOrder;
for(j = 0; j < count; ++j) {
alphaOrder = (m_TaskSelectionCtrl->GetString(j)).CmpNoCase(resname);
#if SORTTASKLIST
if (alphaOrder > 0) {
break; // Insert the new item here (sorted by item label)
}
#endif
// wxComboBox and wxBitmapComboBox have bugs on Windows when multiple
// entries have identical text, so add enough spaces to make each
// entry's text unique.
if (alphaOrder == 0) {
resname.Append((const wxChar *)wxT(" "));
#if !SORTTASKLIST
j = -1; // If not sorted, check new name from start for duplicate
#endif
}
}
selData = new TaskSelectionData;
selData->result = result;
strncpy(selData->result_name, result->name, sizeof(selData->result_name));
strncpy(selData->project_url, result->project_url, sizeof(selData->project_url));
selData->dotColor = -1;
FindSlideShowFiles(selData);
project = pDoc->state.lookup_project(result->project_url);
if (project) {
selData->project_files_downloaded_time = project->project_files_downloaded_time;
} else {
selData->project_files_downloaded_time = 0.0;
}
#if SORTTASKLIST
if (j < count) {
std::vector<bool>::iterator iter = is_alive.begin();
m_TaskSelectionCtrl->Insert(resname, wxNullBitmap, j, (void*)selData);
is_alive.insert(iter+j, true);
//.........这里部分代码省略.........
示例9: GetRect
void CSlideShowPanel::AdvanceSlideShow(bool changeSlide, bool reload) {
double xRatio, yRatio, ratio;
unsigned int i;
wxString s;
TaskSelectionData* selData = ((CSimpleTaskPanel*)GetParent())->GetTaskSelectionData();
if (selData == NULL) return;
if (reload) {
m_bCurrentSlideIsDefault = false;
selData->lastSlideShown = -1;
}
int numSlides = (int)selData->slideShowFileNames.size();
#if TESTALLDESCRIPTIONS // For testing
numSlides = 0;
#endif
if (numSlides <= 0) {
#if HIDEDEFAULTSLIDE
if (!reload) {
return;
}
wxRect r = GetRect();
wxBitmap backgroundBitmap = ((CSimpleTaskPanel*)GetParent())->GetBackgroundBmp().GetSubBitmap(r);
wxWindowDC dc(this);
dc.DrawBitmap(backgroundBitmap, 0, 0);
// Force redraws if text unchanged; hide all if not in all-projects list
m_institution->Show(false);
m_scienceArea->Show(false);
m_description->Show(false);
Enable( false );
if (!m_bGotAllProjectsList) {
CMainDocument* pDoc = wxGetApp().GetDocument();
wxASSERT(pDoc);
pDoc->rpc.get_all_projects_list(m_AllProjectsList);
m_bGotAllProjectsList = true;
}
for (i=0; i<m_AllProjectsList.projects.size(); i++) {
if (!strcmp(m_AllProjectsList.projects[i]->url.c_str(), selData->project_url)) {
s = wxString(m_AllProjectsList.projects[i]->home.c_str(), wxConvUTF8);
m_institution->SetLabel(wxGetTranslation(s));
s = wxString(m_AllProjectsList.projects[i]->specific_area.c_str(), wxConvUTF8);
m_scienceArea->SetLabel(wxGetTranslation(s));
s = wxString(m_AllProjectsList.projects[i]->description.c_str(), wxConvUTF8);
m_description->SetValue(wxGetTranslation(s));
m_institution->Show(true);
m_scienceArea->Show(true);
m_description->Show(true);
Enable( true );
m_description->Enable();
this->Layout();
break;
}
}
return;
#else // HIDEDEFAULTSLIDE
SetBackgroundColour(*wxBLACK);
if (m_bCurrentSlideIsDefault) return;
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
wxASSERT(pSkinSimple);
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
m_SlideBitmap = *pSkinSimple->GetWorkunitAnimationImage()->GetBitmap();
if (m_SlideBitmap.Ok()) {
m_bCurrentSlideIsDefault = true;
}
#endif // HIDEDEFAULTSLIDE
} else {
#if HIDEDEFAULTSLIDE
m_institution->Show(false);
m_scienceArea->Show(false);
m_description->Show(false);
Enable( false );
#endif // HIDEDEFAULTSLIDE
// TODO: Should we allow slide show to advance if task is not running?
int newSlide = selData->lastSlideShown;
if (selData->dotColor == runningIcon) { // Advance only if running
if (changeSlide) {
if (++newSlide >= numSlides) {
newSlide = 0;
}
}
}
if (newSlide < 0) {
newSlide = 0;
}
if (selData->lastSlideShown != newSlide) { // Don't update if only one slide
selData->lastSlideShown = newSlide;
wxBitmap *bm = new wxBitmap();
//.........这里部分代码省略.........
示例10: CSimplePanelBase
CSimpleProjectPanel::CSimpleProjectPanel( wxWindow* parent ) :
CSimplePanelBase( parent )
{
wxSize sz;
wxString str = wxEmptyString;
wxWindowDC dc(this);
m_UsingAccountManager = -1; // Force action the first time
m_CurrentSelectedProjectURL[0] = '\0';
m_sAddProjectString = _("Add Project");
m_sSynchronizeString = _("Synchronize");
m_sTotalWorkDoneString = _("Work done for this project");
m_sAddProjectToolTip = _("Volunteer for any or all of 30+ projects in many areas of science");
m_sSynchronizeToolTip = _("Synchronize projects with account manager system");
m_GotBGBitMap = false; // Can't be made until parent has been laid out.
SetForegroundColour(*wxBLACK);
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxHORIZONTAL );
bSizer1->AddSpacer(ADJUSTFORYDPI(5));
m_myProjectsLabel = new CTransparentStaticText( this, wxID_ANY, _("Projects:"), wxDefaultPosition, wxDefaultSize, 0 );
m_myProjectsLabel->Wrap( -1 );
bSizer2->Add( m_myProjectsLabel, 0, wxRIGHT, ADJUSTFORXDPI(5) );
bSizer2->AddStretchSpacer();
int addProjectWidth, synchronizeWidth, y;
GetTextExtent(m_sAddProjectString, &addProjectWidth, &y);
GetTextExtent(m_sSynchronizeString, &synchronizeWidth, &y);
m_TaskAddProjectButton = new CTransparentButton( this, ID_ADDROJECTBUTTON,
(addProjectWidth > synchronizeWidth) ? m_sAddProjectString : m_sSynchronizeString,
wxDefaultPosition, wxDefaultSize, 0
);
bSizer2->Add( m_TaskAddProjectButton, 0, wxRIGHT | wxEXPAND | wxALIGN_RIGHT, SIDEMARGINS );
bSizer1->Add( bSizer2, 0, wxEXPAND | wxTOP | wxLEFT, ADJUSTFORXDPI(10) );
#ifndef __WXMAC__
bSizer1->AddSpacer(ADJUSTFORYDPI(5));
#endif
#if TESTBIGICONPOPUP
m_ProjectSelectionCtrl = new CBOINCBitmapComboBox( this, ID_SGPROJECTSELECTOR, wxT(""), wxDefaultPosition, wxSize(-1, 42), 4, tempArray, wxCB_READONLY );
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
bmArray[0] = *pSkinSimple->GetProjectImage()->GetBitmap();
m_ProjectSelectionCtrl->SetItemBitmap(0, bmArray[0]);
bmArray[1] = wxBitmap((const char**)sah_40_xpm);
m_ProjectSelectionCtrl->SetItemBitmap(1, bmArray[1]);
bmArray[2] = wxBitmap((const char**)einstein_icon_xpm);
m_ProjectSelectionCtrl->SetItemBitmap(3, bmArray[2]);
// m_ProjectSelectionCtrl->SetStringSelection(tempArray[1]);
m_ProjectSelectionCtrl->SetSelection(1);
#else
m_ProjectSelectionCtrl = new CBOINCBitmapComboBox( this, ID_SGPROJECTSELECTOR, wxT(""), wxDefaultPosition, wxSize(-1, 42), 0, NULL, wxCB_READONLY);
#endif
// TODO: Might want better wording for Project Selection Combo Box tooltip
str = _("Select a project to access with the controls below");
m_ProjectSelectionCtrl->SetToolTip(str);
bSizer1->Add( m_ProjectSelectionCtrl, 0, wxLEFT | wxRIGHT | wxEXPAND, SIDEMARGINS );
#ifndef __WXMAC__
bSizer1->AddSpacer(ADJUSTFORYDPI(8));
#endif
// Make sure m_TotalCreditValue string is large enough
m_fDisplayedCredit = 9999999999.99;
str.Printf(wxT("%s: %.0f"), m_sTotalWorkDoneString.c_str(), m_fDisplayedCredit);
m_TotalCreditValue = new CTransparentStaticText( this, wxID_ANY, str, wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE );
m_TotalCreditValue->Wrap( -1 );
bSizer1->Add( m_TotalCreditValue, 0, wxLEFT | wxRIGHT | wxEXPAND, SIDEMARGINS );
bSizer1->AddSpacer(ADJUSTFORYDPI(5));
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxHORIZONTAL );
m_ProjectWebSitesButton = new CSimpleProjectWebSitesPopupButton( this, ID_PROJECTWEBSITESBUTTON, _("Project Web Pages"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3->Add( m_ProjectWebSitesButton, 0, wxEXPAND | wxALIGN_LEFT, 0 );
bSizer3->AddStretchSpacer();
m_ProjectCommandsButton = new CSimpleProjectCommandPopupButton( this, ID_PROJECTCOMMANDBUTTON, _("Project Commands"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3->Add( m_ProjectCommandsButton, 0, wxEXPAND | wxALIGN_RIGHT, 0 );
bSizer1->Add( bSizer3, 0, wxLEFT | wxRIGHT | wxEXPAND, SIDEMARGINS );
bSizer1->AddSpacer(ADJUSTFORYDPI(10));
// Temporarily insert a dummy entry so sizer can
// get correct height of m_ProjectSelectionCtrl
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
wxBitmap* defaultBM = pSkinSimple->GetProjectImage()->GetBitmap();
m_ProjectSelectionCtrl->Insert("", *defaultBM, 0, (void*)NULL);
//.........这里部分代码省略.........
示例11: Freeze
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);
//
//.........这里部分代码省略.........
示例12: wxGetApp
void CPanelMessages::CreateControls()
{
CPanelMessages* itemDialog1 = this;
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
wxASSERT(pSkinSimple);
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
wxFlexGridSizer* itemFlexGridSizer2 = new wxFlexGridSizer(2, 1, 0, 0);
itemFlexGridSizer2->AddGrowableRow(0);
itemFlexGridSizer2->AddGrowableCol(0);
itemDialog1->SetSizer(itemFlexGridSizer2);
m_pList = new CSGUIListCtrl(this, ID_SIMPLE_MESSAGESVIEW, DEFAULT_LIST_MULTI_SEL_FLAGS);
itemFlexGridSizer2->Add(m_pList, 0, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
#ifdef __WXMAC__ // Don't let Close button overlap window's grow icon
itemFlexGridSizer2->Add(itemBoxSizer4, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 12);
#else
itemFlexGridSizer2->Add(itemBoxSizer4, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
#endif
#ifdef wxUSE_CLIPBOARD
wxBitmapButton* itemButton1 = new wxBitmapButton(
this,
ID_COPYAll,
*pSkinSimple->GetCopyAllButton()->GetBitmap(),
wxDefaultPosition,
wxSize(
(*pSkinSimple->GetCopyAllButton()->GetBitmap()).GetWidth(),
(*pSkinSimple->GetCopyAllButton()->GetBitmap()).GetHeight()
),
wxBU_AUTODRAW
);
if ( pSkinSimple->GetCopyAllButton()->GetBitmapClicked() != NULL ) {
itemButton1->SetBitmapSelected(*pSkinSimple->GetCopyAllButton()->GetBitmapClicked());
}
itemButton1->SetHelpText(
_("Copy all the messages to the clipboard.")
);
#if wxUSE_TOOLTIPS
itemButton1->SetToolTip(
_("Copy all the messages to the clipboard.")
);
#endif
itemBoxSizer4->Add(itemButton1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBitmapButton* itemButton2 = new wxBitmapButton(
this,
ID_COPYSELECTED,
*pSkinSimple->GetCopyButton()->GetBitmap(),
wxDefaultPosition,
wxSize(
(*pSkinSimple->GetCopyButton()->GetBitmap()).GetWidth(),
(*pSkinSimple->GetCopyButton()->GetBitmap()).GetHeight()
),
wxBU_AUTODRAW
);
if ( pSkinSimple->GetCopyButton()->GetBitmapClicked() != NULL ) {
itemButton2->SetBitmapSelected(*pSkinSimple->GetCopyButton()->GetBitmapClicked());
}
itemButton2->SetHelpText(
#ifdef __WXMAC__
_("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or command key while clicking on messages.")
#else
_("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or control key while clicking on messages.")
#endif
);
#if wxUSE_TOOLTIPS
itemButton2->SetToolTip(
#ifdef __WXMAC__
_("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or command key while clicking on messages.")
#else
_("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or control key while clicking on messages.")
#endif
);
#endif
itemBoxSizer4->Add(itemButton2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
#endif
wxBitmapButton* itemBitmapButton44 = new wxBitmapButton(
this,
wxID_OK,
*pSkinSimple->GetCloseButton()->GetBitmap(),
wxDefaultPosition,
wxSize(
(*pSkinSimple->GetCloseButton()->GetBitmap()).GetWidth(),
(*pSkinSimple->GetCloseButton()->GetBitmap()).GetHeight()
),
wxBU_AUTODRAW
);
if ( pSkinSimple->GetCloseButton()->GetBitmapClicked() != NULL ) {
itemBitmapButton44->SetBitmapSelected(*pSkinSimple->GetCloseButton()->GetBitmapClicked());
}
itemBoxSizer4->Add(itemBitmapButton44, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
#ifndef __WXMSW__
#ifdef __WXMAC__
//.........这里部分代码省略.........
示例13: bgPen
// Create a background bitmap simulating partial transparency
void CSimplePanelBase::MakeBGBitMap() {
wxRect r;
wxBitmap rawBmp;
wxBitmap whiteBmp;
wxImage bgImage;
wxImage whiteImage;
register unsigned char *bgImagePixels;
register unsigned char *whitePixels;
register int i, j, k;
CSimpleGUIPanel* backgroundPanel = (CSimpleGUIPanel*)GetParent();
wxPen bgPen(*wxWHITE, 1, wxTRANSPARENT);
wxBrush bgBrush(*wxWHITE);
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
wxASSERT(pSkinSimple);
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
int white_weight = pSkinSimple->GetPanelOpacity();
int image_weight = MAX_OPACITY - white_weight;
// Workaround for CSimpleGUIPanel not reliably getting
// Paint or EraseBackground events under Linux
#if (!(defined(__WXMSW_) || defined(__WXMAC__)))
backgroundPanel->SetBackgroundBitmap();
#endif
GetPosition(&r.x, &r.y);
GetSize(&r.width, &r.height);
wxBitmap *bgBmp(backgroundPanel->GetBackgroundBitMap());
wxRect bgRect(0, 0, bgBmp->GetWidth(), bgBmp->GetHeight());
if (bgRect.Contains(r)) {
rawBmp = bgBmp->GetSubBitmap(r);
} else {
fprintf(stderr, "SimpleGUI background image is too small\n");
rawBmp = wxBitmap(r.width, r.height);
wxMemoryDC dc(rawBmp);
wxPen rawPen(*wxBLACK, 1, wxTRANSPARENT);
wxBrush rawBrush(*wxBLACK);
dc.SetBackgroundMode(wxSOLID);
dc.SetPen(rawPen);
dc.SetBrush(rawBrush);
dc.DrawRectangle(0, 0, r.width, r.height);
}
whiteBmp = wxBitmap(r.width, r.height);
wxMemoryDC dc(whiteBmp);
dc.SetBackgroundMode(wxSOLID);
dc.SetPen(bgPen);
dc.SetBrush(bgBrush);
dc.DrawRoundedRectangle(0, 0, r.width, r.height, RECTANGLERADIUS);
bgImage = rawBmp.ConvertToImage();
bgImagePixels = bgImage.GetData(); // RGBRGBRGB...
whiteImage = whiteBmp.ConvertToImage();
whitePixels = whiteImage.GetData(); // RGBRGBRGB...
for (i=0; i<r.width; ++i) {
for (j=0; j<r.height; ++j) {
if (*whitePixels) {
k = (((unsigned int)*bgImagePixels * image_weight) + ((unsigned int)*whitePixels++ * white_weight));
*bgImagePixels++ = k / MAX_OPACITY;
k = (((unsigned int)*bgImagePixels * image_weight) + ((unsigned int)*whitePixels++ * white_weight));
*bgImagePixels++ = k / MAX_OPACITY;
k = (((unsigned int)*bgImagePixels * image_weight) + ((unsigned int)*whitePixels++ * white_weight));
*bgImagePixels++ = k / MAX_OPACITY;
} else {
bgImagePixels += 3;
whitePixels += 3;
}
}
}
m_TaskPanelBGBitMap = wxBitmap(bgImage);
m_GotBGBitMap = true;
}
示例14: wxLogTrace
void CSimpleGUIPanel::SetBackgroundBitmap() {
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::SetBackgroundBitmap - Function Start"));
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
wxASSERT(pSkinSimple);
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
wxColour bgColor(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
SetBackgroundColour(bgColor);
wxRect panelRect = GetRect();
m_bmpBg = wxBitmap(panelRect.width, panelRect.height);
wxMemoryDC dc(m_bmpBg);
wxBrush bgBrush(bgColor);
dc.SetBackground(bgBrush);
dc.Clear();
#ifdef __WXMAC__
// Work around an apparent bug in wxMemoryDC::Clear() in wxCarbon 2.9.4
// TODO: remove this when the wxCarbon bug is fixed
dc.SetBrush(bgBrush);
wxPen bgPen(bgColor);
dc.SetPen(bgPen);
dc.DrawRectangle(panelRect);
#endif
int srcX, srcY, destX, destY, h, w;
wxBitmap* srcBmp = pSkinSimple->GetBackgroundImage()->GetBitmap();
wxSize srcSize = srcBmp->GetSize();
switch(pSkinSimple->GetBackgroundImage()->GetHorizontalAnchor()) {
case BKGD_ANCHOR_HORIZ_LEFT:
default:
srcX = 0;
destX = 0;
break;
case BKGD_ANCHOR_HORIZ_CENTER:
if (panelRect.width < srcSize.GetWidth()) {
srcX = (srcSize.GetWidth() - panelRect.width) / 2;
destX = 0;
} else {
srcX = 0;
destX = (panelRect.width - srcSize.GetWidth()) / 2;
}
break;
case BKGD_ANCHOR_HORIZ_RIGHT:
if (panelRect.width < srcSize.GetWidth()) {
srcX = (srcSize.GetWidth() - panelRect.width);
destX = 0;
} else {
srcX = 0;
destX = (panelRect.width - srcSize.GetWidth());
}
break;
}
w = wxMin(panelRect.width, srcSize.GetWidth());
switch(pSkinSimple->GetBackgroundImage()->GetVerticalAnchor()) {
case BKGD_ANCHOR_VERT_TOP:
default:
srcY = 0;
destY = 0;
break;
case BKGD_ANCHOR_VERT_CENTER:
if (panelRect.height < srcSize.GetHeight()) {
srcY = (srcSize.GetHeight() - panelRect.height) / 2;
destY = 0;
} else {
srcY = 0;
destY = (panelRect.height - srcSize.GetHeight()) / 2;
}
break;
case BKGD_ANCHOR_VERT_BOTTOM:
if (panelRect.height < srcSize.GetHeight()) {
srcY = (srcSize.GetHeight() - panelRect.height);
destY = 0;
} else {
srcY = 0;
destY = (panelRect.height - srcSize.GetHeight());
}
break;
}
h = wxMin(panelRect.height, srcSize.GetHeight());
wxMemoryDC srcDC(*srcBmp);
dc.Blit(destX, destY, w, h, &srcDC, srcX, srcY, wxCOPY);
// dc.DrawBitmap(*pSkinSimple->GetBackgroundImage()->GetBitmap(), 0, 0, false);
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::SetBackgroundBitmap - Function End"));
}
示例15: wxGetApp
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);
//.........这里部分代码省略.........