void wxMotifDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y) { wxCHECK_RET( IsOk(), "invalid dc" ); wxCHECK_RET( icon.IsOk(), "invalid icon" ); DoDrawBitmap(icon, x, y, true); }
void wxGCDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) { wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawIcon - invalid DC") ); wxCHECK_RET( icon.IsOk(), wxT("wxGCDC(cg)::DoDrawIcon - invalid icon") ); wxCoord w = icon.GetWidth(); wxCoord h = icon.GetHeight(); m_graphicContext->DrawIcon( icon , x, y, w, h ); }
void wxTopLevelWindowBase::SetIcon(const wxIcon& icon) { // passing wxNullIcon to SetIcon() is possible (it means that we shouldn't // have any icon), but adding an invalid icon to wxIconBundle is not wxIconBundle icons; if ( icon.IsOk() ) icons.AddIcon(icon); SetIcons(icons); }
void wxFrame::DoSetIcon(const wxIcon& icon) { if (!m_frameShell) return; if (!icon.IsOk() || !icon.GetDrawable()) return; XtVaSetValues((Widget) m_frameShell, XtNiconPixmap, icon.GetDrawable(), NULL); }
int wxGxContentView::GetIconPos(wxIcon icon_small, wxIcon icon_large) { wxCriticalSectionLocker locker(m_CritSect); int pos(0); if(icon_small.IsOk()) { for(size_t i = 0; i < m_IconsArray.size(); ++i) { if(m_IconsArray[i].bLarge) continue; if(m_IconsArray[i].oIcon.IsSameAs(icon_small)) { pos = m_IconsArray[i].iImageIndex; break; } } if(pos == 0) { pos = m_ImageListSmall.Add(icon_small); ICONDATA myicondata = {icon_small, pos, false}; m_IconsArray.push_back(myicondata); wxIcon temp_large_icon(document_48_xpm); if(!icon_large.IsOk()) icon_large = temp_large_icon; pos = m_ImageListLarge.Add(icon_large); ICONDATA myicondata1 = {icon_large, pos, true}; m_IconsArray.push_back(myicondata1); } } else pos = 2;//0 col img, 1 - col img return pos; }
// Operations bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip) { // NB: we have to create the window lazily because of backward compatibility, // old applications may create a wxTaskBarIcon instance before wxApp // is initialized (as samples/taskbar used to do) if (!m_win) { m_win = new wxTaskBarIconWindow(this); } m_icon = icon; m_strTooltip = tooltip; NotifyIconData notifyData(GetHwndOf(m_win)); if (icon.IsOk()) { notifyData.uFlags |= NIF_ICON; notifyData.hIcon = GetHiconOf(icon); } // set NIF_TIP even for an empty tooltip: otherwise it would be impossible // to remove an existing tooltip using this function notifyData.uFlags |= NIF_TIP; if ( !tooltip.empty() ) { wxStrlcpy(notifyData.szTip, tooltip.t_str(), WXSIZEOF(notifyData.szTip)); } bool ok = Shell_NotifyIcon(m_iconAdded ? NIM_MODIFY : NIM_ADD, ¬ifyData) != 0; if ( !ok ) { wxLogLastError(wxT("Shell_NotifyIcon(NIM_MODIFY/ADD)")); } if ( !m_iconAdded && ok ) m_iconAdded = true; return ok; }
void wxTopLevelWindowX11::DoSetIcon(const wxIcon& icon) { if (icon.IsOk() && X11GetMainWindow()) { #if !wxUSE_NANOX XWMHints *wmHints = XAllocWMHints(); wmHints->icon_pixmap = (Pixmap) icon.GetPixmap(); wmHints->flags = IconPixmapHint; if (icon.GetMask()) { wmHints->flags |= IconMaskHint; wmHints->icon_mask = (Pixmap) icon.GetMask()->GetBitmap(); } XSetWMHints(wxGlobalDisplay(), (Window) X11GetMainWindow(), wmHints); XFree(wmHints); #endif } }
wxRichToolTipPopup(wxWindow* parent, const wxString& title, const wxString& message, const wxIcon& icon, wxTipKind tipKind, const wxFont& titleFont_) : m_timer(this) { Create(parent, wxFRAME_SHAPED); wxBoxSizer* const sizerTitle = new wxBoxSizer(wxHORIZONTAL); if ( icon.IsOk() ) { sizerTitle->Add(new wxStaticBitmap(this, wxID_ANY, icon), wxSizerFlags().Centre().Border(wxRIGHT)); } //else: Simply don't show any icon. wxStaticText* const labelTitle = new wxStaticText(this, wxID_ANY, ""); labelTitle->SetLabelText(title); wxFont titleFont(titleFont_); if ( !titleFont.IsOk() ) { // Determine the appropriate title font for the current platform. titleFont = labelTitle->GetFont(); #ifdef __WXMSW__ // When using themes MSW tooltips use larger bluish version of the // normal font. wxUxThemeEngine* const theme = GetTooltipTheme(); if ( theme ) { titleFont.MakeLarger(); COLORREF c; if ( FAILED(theme->GetThemeColor ( wxUxThemeHandle(parent, L"TOOLTIP"), TTP_BALLOONTITLE, 0, TMT_TEXTCOLOR, &c )) ) { // Use the standard value of this colour as fallback. c = 0x993300; } labelTitle->SetForegroundColour(wxRGBToColour(c)); } else #endif // __WXMSW__ { // Everything else, including "classic" MSW look uses just the // bold version of the base font. titleFont.MakeBold(); } } labelTitle->SetFont(titleFont); sizerTitle->Add(labelTitle, wxSizerFlags().Centre()); wxBoxSizer* const sizerTop = new wxBoxSizer(wxVERTICAL); sizerTop->Add(sizerTitle, wxSizerFlags().DoubleBorder(wxLEFT|wxRIGHT|wxTOP)); // Use a spacer as we don't want to have a double border between the // elements, just a simple one will do. sizerTop->AddSpacer(wxSizerFlags::GetDefaultBorder()); wxTextSizerWrapper wrapper(this); wxSizer* sizerText = wrapper.CreateSizer(message, -1 /* No wrapping */); #ifdef __WXMSW__ if ( icon.IsOk() && GetTooltipTheme() ) { // Themed tooltips under MSW align the text with the title, not // with the icon, so use a helper horizontal sizer in this case. wxBoxSizer* const sizerTextIndent = new wxBoxSizer(wxHORIZONTAL); sizerTextIndent->AddSpacer(icon.GetWidth()); sizerTextIndent->Add(sizerText, wxSizerFlags().Border(wxLEFT).Centre()); sizerText = sizerTextIndent; } #endif // !__WXMSW__ sizerTop->Add(sizerText, wxSizerFlags().DoubleBorder(wxLEFT|wxRIGHT|wxBOTTOM) .Centre()); SetSizer(sizerTop); const int offsetY = SetTipShapeAndSize(tipKind, GetBestSize()); if ( offsetY > 0 ) { // Offset our contents by the tip height to make it appear in the // main rectangle. sizerTop->PrependSpacer(offsetY); } Layout(); }
void wxNotificationMessageWindow::SetMessageIcon(const wxIcon& icon) { m_messageBmp->SetBitmap(icon); m_messageBmp->Show(icon.IsOk()); }