Added STATUS_TEXT_POPUP for simple popup text display
This commit is contained in:
parent
9673ac4ecd
commit
7129dcef91
|
@ -73,3 +73,24 @@ void STATUS_POPUP::onExpire( wxTimerEvent& aEvent )
|
|||
{
|
||||
Hide();
|
||||
}
|
||||
|
||||
|
||||
STATUS_TEXT_POPUP::STATUS_TEXT_POPUP( EDA_DRAW_FRAME* aParent ) :
|
||||
STATUS_POPUP( aParent )
|
||||
{
|
||||
m_statusLine = new wxStaticText( m_panel, wxID_ANY, wxEmptyString ) ;
|
||||
m_topSizer->Add( m_statusLine, 1, wxALL | wxEXPAND, 5 );
|
||||
}
|
||||
|
||||
|
||||
void STATUS_TEXT_POPUP::SetText( const wxString& aText )
|
||||
{
|
||||
m_statusLine->SetLabel( aText );
|
||||
updateSize();
|
||||
}
|
||||
|
||||
|
||||
void STATUS_TEXT_POPUP::SetTextColor( const wxColour& aColor )
|
||||
{
|
||||
m_statusLine->SetForegroundColour( aColor );
|
||||
}
|
||||
|
|
|
@ -65,4 +65,32 @@ protected:
|
|||
wxTimer m_expireTimer;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class STATUS_TEXT_POPUP
|
||||
*
|
||||
* Extension of STATUS_POPUP, displaying a single line text.
|
||||
*/
|
||||
class STATUS_TEXT_POPUP : public STATUS_POPUP
|
||||
{
|
||||
public:
|
||||
STATUS_TEXT_POPUP( EDA_DRAW_FRAME* aParent );
|
||||
virtual ~STATUS_TEXT_POPUP() {}
|
||||
|
||||
/**
|
||||
* Display a text.
|
||||
* @param aText is the text to be displayed.
|
||||
*/
|
||||
void SetText( const wxString& aText );
|
||||
|
||||
/**
|
||||
* Change text color.
|
||||
* @param aColor is the new text color.
|
||||
*/
|
||||
void SetTextColor( const wxColour& aColor );
|
||||
|
||||
protected:
|
||||
wxStaticText* m_statusLine;
|
||||
};
|
||||
|
||||
#endif /* __STATUS_POPUP_H_*/
|
||||
|
|
|
@ -24,16 +24,9 @@
|
|||
#include "pns_meander_placer.h"
|
||||
|
||||
PNS_TUNE_STATUS_POPUP::PNS_TUNE_STATUS_POPUP( EDA_DRAW_FRAME* aParent ) :
|
||||
STATUS_POPUP( aParent )
|
||||
STATUS_TEXT_POPUP( aParent )
|
||||
{
|
||||
m_panel->SetBackgroundColour( wxColour( 64, 64, 64 ) );
|
||||
m_statusLine = new wxStaticText( m_panel, wxID_ANY, wxEmptyString ) ;
|
||||
m_topSizer->Add( m_statusLine, 1, wxALL | wxEXPAND, 5 );
|
||||
}
|
||||
|
||||
|
||||
PNS_TUNE_STATUS_POPUP::~PNS_TUNE_STATUS_POPUP()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,25 +37,19 @@ void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS::ROUTER* aRouter )
|
|||
if( !placer )
|
||||
return;
|
||||
|
||||
m_statusLine->SetLabel( placer->TuningInfo() );
|
||||
|
||||
wxColour color;
|
||||
SetText( placer->TuningInfo() );
|
||||
|
||||
switch( placer->TuningStatus() )
|
||||
{
|
||||
case PNS::MEANDER_PLACER::TUNED:
|
||||
color = wxColour( 0, 255, 0 );
|
||||
SetTextColor( wxColour( 0, 255, 0 ) );
|
||||
break;
|
||||
case PNS::MEANDER_PLACER::TOO_SHORT:
|
||||
color = wxColour( 255, 128, 128 );
|
||||
SetTextColor( wxColour( 255, 128, 128 ) );
|
||||
break;
|
||||
case PNS::MEANDER_PLACER::TOO_LONG:
|
||||
color = wxColour( 128, 128, 255 );
|
||||
SetTextColor( wxColour( 128, 128, 255 ) );
|
||||
break;
|
||||
}
|
||||
|
||||
m_statusLine->SetForegroundColour( color );
|
||||
|
||||
updateSize();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,16 +34,12 @@ class ROUTER;
|
|||
|
||||
}
|
||||
|
||||
class PNS_TUNE_STATUS_POPUP : public STATUS_POPUP
|
||||
class PNS_TUNE_STATUS_POPUP : public STATUS_TEXT_POPUP
|
||||
{
|
||||
public:
|
||||
PNS_TUNE_STATUS_POPUP( EDA_DRAW_FRAME* aParent );
|
||||
~PNS_TUNE_STATUS_POPUP();
|
||||
|
||||
void UpdateStatus( PNS::ROUTER* aRouter );
|
||||
|
||||
private:
|
||||
wxStaticText* m_statusLine;
|
||||
};
|
||||
|
||||
#endif /* __PNS_TUNE_STATUS_POPUP_H_*/
|
||||
|
|
Loading…
Reference in New Issue