bool wxSwitcherDialog::Create( const wxSwitcherItems& items, wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint &position, const wxSize& size, long style ) { m_switcherBorderStyle = (style & wxBORDER_MASK); if (m_switcherBorderStyle == wxBORDER_NONE) m_switcherBorderStyle = wxBORDER_SIMPLE; style &= wxBORDER_MASK; style |= wxBORDER_NONE; wxScrollingDialog::Create( parent, id, title, position, size, style ); m_listCtrl = new wxMultiColumnListCtrl(); m_listCtrl->SetItems(items); m_listCtrl->Create(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS|wxNO_BORDER); m_listCtrl->CalculateLayout(); if (m_extraNavigationKey != -1) m_listCtrl->SetExtraNavigationKey(m_extraNavigationKey); if (m_modifierKey != -1) m_listCtrl->SetModifierKey(m_modifierKey); int borderStyle = wxSIMPLE_BORDER; borderStyle = wxBORDER_NONE; m_descriptionCtrl = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 100), borderStyle); m_descriptionCtrl->SetHTMLBackgroundColour(GetBackgroundColour()); #ifdef __WXGTK20__ int fontSize = 11; m_descriptionCtrl->SetStandardFonts(fontSize); #endif wxSizer* sizer = new wxBoxSizer(wxVERTICAL); SetSizer(sizer); sizer->Add(m_listCtrl, 1, wxALL|wxEXPAND, 10); sizer->Add(m_descriptionCtrl, 0, wxALL|wxEXPAND, 10); sizer->SetSizeHints(this); m_listCtrl->SetFocus(); Centre(wxBOTH); if (m_listCtrl->GetItems().GetSelection() == -1) m_listCtrl->GetItems().SetSelection(0); m_listCtrl->AdvanceToNextSelectableItem(1); ShowDescription(m_listCtrl->GetItems().GetSelection()); return true; }
WXHBRUSH wxControl::MSWControlColor(WXHDC pDC, WXHWND hWnd) { wxColour colBg; if ( HasTransparentBackground() ) ::SetBkMode((HDC)pDC, TRANSPARENT); else // if the control is opaque it shouldn't use the parents background colBg = GetBackgroundColour(); return DoMSWControlColor(pDC, colBg, hWnd); }
bool AboutDialog::Create( wxWindow* parent, wxWindowID WXUNUSED(id), const wxString& WXUNUSED(caption), const wxPoint& WXUNUSED(pos), const wxSize& WXUNUSED(size), long WXUNUSED(style) ) { ////@begin AboutDialog member initialisation m_pHtmlWindow = NULL; ////@end AboutDialog member initialisation ////@begin AboutDialog creation SetExtraStyle(wxWS_EX_BLOCK_EVENTS); SetParent(parent); CreateControls(); SetIcon(GetIconResource(wxT("res/nx.png"))); if (GetSizer()) { GetSizer()->SetSizeHints(this); } Centre(); ////@end AboutDialog creation int fs[7]; wxFont fv = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); wxFont ff = wxSystemSettings::GetFont(wxSYS_ANSI_FIXED_FONT); for (int i = 0; i < 7; i++) fs[i] = fv.GetPointSize(); m_pHtmlWindow->SetFonts(fv.GetFaceName(), ff.GetFaceName(), fs); m_pHtmlWindow->SetBorders(0); wxString version = _("Version") + wxString::Format(wxT(" <B>%s</B>"), ::wxGetApp().GetVersion().c_str()); #ifdef __WXDEBUG__ version += wxT(" (DEBUG)"); #else version += wxT(" (RELEASE)"); #endif wxString content = ::wxGetApp().LoadFileFromResource(wxT("res/about.html")); content.Replace(wxT("<VERSION>"), version); content.Replace(wxT("<WXVERSION>"), wxVERSION_STRING); content.Replace(wxT("\"res:"), wxT("\"") + ::wxGetApp().GetResourcePrefix()); m_pHtmlWindow->SetPage(content); m_pHtmlWindow->SetBackgroundColour(GetBackgroundColour()); if (!content.IsEmpty()) { int width, height; m_pHtmlWindow->GetSize(&width, &height); m_pHtmlWindow->GetInternalRepresentation()->Layout(width); height = m_pHtmlWindow->GetInternalRepresentation()->GetHeight(); width = m_pHtmlWindow->GetInternalRepresentation()->GetWidth(); m_pHtmlWindow->SetSize(width, height); m_pHtmlWindow->SetSizeHints(width, height); Fit(); } return TRUE; }
void wxVListBox::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxSize clientSize = GetClientSize(); wxAutoBufferedPaintDC dc(this); // the update rectangle wxRect rectUpdate = GetUpdateClientRect(); // fill it with background colour dc.SetBackground(GetBackgroundColour()); dc.Clear(); // the bounding rectangle of the current line wxRect rectLine; rectLine.width = clientSize.x; // iterate over all visible lines const size_t lineMax = GetVisibleEnd(); for ( size_t line = GetFirstVisibleLine(); line < lineMax; line++ ) { const wxCoord hLine = OnGetLineHeight(line); rectLine.height = hLine; // and draw the ones which intersect the update rect if ( rectLine.Intersects(rectUpdate) ) { // don't allow drawing outside of the lines rectangle wxDCClipper clip(dc, rectLine); wxRect rect = rectLine; OnDrawBackground(dc, rect, line); OnDrawSeparator(dc, rect, line); rect.Deflate(m_ptMargins.x, m_ptMargins.y); OnDrawItem(dc, rect, line); } else // no intersection { if ( rectLine.GetTop() > rectUpdate.GetBottom() ) { // we are already below the update rect, no need to continue // further break; } //else: the next line may intersect the update rect } rectLine.y += hLine; } }
void gcSpinningBar::onPaint(wxPaintEvent& event) { wxPaintDC dc(this); if (GetSize().GetWidth() == 0 || GetSize().GetHeight() == 0) return; dc.SetTextBackground(GetBackgroundColour()); if (m_imgProg.getImg() && m_imgProg->IsOk()) doPaint(&dc); }
void wxShapeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); PrepareDC(dc); dc.SetBackground(wxBrush(GetBackgroundColour(), wxSOLID)); dc.Clear(); if (GetDiagram()) GetDiagram()->Redraw(dc); }
wxBitmap CRemoteTreeView::CreateIcon(int index, const wxString& overlay /*=_T("")*/) { // Create memory DC wxSize s = CThemeProvider::GetIconSize(iconSizeSmall); #ifdef __WXMSW__ wxBitmap bmp(s.x, s.y, 32); #else wxBitmap bmp(s.x, s.y, 24); #endif wxMemoryDC dc; dc.SelectObject(bmp); // Make sure the background is set correctly dc.SetBrush(wxBrush(GetBackgroundColour())); dc.SetPen(wxPen(GetBackgroundColour())); dc.DrawRectangle(0, 0, s.x, s.y); // Draw item from system image list GetSystemImageList()->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT); // Load overlay if (!overlay.empty()) { wxImage unknownIcon = wxArtProvider::GetBitmap(overlay, wxART_OTHER, CThemeProvider::GetIconSize(iconSizeSmall)).ConvertToImage(); // Convert mask into alpha channel if (unknownIcon.IsOk() && !unknownIcon.HasAlpha()) { wxASSERT(unknownIcon.HasMask()); unknownIcon.InitAlpha(); } // Draw overlay dc.DrawBitmap(unknownIcon, 0, 0, true); } dc.SelectObject(wxNullBitmap); return bmp; }
void wxGenericHyperlinkCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); dc.SetFont(GetFont()); dc.SetTextForeground(GetForegroundColour()); dc.SetTextBackground(GetBackgroundColour()); dc.DrawText(GetLabel(), GetLabelRect().GetTopLeft()); if (HasFocus()) { wxRendererNative::Get().DrawFocusRect(this, dc, GetClientRect(), wxCONTROL_SELECTED); } }
void AttentionBar::OnPaint(wxPaintEvent&) { wxPaintDC dc(this); wxRect rect(dc.GetSize()); auto bg = GetBackgroundColour(); dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetPen(bg.ChangeLightness(90)); #ifndef __WXOSX__ dc.DrawLine(rect.GetTopLeft(), rect.GetTopRight()); #endif dc.DrawLine(rect.GetBottomLeft(), rect.GetBottomRight()); }
void MuleGifCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxBufferedPaintDC dc(this); wxSize clientsize = GetClientSize(); wxSize gifsize = m_decoder->GetAnimationSize(); int x = (clientsize.GetWidth()-gifsize.GetWidth())/2; int y = (clientsize.GetHeight()-gifsize.GetHeight())/2; dc.SetBackground(*(wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID))); dc.Clear(); dc.DrawBitmap(m_frame, x, y, true); }
WXHBRUSH wxButton::OnCtlColor( WXHDC WXUNUSED(pDC), WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), WXUINT WXUNUSED(uMessage), WXWPARAM WXUNUSED(wParam), WXLPARAM WXUNUSED(lParam) ) { wxBrush* pBackgroundBrush = wxTheBrushList->FindOrCreateBrush( GetBackgroundColour() ,wxSOLID ); return (WXHBRUSH)pBackgroundBrush->GetResourceHandle(); } // end of wxButton::OnCtlColor
void AISTargetQueryDialog::SetColorScheme( ColorScheme cs ) { DimeControl( this ); wxColor bg = GetBackgroundColour(); m_pQueryTextCtl->SetBackgroundColour( bg ); SetBackgroundColour( bg ); // This looks like non-sense, but is needed for __WXGTK__ // to get colours to propagate down the control's family tree. if( cs != m_colorscheme ) { Refresh(); } m_colorscheme = cs; }
void wxJigsawEditorCanvas::RefreshBuffer() { do { if(!m_DoubleBufferDC.IsOk()) break; m_DoubleBufferDC.SetBackground(wxBrush(GetBackgroundColour())); m_DoubleBufferDC.Clear(); if(!m_View) break; m_DoubleBufferDC.SetFont(GetScaledFont()); m_View->OnDraw(&m_DoubleBufferDC); } while(false); Refresh(); }
void wxBitmapComboLabel::OnPaint( wxPaintEvent &WXUNUSED(event) ) { wxPaintDC dc(this); dc.SetFont(m_bmpCombo->GetFont()); //dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID)); //dc.Clear(); dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID)); dc.SetPen(*wxTRANSPARENT_PEN); dc.DrawRectangle(wxRect(wxPoint(0,0), GetClientSize())); const int sel = m_bmpCombo->GetSelection(); if ((sel >= 0) && (sel < m_bmpCombo->GetCount())) m_bmpCombo->DrawItem(dc, sel); }
/* SToolBarGroup::addActionButton * Adds a toolbar button to the group for [action]. If [icon] is * empty, the action's icon is used *******************************************************************/ SToolBarButton* SToolBarGroup::addActionButton(string action, string icon, bool show_name) { // Get sizer wxSizer* sizer = GetSizer(); // Create button SToolBarButton* button = new SToolBarButton(this, action, icon, show_name); button->SetBackgroundColour(GetBackgroundColour()); // Add it to the group sizer->Add(button, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); return button; }
void NassiDiagramWindow::PaintBackground(wxDC &dc) { wxColour backgroundColour = GetBackgroundColour(); if ( !backgroundColour.Ok()) backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); dc.SetBrush(wxBrush(backgroundColour)); dc.SetPen(wxPen(backgroundColour, 1)); wxRect windowRect(wxPoint(0,0), GetClientSize()); CalcUnscrolledPosition(windowRect.x, windowRect.y, &windowRect.x, &windowRect.y); dc.DrawRectangle(windowRect); dc.SetBrush(wxNullBrush); dc.SetPen(wxNullPen); }
wxUnknownControlContainer(wxWindow *parent, const wxString& controlName, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0) // Always add the wxTAB_TRAVERSAL and wxNO_BORDER styles to what comes // from the XRC if anything. : wxPanel(parent, id, pos, size, style | wxTAB_TRAVERSAL | wxNO_BORDER, controlName + wxT("_container")), m_controlName(controlName), m_controlAdded(false) { m_bg = GetBackgroundColour(); SetBackgroundColour(wxColour(255, 0, 255)); }
void wxlCan::Render( wxDC& dc ) { int w,h; GetVirtualSize( &w, &h ); dc.SetBackground( GetBackgroundColour() ); dc.Clear(); dc.SetBrush(m_backbrush); dc.SetPen( *wxTRANSPARENT_PEN ); dc.DrawRectangle( 0, 0, w, h ); //draw objects m_rootobject.Draw( dc, 0, 0 ); }
void wxAnimationCtrl::ClearToBackgroundColour() { wxSize sz = GetClientSize(); GdkPixbuf *newpix = gdk_pixbuf_new(GDK_COLORSPACE_RGB, false, 8, sz.GetWidth(), sz.GetHeight()); if (!newpix) return; wxColour clr = GetBackgroundColour(); guint32 col = (clr.Red() << 24) | (clr.Green() << 16) | (clr.Blue() << 8); gdk_pixbuf_fill(newpix, col); gtk_image_set_from_pixbuf(GTK_IMAGE(m_widget), newpix); g_object_unref(newpix); }
/* SToolBarGroup::addActionButton * Adds a toolbar button to the group for [action_id]. [action_name], * [icon] and [help_text] can be defined to override the defaults * of the action *******************************************************************/ SToolBarButton* SToolBarGroup::addActionButton(string action_id, string action_name, string icon, string help_text, bool show_name) { // Get sizer wxSizer* sizer = GetSizer(); // Create button SToolBarButton* button = new SToolBarButton(this, action_id, action_name, icon, help_text, show_name); button->SetBackgroundColour(GetBackgroundColour()); Bind(wxEVT_STOOLBAR_BUTTON_CLICKED, &SToolBarGroup::onButtonClicked, this, button->GetId()); // Add it to the group sizer->Add(button, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); return button; }
void onPaint(wxPaintEvent& e) { wxPaintDC dc(this); // Get system colours needed wxColour col_background = GetBackgroundColour();//toolbar_win10 ? *wxWHITE : Drawing::getPanelBGColour(); wxColour col_light = Drawing::lightColour(col_background, 1.5f); wxColour col_dark = Drawing::darkColour(col_background, 1.5f); // Draw lines //dc.SetPen(wxPen(col_dark)); //dc.DrawLine(wxPoint(0, 0), wxPoint(GetSize().x+1, 0)); //dc.SetPen(wxPen(col_light)); //dc.DrawLine(wxPoint(0, 1), wxPoint(GetSize().x+1, 1)); }
tpanelnotebook::tpanelnotebook(mainframe *owner_, wxWindow *parent) : wxAuiNotebook(parent, NOTEBOOK_ID, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_TAB_EXTERNAL_MOVE | wxAUI_NB_CLOSE_ON_ALL_TABS | wxAUI_NB_WINDOWLIST_BUTTON), owner(owner_) { wxColour foreground = GetForegroundColour(); wxColour background = GetBackgroundColour(); unsigned int forecount = foreground.Red() + foreground.Blue() + foreground.Green(); unsigned int backcount = background.Red() + background.Blue() + background.Green(); bool isreverse = forecount > backcount; SetArtProvider(new customTabArt(foreground, background, isreverse)); }
void kwxBitmapButton::OnPaint(wxPaintEvent& event) { wxPaintDC old_dc(this); int w,h; GetClientSize(&w,&h); ///////////////// // Create a memory DC wxMemoryDC dc; dc.SelectObject(*membitmap); dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(),wxSOLID)); dc.Clear(); /////////////////// // se impostato n bitmap lo disegno //if (mDefaultBitmap) if(m_stato == 0) dc.DrawBitmap(*mDefaultBitmap, 0, 0, TRUE); else if(m_stato == 1) dc.DrawBitmap(*mMoveMouseBitmap, 0, 0, TRUE); else if(m_stato == 2) dc.DrawBitmap(*mPressMouseBitmap, 0, 0, TRUE); // Cornice intorno dc.SetPen(*wxThePenList->FindOrCreatePen(*wxRED, 1, wxSOLID)); dc.DrawLine(0, 0, 0, h - 1); dc.DrawLine(0, 0, w, 0); dc.DrawLine(0, h - 1, w, h - 1); dc.DrawLine(w - 1, 0, w - 1, h - 1); // We can now draw into the memory DC... // Copy from this DC to another DC. old_dc.Blit(0, 0, w, h, &dc, 0, 0); }
void kwxBmpSwitcher::OnPaint(wxPaintEvent &WXUNUSED(event)) { wxPaintDC old_dc(this); int w,h; wxBitmap *pCurrent ; m_nCount = m_bmplist.GetCount() ; GetClientSize(&w,&h); ///////////////// // Create a memory DC wxMemoryDC dc; dc.SelectObject(*membitmap); dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(),wxSOLID)); dc.Clear(); double dx = 30.5, dy = 30.5, dr = 29.95; dc.SetPen( *wxBLACK_PEN ); dc.SetBrush( *wxBLACK_BRUSH ); dc.DrawCircle((int)dx, (int)dy, (int)dr); if (m_nCount == 1) { CBmpList::Node *node = m_bmplist.GetFirst(); pCurrent = node->GetData() ; } else { if (m_nState >= m_nCount ) m_nState = 0 ; CBmpList::Node *node = m_bmplist.Item(m_nState); pCurrent = node->GetData(); } if (pCurrent->IsOk()) dc.DrawBitmap(*pCurrent, 0, 0, TRUE); old_dc.Blit(0, 0, w, h, &dc, 0, 0); }
// wxGTK-specific: called recursively by Enable, // to give widgets an oppprtunity to correct their colours after they // have been changed by Enable void wxTextCtrl::OnParentEnable( bool enable ) { // If we have a custom background colour, we use this colour in both // disabled and enabled mode, or we end up with a different colour under the // text. wxColour oldColour = GetBackgroundColour(); if (oldColour.Ok()) { // Need to set twice or it'll optimize the useful stuff out if (oldColour == * wxWHITE) SetBackgroundColour(*wxBLACK); else SetBackgroundColour(*wxWHITE); SetBackgroundColour(oldColour); } }
/// Paint the background void InstanceCtrl::PaintBackground(wxDC& dc) { wxColour backgroundColour = GetBackgroundColour(); if (!backgroundColour.Ok()) backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); // Clear the background dc.SetBrush(wxBrush(backgroundColour)); dc.SetPen(*wxTRANSPARENT_PEN); wxRect windowRect(wxPoint(0, 0), GetClientSize()); // We need to shift the rectangle to take into account // scrolling. Converting device to logical coordinates. CalcUnscrolledPosition(windowRect.x, windowRect.y, & windowRect.x, & windowRect.y); dc.DrawRectangle(windowRect); }
/* SToolBar::addGroup * Adds [group] to the toolbar *******************************************************************/ void SToolBar::addGroup(SToolBarGroup* group) { // Set the group's parent group->SetParent(this); // Set background colour group->SetBackgroundColour(GetBackgroundColour()); // Add it to the list of groups groups.push_back(group); // Update layout updateLayout(true); Bind(wxEVT_STOOLBAR_BUTTON_CLICKED, &SToolBar::onButtonClick, this, group->GetId()); }
void wxPaintBox::OnPaint(wxPaintEvent& WXUNUSED(event)) { SetVirtualSize(m_imageWidth, m_imageHeight); wxPaintDC dc(this); PrepareDC(dc); dc.BeginDrawing(); dc.DrawBitmap(*m_buffer, m_bufferX, m_bufferY); //background dc.SetPen(wxPen(*wxBLACK,0,wxTRANSPARENT)); dc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID)); int w = wxMax(GetClientSize().GetWidth(), m_imageWidth); int h = wxMax(GetClientSize().GetHeight(), m_imageHeight); dc.DrawRectangle(m_imageWidth, 0, w-m_imageWidth, h+50); dc.DrawRectangle(0, m_imageHeight, w, h-m_imageHeight+50); dc.EndDrawing(); }
void wxStaticBitmap::DoPaintManually(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); const wxSize size(GetSize()); const wxBitmap bmp(GetBitmap()); // Clear the background dc.SetBrush(GetBackgroundColour()); dc.SetPen(*wxTRANSPARENT_PEN); dc.DrawRectangle(0, 0, size.GetWidth(), size.GetHeight()); // Draw the image in the middle dc.DrawBitmap(bmp, (size.GetWidth() - bmp.GetWidth()) / 2, (size.GetHeight() - bmp.GetHeight()) / 2, true /* use mask */); }
void AISTargetAlertDialog::UpdateText() { if( GetAlertText() ) { wxColor bg = GetBackgroundColour(); m_pAlertTextCtl->SetBackgroundColour( bg ); wxFont *dFont = FontMgr::Get().GetFont( _("AISTargetQuery"), 12 ); wxString face = dFont->GetFaceName(); int sizes[7]; for( int i = -2; i < 5; i++ ) { sizes[i + 2] = dFont->GetPointSize() + i + ( i > 0 ? i : 0 ); } wxString html; html.Printf( _T("<html><body bgcolor=#%02x%02x%02x><center>"), bg.Red(), bg.Blue(), bg.Green() ); html << m_alert_text; html << _T("</center></font></body></html>"); m_pAlertTextCtl->SetFonts( face, face, sizes ); m_pAlertTextCtl->SetPage( html ); // Try to create a min size that works across font sizes. wxSize sz; if( !IsShown() ) { sz = m_pAlertTextCtl->GetVirtualSize(); sz.x = 300; m_pAlertTextCtl->SetSize( sz ); } m_pAlertTextCtl->Layout(); wxSize ir( m_pAlertTextCtl->GetInternalRepresentation()->GetWidth(), m_pAlertTextCtl->GetInternalRepresentation()->GetHeight() ); sz.x = wxMax( m_pAlertTextCtl->GetSize().x, ir.x ); sz.y = wxMax( m_pAlertTextCtl->GetSize().y, ir.y ); m_pAlertTextCtl->SetMinSize( sz ); Fit(); sz -= wxSize( 200, 200 ); m_pAlertTextCtl->SetMinSize( sz ); } DimeControl( this ); if( !g_bopengl && CanSetTransparent() ) SetTransparent( 192 ); }