void gcStaticLine::onPaint( wxPaintEvent& event ) { wxPaintDC dc(this); if (!m_imgHR.getImg() || !m_imgHR->IsOk()) { dc.SetTextForeground(wxColor(25,25,25)); dc.Clear(); return; } int h = GetSize().GetHeight(); int w = GetSize().GetWidth(); #ifdef WIN32 // unused AFAIK int ih = m_imgHR->GetSize().GetHeight(); #endif int iw = m_imgHR->GetSize().GetWidth(); wxBitmap tmpBmp(w, h); wxMemoryDC tmpDC(tmpBmp); tmpDC.SetBrush(wxBrush(wxColor(255,0,255))); tmpDC.SetPen( wxPen(wxColor(255,0,255),1) ); tmpDC.DrawRectangle(0,0,w,h); wxImage scaled = m_imgHR->Scale(iw, h); wxBitmap left = GetGCThemeManager()->getSprite(scaled, "horizontal_rule", "Left"); wxBitmap right = GetGCThemeManager()->getSprite(scaled, "horizontal_rule", "Right"); wxBitmap centerImg = GetGCThemeManager()->getSprite(scaled, "horizontal_rule", "Center"); wxBitmap center(w-(left.GetWidth()+right.GetWidth()),h); wxColor c(255,0,255); gcImage::tileImg(center, centerImg, &c); tmpDC.DrawBitmap(left, 0,0,true); tmpDC.DrawBitmap(center, left.GetWidth(),0,true); tmpDC.DrawBitmap(right, w-right.GetWidth(),0,true); tmpDC.SelectObject(wxNullBitmap); dc.DrawBitmap(tmpBmp, 0,0, true); wxRegion region = wxRegion(tmpBmp, wxColor(255,0,255), 1); SetShape(region, this); }
NewBuildTab::NewBuildTab(wxWindow* parent) : wxPanel(parent) , m_warnCount(0) , m_errorCount(0) , m_buildInterrupted(false) , m_autoHide (false) , m_showMe(BuildTabSettingsData::ShowOnStart) , m_skipWarnings(false) , m_buildpaneScrollTo(ScrollToFirstError) , m_buildInProgress(false) { m_curError = m_errorsAndWarningsList.end(); wxBoxSizer* bs = new wxBoxSizer(wxHORIZONTAL); SetSizer(bs); // Determine the row height wxBitmap tmpBmp(1, 1); wxMemoryDC memDc; memDc.SelectObject(tmpBmp); wxFont fnt = DoGetFont(); int xx, yy; memDc.GetTextExtent(wxT("Tp"), &xx, &yy, NULL, NULL, &fnt); int style = wxDV_NO_HEADER|wxDV_MULTIPLE; //style |= wxDV_ROW_LINES; m_listctrl = new wxDataViewListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style); m_listctrl->Connect(wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxContextMenuEventHandler(NewBuildTab::OnMenu), NULL, this); m_listctrl->Connect(XRCID("copy_all"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(NewBuildTab::OnCopy), NULL, this); m_listctrl->Connect(wxID_COPY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(NewBuildTab::OnCopySelection), NULL, this); m_listctrl->Connect(wxID_PASTE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(NewBuildTab::OnOpenInEditor), NULL, this); m_listctrl->Connect(wxID_CLEAR, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(NewBuildTab::OnClear), NULL, this); m_listctrl->Connect(XRCID("copy_all"), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewBuildTab::OnCopyUI), NULL, this); m_listctrl->Connect(wxID_COPY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewBuildTab::OnCopySelectionUI), NULL, this); m_listctrl->Connect(wxID_PASTE, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewBuildTab::OnOpenInEditorUI), NULL, this); m_listctrl->Connect(wxID_CLEAR, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewBuildTab::OnClearUI), NULL, this); // Make sure we have enought height for the icon yy < 12 ? yy = 12 : yy = yy; m_listctrl->SetRowHeight(yy); bs->Add(m_listctrl, 1, wxEXPAND|wxALL); BuildTabTopPanel* toolbox = new BuildTabTopPanel(this); #ifdef __WXMAC__ bs->Add(toolbox, 0, wxEXPAND); #else bs->Insert(0, toolbox, 0, wxEXPAND); #endif int screenWidth = BUILD_PANE_WIDTH;// use a long screen width to allow long lines m_textRenderer = new MyTextRenderer(m_listctrl); m_listctrl->AppendColumn(new wxDataViewColumn(_("Message"), m_textRenderer, 0, screenWidth, wxALIGN_LEFT)); EventNotifier::Get()->Connect ( wxEVT_SHELL_COMMAND_STARTED, clCommandEventHandler ( NewBuildTab::OnBuildStarted ), NULL, this ); EventNotifier::Get()->Connect ( wxEVT_SHELL_COMMAND_STARTED_NOCLEAN, clCommandEventHandler ( NewBuildTab::OnBuildStarted ), NULL, this ); EventNotifier::Get()->Connect ( wxEVT_SHELL_COMMAND_ADDLINE, clCommandEventHandler ( NewBuildTab::OnBuildAddLine ), NULL, this ); EventNotifier::Get()->Connect ( wxEVT_SHELL_COMMAND_PROCESS_ENDED, clCommandEventHandler ( NewBuildTab::OnBuildEnded ), NULL, this ); EventNotifier::Get()->Connect(wxEVT_WORKSPACE_LOADED, wxCommandEventHandler(NewBuildTab::OnWorkspaceLoaded), NULL, this); EventNotifier::Get()->Connect(wxEVT_WORKSPACE_CLOSED, wxCommandEventHandler(NewBuildTab::OnWorkspaceClosed), NULL, this); wxTheApp->Connect(XRCID("next_build_error"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler ( NewBuildTab::OnNextBuildError ), NULL, this ); wxTheApp->Connect(XRCID("next_build_error"), wxEVT_UPDATE_UI, wxUpdateUIEventHandler ( NewBuildTab::OnNextBuildErrorUI ), NULL, this ); m_listctrl->Connect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler(NewBuildTab::OnLineSelected), NULL, this); }
//--------------------------------------------------------------------------- void wxPagedWindow::DrawDecorations( wxDC& dc ) { // FIXME:: the is big body have to be split! int width, height; GetClientSize( &width, &height ); int curX = mHorizGap; int curY = mVertGap; int xSize = width - mHorizGap*2; int ySize = height - mVertGap*2; DrawShadedRect( curX, curY, xSize, ySize, mDarkPen, mWhitePen, dc ); DrawShadedRect( curX+1, curY+1, xSize-2, ySize-2, mBlackPen, mGrayPen, dc ); // draw inactive tab title bars frist (left-to-right) wxObjectList::compatibility_iterator pNode = mTabs.GetFirst(); size_t tabNo = 0; /* OLD STUFF:: curX = mTitleRowStart; curY = height - mVertGap - BORDER_SZ - mTitleHeight; */ curX = mTabTrianGap; curY = 0; // FOR NOW:: avoid creating bitmap with invalid dimensions if ( mTitleRowLen < 1 || mTitleHeight < 1 ) return; wxMemoryDC tmpDc; wxBitmap tmpBmp( mTitleRowLen, mTitleHeight ); tmpDc.SelectObject( tmpBmp ); tmpDc.SetPen( mGrayPen ); tmpDc.SetBrush( mGrayBrush ); tmpDc.DrawRectangle( 0,0, mTitleRowLen, mTitleHeight ); tmpDc.SetDeviceOrigin( mCurentRowOfs, 0 ); while( pNode ) { twTabInfo& tab = *((twTabInfo*)(pNode->GetData())); if ( tabNo != mActiveTab ) DrawPaperBar( tab, curX, curY, mGrayBrush, mBlackPen, tmpDc ); curX += tab.mDims.x; pNode = pNode->GetNext(); ++tabNo; } // finally, draw the active tab (white-filled) pNode = mTabs.GetFirst(); tabNo = 0; curX = mTabTrianGap; while( pNode ) { twTabInfo& tab = *((twTabInfo*)(pNode->GetData())); if ( tabNo == mActiveTab ) { DrawPaperBar( tab, curX, curY, mWhiteBrush, mBlackPen, tmpDc ); tmpDc.SetPen( mWhitePen ); tmpDc.DrawLine( curX - mTabTrianGap+1, curY, curX + tab.mDims.x + mTabTrianGap, curY ); break; } curX += tab.mDims.x; pNode = pNode->GetNext(); ++tabNo; } // back to initial device origin tmpDc.SetDeviceOrigin( 0, 0 ); // draw resize-hint-stick curX = mTitleRowLen - 6; DrawShadedRect( curX+0, 0+0, 6, mTitleHeight, mGrayPen, mBlackPen, tmpDc ); DrawShadedRect( curX+1, 0+1, 6-2, mTitleHeight-2, mWhitePen, mDarkPen, tmpDc ); DrawShadedRect( curX+2, 0+2, 6-4, mTitleHeight-4, mGrayPen, mGrayPen, tmpDc ); dc.Blit( mTitleRowStart, height - mVertGap - BORDER_SZ - mTitleHeight, mTitleRowLen, mTitleHeight, &tmpDc, 0,0, wxCOPY ); } // wxPagedWindow::DrawDecorations()
virtual void doPaint(wxDC* dc) { if (!m_imgHandle.getImg() || !m_imgHandle->IsOk()) { dc->SetTextForeground(wxColor(0,0,0)); dc->Clear(); return; } dc->SetFont(GetFont()); dc->SetTextBackground(GetBackgroundColour()); if (m_bHovering) dc->SetTextForeground(m_colHover); else if (m_bSelected) dc->SetTextForeground(m_colSelected); else dc->SetTextForeground(m_colNormal); int h = GetSize().GetHeight(); int w = GetSize().GetWidth(); int iw = m_imgHandle->GetSize().GetWidth(); wxBitmap tmpBmp(w, h); wxMemoryDC tmpDC(tmpBmp); tmpDC.SetBrush(wxBrush(wxColor(255,0,255))); tmpDC.SetPen( wxPen(wxColor(255,0,255),1) ); tmpDC.DrawRectangle(0,0,w,h); wxImage scaled = m_imgHandle->Scale(iw, h); wxBitmap left; wxBitmap right; wxBitmap centerImg = GetGCThemeManager()->getSprite(scaled, "playlist_button", "fill"); if (m_uiPos == LEFT) { left = GetGCThemeManager()->getSprite(scaled, "playlist_button", "left"); } else { left = GetGCThemeManager()->getSprite(scaled, "playlist_button", "fill"); } if (m_uiPos == RIGHT) { right = GetGCThemeManager()->getSprite(scaled, "playlist_button", "right"); } else { right = GetGCThemeManager()->getSprite(scaled, "playlist_button", "seperator"); } wxBitmap center(w-(left.GetWidth()+right.GetWidth()),h); wxColor c(255,0,255); gcImage::tileImg(center, centerImg, &c); tmpDC.DrawBitmap(left, 0,0,true); tmpDC.DrawBitmap(center, left.GetWidth(),0,true); tmpDC.DrawBitmap(right, w-right.GetWidth(),0,true); tmpDC.SelectObject(wxNullBitmap); dc->DrawBitmap(tmpBmp, 0,0, true); if (m_bTransEnabled) { wxRegion region = wxRegion(tmpBmp, wxColor(255,0,255), 1); SetShape(region, this); } wxString lab = GetLabel(); long x = (w - dc->GetTextExtent(lab).GetWidth())/2; long y = (h - dc->GetTextExtent(lab).GetHeight())/2; dc->DrawText(lab, x, y); }