void wxStatusBar95::SetStatusStyles(int n, const int styles[]) { wxStatusBarBase::SetStatusStyles(n, styles); if (n != m_nFields) return; for (int i = 0; i < n; i++) { int style; switch(styles[i]) { case wxSB_RAISED: style = SBT_POPOUT; break; case wxSB_FLAT: style = SBT_NOBORDERS; break; case wxSB_NORMAL: default: style = 0; break; } // The SB_SETTEXT message is both used to set the field's text as well as // the fields' styles. MSDN library doesn't mention // that nField and style have to be 'ORed' wxString text = GetStatusText(i); if (!StatusBar_SetText(GetHwnd(), style | i, text)) { wxLogLastError(wxT("StatusBar_SetText")); } } }
void wxStatusBar95::SetStatusText(const wxString& strText, int nField) { wxCHECK_RET( (nField >= 0) && (nField < m_nFields), _T("invalid statusbar field index") ); // Get field style, if any int style; if (m_statusStyles) { switch(m_statusStyles[nField]) { case wxSB_RAISED: style = SBT_POPOUT; break; case wxSB_FLAT: style = SBT_NOBORDERS; break; case wxSB_NORMAL: default: style = 0; break; } } else style = 0; // Pass both field number and style. MSDN library doesn't mention // that nField and style have to be 'ORed' if ( !StatusBar_SetText(GetHwnd(), nField | style, strText) ) { wxLogLastError(wxT("StatusBar_SetText")); } }
void integrate_enter_ui(void) { StatusBar_Idle(); StatusBar_SetText(gdmgr._hwnd_status, 0, utf8_2_ansi(_("Interate text, image..."))); integrate.refresh(gdmgr._hdlg_integrate); return; }
void visual_enter_ui(void) { HWND hctl = GetDlgItem(gdmgr._hdlg_visual, IDC_TV_CFG_EXPLORER); StatusBar_Idle(); strcpy(gdmgr.cfg_fname_, gdmgr._menu_text); StatusBar_SetText(gdmgr._hwnd_status, 0, gdmgr.cfg_fname_); visual.refresh(editor_config::type, hctl); return; }
//***************************************************************************** void CStatusBar::show_message(TCHAR *msg) { StatusBar_SetText(hwndStatusBar, 0, 0, msg) ; }
//***************************************************************************** void CStatusBar::show_message(unsigned idx, TCHAR *msg) { StatusBar_SetText(hwndStatusBar, 0, idx, msg) ; }
void wxStatusBar::DoUpdateStatusText(int nField) { if (!m_pDC) return; // Get field style, if any int style; switch(m_panes[nField].GetStyle()) { case wxSB_RAISED: style = SBT_POPOUT; break; case wxSB_FLAT: style = SBT_NOBORDERS; break; case wxSB_NORMAL: default: style = 0; break; } wxRect rc; GetFieldRect(nField, rc); const int maxWidth = rc.GetWidth() - MSWGetMetrics().textMargin; wxString text = GetStatusText(nField); // do we need to ellipsize this string? wxEllipsizeMode ellmode = (wxEllipsizeMode)-1; if (HasFlag(wxSTB_ELLIPSIZE_START)) ellmode = wxELLIPSIZE_START; else if (HasFlag(wxSTB_ELLIPSIZE_MIDDLE)) ellmode = wxELLIPSIZE_MIDDLE; else if (HasFlag(wxSTB_ELLIPSIZE_END)) ellmode = wxELLIPSIZE_END; if (ellmode == (wxEllipsizeMode)-1) { // if we have the wxSTB_SHOW_TIPS we must set the ellipsized flag even if // we don't ellipsize the text but just truncate it if (HasFlag(wxSTB_SHOW_TIPS)) SetEllipsizedFlag(nField, m_pDC->GetTextExtent(text).GetWidth() > maxWidth); } else { text = wxControl::Ellipsize(text, *m_pDC, ellmode, maxWidth, wxELLIPSIZE_FLAGS_EXPAND_TABS); // update the ellipsization status for this pane; this is used later to // decide whether a tooltip should be shown or not for this pane // (if we have wxSTB_SHOW_TIPS) SetEllipsizedFlag(nField, text != GetStatusText(nField)); } // Set the status text in the native control passing both field number and style. // NOTE: MSDN library doesn't mention that nField and style have to be 'ORed' if ( !StatusBar_SetText(GetHwnd(), nField | style, text.wx_str()) ) { wxLogLastError("StatusBar_SetText"); } #if wxUSE_TOOLTIPS if (HasFlag(wxSTB_SHOW_TIPS)) { wxASSERT(m_tooltips.size() == m_panes.GetCount()); if (m_tooltips[nField]) { if (GetField(nField).IsEllipsized()) { // update the rect of this tooltip: m_tooltips[nField]->SetRect(rc); // update also the text: m_tooltips[nField]->SetTip(GetStatusText(nField)); } else { // delete the tooltip associated with this pane; it's not needed anymore wxDELETE(m_tooltips[nField]); } } else { // create a new tooltip for this pane if needed if (GetField(nField).IsEllipsized()) m_tooltips[nField] = new wxToolTip(this, nField, GetStatusText(nField), rc); //else: leave m_tooltips[nField]==NULL } } #endif // wxUSE_TOOLTIPS }