// ----------- PHDStatusBar Class // PHDStatusBar::PHDStatusBar(wxWindow *parent, long style) : wxStatusBar(parent, wxID_ANY, wxSTB_SHOW_TIPS | wxSTB_ELLIPSIZE_END | wxFULL_REPAINT_ON_RESIZE, "PHDStatusBar") { std::vector<int> fieldWidths; // Set up the only field the wxStatusBar base class will know about int widths[] = {-1}; SetFieldsCount(1); SetStatusWidths(1, widths); this->SetBackgroundColour(*wxBLACK); m_ctrlPanel = new SBPanel(this, wxSize(500, SB_HEIGHT)); m_ctrlPanel->SetPosition(wxPoint(1, 2)); // Build the leftmost text status field, the only field managed at this level m_Msg1 = new wxStaticText(m_ctrlPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150, -1)); int txtWidth, txtHeight; GetTextExtent(_("Selected star at (999.9, 999.9)"), &txtWidth, &txtHeight); // only care about the width m_Msg1->SetBackgroundColour(*wxBLACK); m_Msg1->SetForegroundColour(*wxWHITE); fieldWidths.push_back(txtWidth); // Doesn't matter but we need to occupy the position in fieldWidths // Build the star status fields m_StarIndicators = new SBStarIndicators(m_ctrlPanel, fieldWidths); // Build the guide indicators m_GuideIndicators = new SBGuideIndicators(m_ctrlPanel, fieldWidths); // Build the state indicator controls m_StateIndicators = new SBStateIndicators(m_ctrlPanel, fieldWidths); m_ctrlPanel->BuildFieldOffsets(fieldWidths); }
bool wxStatusBarGeneric::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { if ( !wxWindow::Create(parent, id, wxDefaultPosition, wxDefaultSize, style | wxTAB_TRAVERSAL, name) ) return false; // The status bar should have a themed background SetThemeEnabled( true ); InitColours(); #ifdef __WXPM__ SetFont(*wxSMALL_FONT); #endif // Set the height according to the font and the border size wxClientDC dc(this); dc.SetFont(GetFont()); wxCoord y; dc.GetTextExtent(_T("X"), NULL, &y ); int height = (int)( (11*y)/10 + 2*GetBorderY()); SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, height); SetFieldsCount(1); return true; }
void t4p::StatusBarWithGaugeClass::RedrawGauges() { // Each gauge takes it 2 columns (one for the gauge title and one for the gauge itself), // plus the leftmost default status bar columns (for the menu help and other messages) const int DEFAULT_COLUMNS = 2; int newColumnCount = (Gauges.size() * 2) + DEFAULT_COLUMNS; int* widths = new int[newColumnCount]; for (int i = 0; i < DEFAULT_COLUMNS; ++i) { widths[i] = -1; } for (int i = DEFAULT_COLUMNS; i < newColumnCount; i += 2) { widths[i] = 150; widths[i + 1] = 300; } SetFieldsCount(newColumnCount); SetStatusWidths(newColumnCount, widths); // ATTN: in MSW this line results in a crash why?? wxPlatformInfo platform; if (!(wxOS_WINDOWS | platform.GetOperatingSystemId())) { SetMinHeight(BITMAP_SIZE_Y); } int col = DEFAULT_COLUMNS; for (std::map<int, wxGauge*>::iterator it = Gauges.begin(); it != Gauges.end(); ++it) { SetStatusText(GaugeTitles[it->first], col++); wxRect rect; GetFieldRect(col++, rect); it->second->SetSize(rect.x + 2, rect.y + 2, rect.width - 4, rect.height - 4); } delete[] widths; }
CustomStatusBar::CustomStatusBar(wxWindow *parent, wxWindowID id) : wxStatusBar(parent, id) { SetFieldsCount(5); m_gauge = new ProgressCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize); m_gauge->SetMaxRange(200); }
bool wxStatusBarGeneric::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { style |= wxTAB_TRAVERSAL | wxFULL_REPAINT_ON_RESIZE; if ( !wxWindow::Create(parent, id, wxDefaultPosition, wxDefaultSize, style, name) ) return false; // The status bar should have a themed background SetThemeEnabled( true ); InitColours(); int height = (int)((11*GetCharHeight())/10 + 2*GetBorderY()); SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, height); SetFieldsCount(1); #if defined( __WXGTK20__ ) #if GTK_CHECK_VERSION(2,12,0) if (HasFlag(wxSTB_SHOW_TIPS) && wx_is_at_least_gtk2(12)) { g_object_set(m_widget, "has-tooltip", TRUE, NULL); g_signal_connect(m_widget, "query-tooltip", G_CALLBACK(statusbar_query_tooltip), this); } #endif #endif return true; }
bool wxStatusBar::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { if ( !CreateControl(parent, id, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, name) ) return false; if ( !MSWCreateControl(STATUSCLASSNAME, wxString(), wxDefaultPosition, wxDefaultSize) ) return false; SetFieldsCount(1); // cache the DC instance used by DoUpdateStatusText: m_pDC = new wxClientDC(this); // we must refresh the frame size when the statusbar is created, because // its client area might change // // notice that we must post the event, not send it, as the frame doesn't // know that we're its status bar yet so laying it out right now wouldn't // work correctly, we need to wait until we return to the main loop PostSizeEventToParent(); return true; }
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); }
ProgressStatusBar::ProgressStatusBar(wxWindow *parent) : wxStatusBar(parent), gauge(this, wxID_ANY, RANGE_MAX) { int widths[] = { -1, 96, 200 }; SetFieldsCount(FIELDCOUNT, widths); }
/***************************************************** ** ** MainWindowStatusbar --- Constructor ** ******************************************************/ MainWindowStatusbar::MainWindowStatusbar( wxWindow *parent ) : MyStatusbar( parent ) { SetFieldsCount( 2 ); planettimer = new wxTimer( this, STATUSBAR_PTIMER ); Connect( STATUSBAR_PTIMER, wxEVT_TIMER, wxTimerEventHandler( MainWindowStatusbar::OnPlanetTimer )); Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainWindowStatusbar::OnRightDown )); }
StatusBar::StatusBar(EditorFrame& parent, wxWindowID id, const ITmGetSyntaxes* syntax_handler): wxStatusBar(&parent, id), m_parentFrame(parent), m_syntax_handler(syntax_handler), m_editorCtrl(NULL) { const int widths[] = {160, 120, 100, -1, 150 }; SetFieldsCount(WXSIZEOF(widths), widths); }
StatusBar::StatusBar (wxWindow* parent) : wxStatusBar (parent) { static const int widths[Field_Max] = {-1, 150, 30}; SetFieldsCount(Field_Max); SetStatusWidths(Field_Max, widths); gauge = new wxGauge(this, wxID_ANY, 100); gauge->SetValue(0); }
Statusbar::Statusbar( wxWindow* parent ) :wxStatusBar( parent, wxNewId() ), m_addMessageSink( this, &GetStatusEventSender(UiEvents::addStatusMessage) ), m_removeMessageSink( this, &GetStatusEventSender(UiEvents::removeStatusMessage) ) { int w[3] = {460,-1,120}; SetFieldsCount( 3, w ); PushStatusText( TowxString(getSpringlobbyVersion()), 1 ); taskBar = new TaskBar(this); }
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); }
Statusbar::Statusbar( wxWindow* parent ) :wxStatusBar( parent, wxNewId() ), m_addMessageSink( this, &GetStatusEventSender(UiEvents::addStatusMessage) ), m_removeMessageSink( this, &GetStatusEventSender(UiEvents::removeStatusMessage) ) { int w[3] = {-1,-1,120}; SetFieldsCount( 3, w ); PushStatusText( wxFormat( _T("%s %s") ) % GetAppName() % GetSpringLobbyVersion(), 1 ); }
bool wxStatusBar::Create(wxWindow *parent, wxWindowID WXUNUSED(winid), long style, const wxString& WXUNUSED(name)) { m_qtStatusBar = new wxQtStatusBar( parent, this ); m_qtPanes = new QList < QLabel* >; if ( style & wxSTB_SIZEGRIP ) m_qtStatusBar->setSizeGripEnabled(true); PostCreation(); SetFieldsCount(1); return true; }
bool wxStatusBarUniv::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { if ( !wxWindow::Create(parent, id, wxDefaultPosition, wxDefaultSize, style, name) ) { return false; } SetFieldsCount(1); CreateInputHandler(wxINP_HANDLER_STATUSBAR); SetSize(DoGetBestSize()); return true; }
MyStatusBar::MyStatusBar(wxWindow *parent, long style) : wxStatusBar(parent, wxID_ANY, style, "MyStatusBar") #if wxUSE_TIMER , m_timer(this) #endif #if wxUSE_CHECKBOX , m_checkbox(NULL) #endif { // compute the size needed for num lock indicator pane wxClientDC dc(this); wxSize sizeNumLock = dc.GetTextExtent(numlockIndicators[0]); sizeNumLock.IncTo(dc.GetTextExtent(numlockIndicators[1])); int widths[Field_Max]; widths[Field_Text] = -1; // growable widths[Field_Checkbox] = 150; widths[Field_Bitmap] = BITMAP_SIZE_X; widths[Field_NumLockIndicator] = sizeNumLock.x; widths[Field_Clock] = 100; widths[Field_CapsLockIndicator] = dc.GetTextExtent(capslockIndicators[1]).x; SetFieldsCount(Field_Max); SetStatusWidths(Field_Max, widths); #if wxUSE_CHECKBOX m_checkbox = new wxCheckBox(this, StatusBar_Checkbox, wxT("&Toggle clock")); m_checkbox->SetValue(true); #endif m_statbmp = new wxStaticBitmap(this, wxID_ANY, wxIcon(green_xpm)); #if wxUSE_TIMER m_timer.Start(1000); #endif SetMinHeight(wxMax(m_statbmp->GetBestSize().GetHeight(), m_checkbox->GetBestSize().GetHeight())); UpdateClock(); }
GNC::GUI::StatusBarProgreso::StatusBarProgreso( wxWindow* pPadre, wxWindow* pPadrePanel, bool listenMessages, wxWindowID id, long style) : wxStatusBar(pPadre, id, style), m_dirty (true) { m_pPanelTareas = new PanelTareasBase(pPadrePanel); m_pPanelTareas->Show(false); SetFieldsCount(Field_Max); //uno para el texto y el otro para lo q yo quiera static const int widths[Field_Max] = { -1, 32, 250, 150}; SetStatusWidths(Field_Max, widths); //mensaje tarea m_pMensajeTarea = new wxStaticText(this,wxID_ANY,wxT(""), wxDefaultPosition, wxSize(250, -1), wxST_NO_AUTORESIZE); m_pMensajeTarea->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler( StatusBarProgreso::OnMostrarOcultarDialogoProgreso),NULL,this); //botoncico de progreso m_pIconoProgreso = new wxAnimationCtrl(this,wxID_ANY,GinkgoResourcesManager::ProgressBar::GetAniLoading()); m_pIconoProgreso->Hide(); m_pProgresoTarea = new wxGauge(this, wxID_ANY, 100); m_pProgresoTarea->Hide(); m_pIconoParado = new wxStaticBitmap(this,wxID_ANY,GinkgoResourcesManager::ProgressBar::GetIcoStopped()); m_pIconoParado->Show(true); //escuchamos el evento de mensajes if (listenMessages) { GNC::GCS::Events::EventoMensajes evt(NULL); GNC::GCS::ControladorEventos::Instance()->Registrar(this,evt); } wxSizeEvent event(pPadre->GetSize()); OnSize(event); //onsize this->Connect(wxEVT_IDLE, wxIdleEventHandler(StatusBarProgreso::OnIdle), NULL, this); this->Connect(wxEVT_SIZE,wxSizeEventHandler(StatusBarProgreso::OnSize),NULL,this); this->GetParent()->Connect(wxEVT_MOVE,wxMoveEventHandler(StatusBarProgreso::OnMove),NULL,this); this->Connect(wxEVT_MENSAJES_USUARIO_ASYNC, EventoMensajesUsuarioAsyncHandler(StatusBarProgreso::OnMensajeUsuario), NULL, this); }
bool wxStatusBarBeOS::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { wxCHECK_MSG( parent, false, wxT("status bar must have a parent") ); wxPoint pos(0, parent->GetSize().y-14); wxSize size(parent->GetSize().x, 14); if(!m_view) m_view = new BBackView(this, pos, size, B_FOLLOW_BOTTOM | B_FOLLOW_LEFT_RIGHT, name); StatusTextBuffer = NULL; SetName(name); SetParent(parent); SetId( id == wxID_ANY ? NewControlId() : id ); parent->AddChild(this); SetFieldsCount(1); return true; }
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); } }
bool wxStatusBar95::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { wxCHECK_MSG( parent, false, wxT("status bar must have a parent") ); SetName(name); SetWindowStyleFlag(style); SetParent(parent); parent->AddChild(this); m_windowId = id == wxID_ANY ? NewControlId() : id; DWORD wstyle = WS_CHILD | WS_VISIBLE; if ( style & wxCLIP_SIBLINGS ) wstyle |= WS_CLIPSIBLINGS; // setting SBARS_SIZEGRIP is perfectly useless: it's always on by default // (at least in the version of comctl32.dll I'm using), and the only way to // turn it off is to use CCS_TOP style - as we position the status bar // manually anyhow (see DoMoveWindow), use CCS_TOP style if wxST_SIZEGRIP // is not given if ( !(style & wxST_SIZEGRIP) ) { wstyle |= CCS_TOP; } else { #ifndef __WXWINCE__ // may be some versions of comctl32.dll do need it - anyhow, it won't // do any harm wstyle |= SBARS_SIZEGRIP; #endif } m_hWnd = (WXHWND)CreateStatusWindow(wstyle, wxEmptyString, GetHwndOf(parent), m_windowId); if ( m_hWnd == 0 ) { wxLogSysError(_("Failed to create a status bar.")); return false; } SetFieldsCount(1); SubclassWin(m_hWnd); InheritAttributes(); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR)); // we must refresh the frame size when the statusbar is created, because // its client area might change wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); if ( frame ) { frame->SendSizeEvent(); } return true; }
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 } }
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; }