Example #1
0
void wxStatusBarMac::SetStatusText(const wxString& text, int number)
{
    // NOTE: seems this function is identic to wxStatusBarGeneric::SetStatusText;
    //       probably can be removed without problems (FM)

    wxCHECK_RET( (number >= 0) && ((size_t)number < m_panes.GetCount()),
        wxT("invalid status bar field index") );

    if ( GetStatusText(number) == text )
        return;

    wxStatusBarGeneric::SetStatusText(text, number);

    wxRect rect;
    GetFieldRect(number, rect);

    int w, h;
    GetSize( &w, &h );

    rect.y = 0;
    rect.height = h ;

    Refresh( true, &rect );
    Update();
}
Example #2
0
void wxStatusBarMac::DrawField(wxDC& dc, int i, int textHeight)
{
    wxRect rect;
    GetFieldRect(i, rect);

    DrawFieldText(dc, rect, i, textHeight);
}
Example #3
0
void wxStatusBarUniv::RefreshField(int i)
{
    wxRect rect;
    if ( GetFieldRect(i, rect) )
    {
        RefreshRect(rect);
    }
}
Example #4
0
void ProgressBar::Resize()
{
	if (GetFieldsCount()<=1) return ;

	wxRect r;
	GetFieldRect(1, r);
	m_progress.SetSize(r);
}
Example #5
0
void wxStatusBarUniv::DoUpdateStatusText(int i)
{
    wxRect rect;
    if ( GetFieldRect(i, rect) )
    {
        RefreshRect(rect);
    }
}
Example #6
0
void StatusBar::OnSize (wxSizeEvent& event)
{
  wxRect gaugeRect;
  GetFieldRect(Field_Gauge, gaugeRect);

  gauge->SetSize(gaugeRect);

  event.Skip();
}
Example #7
0
void HEVCStatusBar::OnSize(wxSizeEvent& event)
{
    if(!m_pZoomSlider)
        return;
    wxRect rect;
    GetFieldRect(Feild_ZoomSlider, rect);
    m_pZoomSlider->SetSize(rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2);
    event.Skip();
}
Example #8
0
void wxStatusBarEx::PositionChild(const struct wxStatusBarEx::t_statbar_child& data)
{
	const wxSize size = data.pChild->GetSize();

	wxRect rect;
	GetFieldRect(data.field, rect);

	data.pChild->SetSize(rect.x + data.cx, rect.GetTop() + (rect.GetHeight() - size.x + 1) / 2, -1, -1);
}
Example #9
0
void
ProgressStatusBar::OnSize(wxSizeEvent& event)
{
    wxRect rect;
    GetFieldRect(FIELD_PROGRESS, rect);
    gauge.SetSize(rect);

    event.Skip();
}
Example #10
0
void wxGISStatusBar::OnSize(wxSizeEvent & event)
{
	wxRect r;
	if( m_pAni && GetFieldRect(m_AniPos, r) )
	{
		r.Deflate(2);
		m_pAni->SetSize(r);
	}

	event.Skip();
}
Example #11
0
HEVCStatusBar::HEVCStatusBar(wxWindow *parent)
            : wxStatusBar(parent, wxID_ANY), m_pZoomSlider(NULL), m_pManager(NULL)
{
    static const int widths[Feild_Max] = { -1, 100, 150 };
    SetFieldsCount(Feild_Max);
    SetStatusWidths(Feild_Max, widths);
    m_pZoomSlider = new wxSlider(this, ZOOMSLIDER_ID, 0, 0, 100);
    wxRect rect;
    GetFieldRect(Feild_ZoomSlider, rect);
    m_pZoomSlider->SetSize(rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2);
}
Example #12
0
	void		On_Size		(wxSizeEvent     &event)
	{
		wxRect	r;

		if( m_pProgressBar && GetFieldRect(STATUSBAR_PROGRESS, r) )
		{
			m_pProgressBar->SetSize(r);
		}

		event.Skip();
	}
Example #13
0
void wxStatusBarGeneric::DrawField(wxDC& dc, int i)
{
    wxRect rect;
    GetFieldRect(i, rect);

    int style = wxSB_NORMAL;
    if (m_statusStyles)
        style = m_statusStyles[i];

    if (style != wxSB_FLAT)
    {
        // Draw border
        // For wxSB_NORMAL:
        // Have grey background, plus 3-d border -
        // One black rectangle.
        // Inside this, left and top sides - dark grey. Bottom and right -
        // white.
        // Reverse it for wxSB_RAISED

        dc.SetPen((style == wxSB_RAISED) ? m_mediumShadowPen : m_hilightPen);

    #ifndef __WXPM__

        // Right and bottom lines
        dc.DrawLine(rect.x + rect.width, rect.y,
                    rect.x + rect.width, rect.y + rect.height);
        dc.DrawLine(rect.x + rect.width, rect.y + rect.height,
                    rect.x, rect.y + rect.height);

        dc.SetPen((style == wxSB_RAISED) ? m_hilightPen : m_mediumShadowPen);

        // Left and top lines
        dc.DrawLine(rect.x, rect.y + rect.height,
               rect.x, rect.y);
        dc.DrawLine(rect.x, rect.y,
            rect.x + rect.width, rect.y);
    #else

        dc.DrawLine(rect.x + rect.width, rect.height + 2,
                    rect.x, rect.height + 2);
        dc.DrawLine(rect.x + rect.width, rect.y,
                    rect.x + rect.width, rect.y + rect.height);

        dc.SetPen((style == wxSB_RAISED) ? m_hilightPen : m_mediumShadowPen);
        dc.DrawLine(rect.x, rect.y,
                    rect.x + rect.width, rect.y);
        dc.DrawLine(rect.x, rect.y + rect.height,
                   rect.x, rect.y);

#endif
    }

    DrawFieldText(dc, i);
}
Example #14
0
void CustomStatusBar::OnSize(wxSizeEvent& event)
{
	if ( !m_gauge ){
		event.Skip();
		return;
	}

	wxRect rect;
	GetFieldRect(4, rect);
	m_gauge->SetSize(rect.x+1, rect.y+1, rect.width-2, rect.height-2);
	event.Skip();
}
Example #15
0
void wxStatusBarGeneric::DoUpdateStatusText(int number)
{
    wxRect rect;
    GetFieldRect(number, rect);

    Refresh(true, &rect);

    // it's common to show some text in the status bar before starting a
    // relatively lengthy operation, ensure that the text is shown to the
    // user immediately and not after the lengthy operation end
    Update();
}
Example #16
0
int CMineField::PtToIndex(CPoint pt)
{
    if (GetFieldRect().PtInRect(pt))
    {
        CPoint real = pt - origin;
        int c = real.x / CBlock::W;
        int r = real.y / CBlock::H;
        return scale.col * r + c;
    }
    else
        return -1;
}
Example #17
0
void PHDStatusBar::OnSize(wxSizeEvent& event)
{
    wxRect fldRect;
    GetFieldRect(0, fldRect);
    int fldWidth = fldRect.GetWidth();
    m_ctrlPanel->SetSize(fldWidth - 1, fldRect.GetHeight());
    m_Msg1->SetPosition(wxPoint(2, 3));
    m_StarIndicators->PositionControls();
    m_GuideIndicators->PositionControls();
    m_StateIndicators->PositionControls();

    event.Skip();
}
Example #18
0
void wxStatusBarMac::SetStatusText(const wxString& text, int number)
{
    wxCHECK_RET( (number >= 0) && (number < m_nFields),
        _T("invalid status bar field index") );
    
    m_statusStrings[number] = text;
    wxRect rect;
    GetFieldRect(number, rect);
    rect.y=0;
    rect.height = m_height ;
    Refresh( TRUE , &rect ) ;
    Update();
}
Example #19
0
void wxStatusBarGeneric::DrawField(wxDC& dc, int i, int textHeight)
{
    wxRect rect;
    GetFieldRect(i, rect);

    if (rect.GetWidth() <= 0)
        return;     // happens when the status bar is shrunk in a very small area!

    int style = m_panes[i].GetStyle();
    if (style != wxSB_FLAT)
    {
        // Draw border
        // For wxSB_NORMAL: paint a grey background, plus 3-d border (one black rectangle)
        // Inside this, left and top sides (dark grey). Bottom and right (white).
        // Reverse it for wxSB_RAISED

        dc.SetPen((style == wxSB_RAISED) ? m_mediumShadowPen : m_hilightPen);

#ifndef __WXPM__

        // Right and bottom lines
        dc.DrawLine(rect.x + rect.width, rect.y,
                    rect.x + rect.width, rect.y + rect.height);
        dc.DrawLine(rect.x + rect.width, rect.y + rect.height,
                    rect.x, rect.y + rect.height);

        dc.SetPen((style == wxSB_RAISED) ? m_hilightPen : m_mediumShadowPen);

        // Left and top lines
        dc.DrawLine(rect.x, rect.y + rect.height,
               rect.x, rect.y);
        dc.DrawLine(rect.x, rect.y,
            rect.x + rect.width, rect.y);
#else

        dc.DrawLine(rect.x + rect.width, rect.height + 2,
                    rect.x, rect.height + 2);
        dc.DrawLine(rect.x + rect.width, rect.y,
                    rect.x + rect.width, rect.y + rect.height);

        dc.SetPen((style == wxSB_RAISED) ? m_hilightPen : m_mediumShadowPen);
        dc.DrawLine(rect.x, rect.y,
                    rect.x + rect.width, rect.y);
        dc.DrawLine(rect.x, rect.y + rect.height,
                    rect.x, rect.y);
#endif
    }

    DrawFieldText(dc, rect, i, textHeight);
}
Example #20
0
void wxStatusBarEx::SetStatusText(const wxString& text, int number /*=0*/)
{
	// Basically identical to the wx one, but not calling Update
	wxString oldText = m_statusStrings[number];
	if (oldText != text)
	{
		m_statusStrings[number] = text;

		wxRect rect;
		GetFieldRect(number, rect);

		Refresh(true, &rect);
	}
}
Example #21
0
void wxStatusBarMac::DoUpdateStatusText(int number)
{
    wxRect rect;
    GetFieldRect(number, rect);

    int w, h;
    GetSize( &w, &h );

    rect.y = 0;
    rect.height = h ;

    Refresh( true, &rect );
    Update();
}
Example #22
0
void wxGISStatusBar::OnSize(wxSizeEvent &event)
{
	wxRect	r;
	if( m_pAni && GetFieldRect(m_AniPos, r) )
	{
		r.Deflate(2);
		m_pAni->SetSize(r);
	}

	//if( m_pProgressBar && GetFieldRect(STATUSBAR_PROGRESS, r) )
	//{
	//	m_pProgressBar->SetSize(r);
	//}
	event.Skip();
}
Example #23
0
void FreqGauge::SetRange(int range, int bar, int gap)
{
   mRange = range;
   mBar = bar;
   mGap = gap;

   GetFieldRect(0, mRect);
   mRect.Inflate(-1);

   mInterval = mRange / (mRect.width / (mBar + mGap));
   mRect.width = mBar;
   mMargin = mRect.x;
   mLast = -1;

   Update();
}
Example #24
0
void wxStatusBarGeneric::SetStatusText(const wxString& text, int number)
{
    wxCHECK_RET( (number >= 0) && (number < m_nFields),
                 _T("invalid status bar field index") );

    wxString oldText = m_statusStrings[number];
    if (oldText != text)
    {
        m_statusStrings[number] = text;

        wxRect rect;
        GetFieldRect(number, rect);

        Refresh( true, &rect );
    }
}
Example #25
0
void wxStatusBarMac::DoUpdateStatusText(int number)
{
    wxRect rect;
    GetFieldRect(number, rect);

    int w, h;
    GetSize( &w, &h );

    rect.y = 0;
    rect.height = h ;

    Refresh( true, &rect );
    // we should have to force the update here
    // TODO Remove if no regressions occur
#if 0
    Update();
#endif
}
Example #26
0
void wxStatusBarGeneric::SetStatusText(const wxString& text, int number)
{
    wxCHECK_RET( (number >= 0) && (number < m_nFields),
                 _T("invalid status bar field index") );

    wxString oldText = m_statusStrings[number];
    if (oldText != text)
    {
        m_statusStrings[number] = text;

        wxRect rect;
        GetFieldRect(number, rect);

        Refresh(true, &rect);

        // it's common to show some text in the status bar before starting a
        // relatively lengthy operation, ensure that the text is shown to the
        // user immediately and not after the lengthy operation end
        Update();
    }
}
Example #27
0
void StatusBar::OnMouseLeftDown(wxMouseEvent& event) {
	UpdateBarFromActiveEditor();
	wxASSERT(m_editorCtrl);

	const int x = event.GetX();
	const int y = event.GetY();
	wxRect syntaxRect;
	wxRect tabsRect;
	wxRect symbolsRect;
	wxRect encodingRect;
	GetFieldRect(1, syntaxRect);
	GetFieldRect(2, tabsRect);
	GetFieldRect(3, symbolsRect);
	GetFieldRect(4, encodingRect);

	if (syntaxRect.Contains(x, y)) {
		PopupSyntaxMenu(syntaxRect);
	}
	else if (tabsRect.Contains(x, y)) {
		// Create the tabs menu
		wxMenu tabsMenu;
		tabsMenu.Append(MENU_TABS_2, _("2"), wxEmptyString, wxITEM_CHECK);
		tabsMenu.Append(MENU_TABS_3, _("3"), wxEmptyString, wxITEM_CHECK);
		tabsMenu.Append(MENU_TABS_4, _("4"), wxEmptyString, wxITEM_CHECK);
		tabsMenu.Append(MENU_TABS_8, _("8"), wxEmptyString, wxITEM_CHECK);
		tabsMenu.Append(MENU_TABS_OTHER, _("Other..."), wxEmptyString, wxITEM_CHECK);
		tabsMenu.AppendSeparator();
		tabsMenu.Append(MENU_TABS_SOFT, _("Soft Tabs (Spaces)"), wxEmptyString, wxITEM_CHECK);

		const unsigned int tabWidth = m_parentFrame.GetTabWidth();
		if (tabWidth == 2) tabsMenu.Check(MENU_TABS_2, true);
		else if (tabWidth == 3) tabsMenu.Check(MENU_TABS_3, true);
		else if (tabWidth == 4) tabsMenu.Check(MENU_TABS_4, true);
		else if (tabWidth == 8) tabsMenu.Check(MENU_TABS_8, true);
		else {
			tabsMenu.SetLabel(MENU_TABS_OTHER, wxString::Format(wxT("Other (%u) ..."), tabWidth));
			tabsMenu.Check(MENU_TABS_OTHER, true);
		}

		if (m_parentFrame.IsSoftTabs()) tabsMenu.Check(MENU_TABS_SOFT, true);

		PopupMenu(&tabsMenu, tabsRect.x, tabsRect.y);
	}
	else if (symbolsRect.Contains(x, y) && m_editorCtrl) {
		wxMenu symbolsMenu;

		if (!m_symbols.empty()) {
			// Create the symbols menu
			unsigned int id = 5000; // menu range 5000-6000
			bool currentSet = false;
			for (std::vector<SymbolRef>::const_iterator p = m_symbols.begin(); p != m_symbols.end(); ++p) {
				const SymbolRef& sr = *p;
				wxString symbolString = m_editorCtrl->GetSymbolString(sr);
				if (symbolString.empty()) symbolString = wxT(" "); // menu name cannot be empty

				symbolsMenu.Append(id, symbolString, wxEmptyString, wxITEM_CHECK);

				// Select current
				if (!currentSet && m_pos < p->start) {
					if (p != m_symbols.begin()) {
						symbolsMenu.Check(id-1, true);
					}
					currentSet = true;
				}

				++id;
			}

			// Current symbol may be the last and therefore not checked above
			if (!currentSet && m_pos >= m_symbols.back().start) {
				symbolsMenu.Check(id-1, true);
			}
		}
		else {
			symbolsMenu.Append(0, _("No Symbols"), wxEmptyString);
			symbolsMenu.Enable(0, false);
		}

		PopupMenu(&symbolsMenu, symbolsRect.x, symbolsRect.y);
	}
	else if (encodingRect.Contains(x, y) && m_editorCtrl) {
		// Create the tabs menu
		wxMenu encMenu;
		m_parentFrame.CreateEncodingMenu(encMenu);
		m_parentFrame.UpdateEncodingMenu(encMenu);

		PopupMenu(&encMenu, encodingRect.x, encodingRect.y);
	}
	else event.Skip();
}
Example #28
0
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
}