Beispiel #1
0
void wxExStatusBar::SetFields(const std::vector<wxExStatusBarPane>& fields)
{
  m_Panes = fields;
    
  int* styles = new int[fields.size()];
  int* widths = new int[fields.size()];

  for (int i = 0; i < fields.size(); i++)
  {
    styles[i] = fields[i].GetStyle();
    widths[i] = fields[i].GetWidth();
  }
  
  SetFieldsCount(fields.size(), widths);
  SetStatusStyles(fields.size(), styles);

  delete[] styles;
  delete[] widths;

  Bind(
    wxEVT_MOTION,
    &wxExStatusBar::OnMouse,
    this,
    wxID_ANY);
}
Beispiel #2
0
wxGISStatusBar::wxGISStatusBar(wxWindow *parent, wxWindowID id, long style, const wxString& name, WXDWORD panelsstyle) : wxStatusBar(parent, id, style, name), m_timer(this, TIMER_ID), m_pAni(NULL), m_pProgressBar(NULL)
{
    m_MsgPos = wxNOT_FOUND;
    m_AniPos = wxNOT_FOUND;
    m_ProgressPos = wxNOT_FOUND;
    m_PositionPos = wxNOT_FOUND;
    m_ClockPos = wxNOT_FOUND;
    m_PagePositionPos = wxNOT_FOUND;
    m_SizePos = wxNOT_FOUND;
    m_CapsLockPos = wxNOT_FOUND;
    m_NumLockPos = wxNOT_FOUND;
    m_ScrollLockPos = wxNOT_FOUND;
    m_Panels = panelsstyle;

    m_pApp = dynamic_cast<wxGISApplicationBase*>(parent);

    std::vector<STATUSPANEL> panels;
    int counter(0);
    if(panelsstyle & enumGISStatusMain)
    {
        STATUSPANEL data = {wxNOT_FOUND, wxSB_FLAT};
        panels.push_back(data);
        m_MsgPos = counter;
        counter++;
    }
    if(panelsstyle & enumGISStatusProgress)
    {
        STATUSPANEL data = {100, wxSB_FLAT};//wxSB_NORMAL
        panels.push_back(data);
        m_pProgressBar = new wxGISProgressor(this, wxID_ANY);
        m_pProgressBar->Hide();
        m_ProgressPos = counter;
        counter++;
    }
    if(panelsstyle & enumGISStatusAnimation)
    {
        STATUSPANEL data = {23, wxSB_NORMAL};
        panels.push_back(data);
        //bitmap
        m_pAni = new wxGISAnimation(this, wxID_ANY, wxBitmap(globe_imglst14_xpm),14);
        m_pAni->Hide();
        m_AniPos = counter;
        counter++;
    }
    if(panelsstyle & enumGISStatusPosition)
    {
#ifdef __WXGTK__
        STATUSPANEL data = {225, wxSB_NORMAL};
#else
        STATUSPANEL data = {200, wxSB_NORMAL};
#endif
        panels.push_back(data);
        m_PositionPos = counter;
        counter++;
    }
    if(panelsstyle & enumGISStatusPagePosition)
    {
        STATUSPANEL data = {100, wxSB_NORMAL};
        panels.push_back(data);
        m_PagePositionPos = counter;
        counter++;
    }
    if(panelsstyle & enumGISStatusSize)
    {
        STATUSPANEL data = {80, wxSB_NORMAL};
        panels.push_back(data);
        m_SizePos = counter;
        counter++;
    }
    if(panelsstyle & enumGISStatusCapsLock)
    {
        STATUSPANEL data = {40, wxSB_NORMAL};
        panels.push_back(data);
        m_CapsLockPos = counter;
        counter++;
    }
    if(panelsstyle & enumGISStatusNumLock)
    {
        STATUSPANEL data = {40, wxSB_NORMAL};
        panels.push_back(data);
        m_NumLockPos = counter;
        counter++;
    }
    if(panelsstyle & enumGISStatusScrollLock)
    {
        STATUSPANEL data = {40, wxSB_NORMAL};
        panels.push_back(data);
        m_ScrollLockPos = counter;
        counter++;
    }
    if(panelsstyle & enumGISStatusClock)
    {
#ifdef __WXGTK__
        STATUSPANEL data = {64, wxSB_NORMAL};
#else
        STATUSPANEL data = {48, wxSB_NORMAL};
#endif
        panels.push_back(data);
        m_ClockPos = counter;
        counter++;
    }
    //STATUSPANEL data = {1, wxSB_FLAT};
    //panels.push_back(data);
    //STATUSPANEL data1 = {15, wxSB_FLAT};
    //panels.push_back(data1);

    int *STATUSBAR_Sizes = new int[panels.size()];
    int *STATUSBAR_Styles = new int[panels.size()];
    for(size_t i = 0; i < panels.size(); ++i)
    {
        STATUSBAR_Sizes[i] = panels[i].size;
        STATUSBAR_Styles[i] = panels[i].style;
    }
    SetFieldsCount(panels.size(), STATUSBAR_Sizes);
    SetStatusStyles(panels.size(), STATUSBAR_Styles);

    delete [] STATUSBAR_Sizes;
    delete [] STATUSBAR_Styles;

    //set text & start timer
    if(panelsstyle & enumGISStatusClock)
    {
        SetMessage(wxDateTime::Now().Format(_("%H:%M")), m_ClockPos);
        m_timer.Start(30000);    // 1 minute interval
    }
}
Beispiel #3
0
bool wxExStatusBar::ShowField(const wxString& field, bool show)
{
  wxASSERT(!m_Panes.empty());
  
  bool changed = false;
  int* widths = new int[m_Panes.size()];
  int* styles = new int[m_Panes.size()];
  int i = 0; // number of shown panes

  for (
    auto it = m_Panes.begin();
    it != m_Panes.end();
    ++it)
  {
    if (it->GetName() == field)
    {
      if (show)
      {
        if (!it->IsShown())
        {
          it->Show(true);
          changed = true;
        }
        
        widths[i] = it->GetWidth();
        styles[i] = it->GetStyle();
        
        i++;
      }
      else
      {
        if (it->IsShown())
        {
          it->Show(false);
          changed = true;
          wxStatusBar::SetStatusText(wxEmptyString, i);
        }
      }
    }
    else
    {
      if (it->IsShown())
      {
        widths[i] = it->GetWidth();
        styles[i] = it->GetStyle();
        
        i++;
      }
    }
  }

  if (changed)
  {
    SetFieldsCount(i, widths);
    SetStatusStyles(i, styles);
  }

  delete[] styles;
  delete[] widths;
  
  return changed;
}
Beispiel #4
0
wxGISStatusBar::wxGISStatusBar(wxWindow *parent, wxWindowID id, long style, const wxString& name, WXDWORD panesstyle) : wxStatusBar(parent, id, style, name), IStatusBar(panesstyle), m_timer(this, TIMER_ID), m_pAni(NULL)
{
	m_pApp = dynamic_cast<IApplication*>(parent);

	struct _statuspane
	{
		int size;
		long style;
	};

	std::vector<_statuspane> panes;
	int counter(0);
	if(panesstyle & enumGISStatusMain)
	{
		_statuspane data = {-1, wxSB_FLAT};
		panes.push_back(data);
		m_MsgPos = counter;
		counter++;
	}
	if(panesstyle & enumGISStatusProgress)
	{
		_statuspane data = {100, wxSB_FLAT};
		panes.push_back(data);
		_statuspane data1 = {-1, wxSB_FLAT};
		panes.push_back(data1);
		m_ProgressPos = counter;
		counter++;
	}
	if(panesstyle & enumGISStatusAnimation)
	{
		_statuspane data = {23, wxSB_NORMAL};
		panes.push_back(data);
		//bitmap
		m_pAni = new wxGISAnimation(this, wxID_ANY, wxBitmap(globe_imglst14_xpm), 14);
		m_pAni->Hide();
		m_AniPos = counter;
		counter++;
	}
	if(panesstyle & enumGISStatusPosition)
	{
		_statuspane data = {200, wxSB_NORMAL};
		panes.push_back(data);
		counter++;
	}
	if(panesstyle & enumGISStatusPagePosition)
	{
		_statuspane data = {100, wxSB_NORMAL};
		panes.push_back(data);
		counter++;
	}
	if(panesstyle & enumGISStatusSize)
	{
		_statuspane data = {80, wxSB_NORMAL};
		panes.push_back(data);
		counter++;
	}
	if(panesstyle & enumGISStatusCapsLock)
	{
		_statuspane data = {40, wxSB_NORMAL};
		panes.push_back(data);
		counter++;
	}
	if(panesstyle & enumGISStatusNumLock)
	{
		_statuspane data = {40, wxSB_NORMAL};
		panes.push_back(data);
		counter++;
	}
	if(panesstyle & enumGISStatusScrollLock)
	{
		_statuspane data = {40, wxSB_NORMAL};
		panes.push_back(data);
		counter++;
	}
	if(panesstyle & enumGISStatusClock)
	{
		_statuspane data = {38, wxSB_NORMAL};
		panes.push_back(data);
		m_ClockPos = counter;
		counter++;
	}
	_statuspane data = {1, wxSB_FLAT};
	panes.push_back(data);
	_statuspane data1 = {15, wxSB_FLAT};
	panes.push_back(data1);

	int *STATUSBAR_Sizes  = new int[panes.size()];
	int *STATUSBAR_Styles = new int[panes.size()];
	for(size_t i = 0; i< panes.size(); i++)
	{
		STATUSBAR_Sizes[i] = panes[i].size;
		STATUSBAR_Styles[i] = panes[i].style;
	}
	SetFieldsCount(panes.size(), STATUSBAR_Sizes);
	SetStatusStyles(panes.size(), STATUSBAR_Styles);

	delete [] STATUSBAR_Sizes;
	delete [] STATUSBAR_Styles;

	//
	//
	if(panesstyle & enumGISStatusClock)
	{
		SetMessage(wxDateTime::Now().Format(_("%H:%M")), m_ClockPos);
		m_timer.Start(30000);
	}
}