Ejemplo n.º 1
0
void StripMenuButton::updateMouse()
{
	wxRect panelRec = GetScreenRect(); 
	panelRec.x += 2;
	panelRec.y += 2;
	panelRec.width -= 4;
	panelRec.height -= 4;

	wxPoint mousePoint = wxGetMousePosition();

	bool t1 = panelRec.x <= mousePoint.x;
	bool t2 = panelRec.y <= mousePoint.y;
	bool t3 = (panelRec.x + panelRec.width ) >= mousePoint.x;
	bool t4 = (panelRec.y + panelRec.height) >= mousePoint.y;

	if (t1 && t2 && t3 && t4)
	{
		if (!m_bHovering)
		{
			SetForegroundColour( m_colHover );
			m_bHovering = true;
			invalidatePaint();
			this->Refresh();
		}
	}
	else if (m_bHovering)
	{
		SetForegroundColour( m_colNormal );
		m_bHovering = false;
		invalidatePaint();
		this->Refresh();
	}
}
Ejemplo n.º 2
0
void wxHyperLink::SetVisitedColour (wxColour colour) {
    m_VisitedColour = colour;
    if (!m_Visited) {
        SetForegroundColour (m_NormalColour);
    }else{
        SetForegroundColour (m_VisitedColour);
    }
    Refresh();
}
Ejemplo n.º 3
0
void DlgSaveLayout::CreateControls()
{    
////@begin DlgSaveLayout content construction
    // Generated by DialogBlocks, 01/19/06 21:43:54 (unregistered)

    wxXmlResource::Get()->LoadDialog(this, GetParent(), _T("ID_DIALOG_SAVE_LAYOUT"));
    m_ComboLayout = XRCCTRL(*this, "ID_COMBOBOX_LAYOUT", wxComboBox);
////@end DlgSaveLayout content construction

    // Create custom windows not generated automatically here.

////@begin DlgSaveLayout content initialisation

////@end DlgSaveLayout content initialisation

	wxStringList layoutList(wxMainFrame::Get()->GetLayoutControl()->GetLayoutList());

	for(int i = 0; i < layoutList.size(); i++)
	{
		wxString name(layoutList[i]);

		if(name != wxMainFrame::Get()->GetLayoutControl()->getDefaultString())
		{
			m_ComboLayout->Append(name);
		}
	}

	SetBackgroundColour(wxBackground_Pen);
	SetForegroundColour(colorCaptionText);

	m_ComboLayout->SetBackgroundColour(colorBgContent);

}
Ejemplo n.º 4
0
void wxComboCtrl::OnThemeChange()
{
    // there doesn't seem to be any way to get the text colour using themes
    // API: TMT_TEXTCOLOR doesn't work neither for EDIT nor COMBOBOX
    SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));

#if wxUSE_UXTHEME
    wxUxThemeEngine * const theme = wxUxThemeEngine::GetIfActive();
    if ( theme )
    {
        // NB: use EDIT, not COMBOBOX (the latter works in XP but not Vista)
        wxUxThemeHandle hTheme(this, L"EDIT");
        COLORREF col;
        HRESULT hr = theme->GetThemeColor
                            (
                                hTheme,
                                EP_EDITTEXT,
                                ETS_NORMAL,
                                TMT_FILLCOLOR,
                                &col
                            );
        if ( SUCCEEDED(hr) )
        {
            SetBackgroundColour(wxRGBToColour(col));

            // skip the call below
            return;
        }

        wxLogApiError(_T("GetThemeColor(EDIT, ETS_NORMAL, TMT_FILLCOLOR)"), hr);
    }
#endif

    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
}
Ejemplo n.º 5
0
wxInitialTipTextCtrl::wxInitialTipTextCtrl(wxWindow* parent, wxWindowID id)
   : wxTextCtrl(parent, id, wxT("")),
     myInitialTipShowing(false),
     myDuringInitialTipChange(false)
{
   SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
}
Ejemplo n.º 6
0
void wxGenericColourButton::UpdateColour()
{
    if ( !m_colour.Ok() )
    {
#if wxCLRBTN_USES_BMP_BUTTON
        wxBitmap empty(1,1);
        SetBitmapLabel(empty);
#else
        if ( HasFlag(wxCLRP_SHOW_LABEL) )
            SetLabel(wxEmptyString);
#endif
        return;
    }

    // some combinations of the fg/bg colours may be unreadable, so we invert
    // the colour to make sure fg colour is different enough from m_colour
    wxColour colFg(~m_colour.Red(), ~m_colour.Green(), ~m_colour.Blue());

#if wxCLRBTN_USES_BMP_BUTTON
    wxSize sz = GetSize();
    sz.x -= 2*GetMarginX();
    sz.y -= 2*GetMarginY();

    wxPoint topleft;
    
    if ( sz.x < 1 )
        sz.x = 1;
    else
    if ( sz.y < 1 )
        sz.y = 1;
    
    wxBitmap bmp(sz.x, sz.y);
    {
        wxMemoryDC memdc(bmp);
        memdc.SetPen(colFg);
        memdc.SetBrush(m_colour);
        memdc.DrawRectangle(topleft,sz);
        if ( HasFlag(wxCLRP_SHOW_LABEL) )
        {
            int x, y, leading, desc;
            wxString label = m_colour.GetAsString(wxC2S_HTML_SYNTAX);
            memdc.GetTextExtent(label,&x,&y,&desc,&leading);
            if ( x <= sz.x && y <= sz.y )
            {
                topleft.x += (sz.x-x)/2;
                topleft.y += (sz.y-y)/2;
                memdc.SetTextForeground(colFg);
                memdc.DrawText(label,topleft);
            }
        }
    }
    SetBitmapLabel(bmp);
#else
    SetForegroundColour(colFg);
    SetBackgroundColour(m_colour);

    if ( HasFlag(wxCLRP_SHOW_LABEL) )
        SetLabel(m_colour.GetAsString(wxC2S_HTML_SYNTAX));
#endif
}
Ejemplo n.º 7
0
bool wxHyperLink::Create (wxWindow *parent,
                          wxWindowID id,
                          const wxString &label,
                          const wxPoint &pos,
                          const wxSize &size,
                          long style,
                          const wxString &name) {
    bool okay = FALSE;

    // create static text
    okay = wxStaticText::Create (parent, id, label, pos, size, style, name);
    wxASSERT_MSG (okay, wxT("Failed to create wxStaticText, needed by wxHyperLink!"));

    // initialize variables
    m_URL = wxEmptyString;
    m_Marked = false;
    m_Visited = false;
    m_MarkedColour = wxColour (wxT("DARK GREY"));
    m_NormalColour = wxColour (wxT("BLUE"));
    m_VisitedColour = wxColour (wxT("PURPLE"));
    m_HoverCursor = wxCursor (wxCURSOR_HAND);

    // set foreground colour
    SetForegroundColour (m_NormalColour);
    wxFont font = GetFont();
    font.SetUnderlined (true);
    SetFont (font);

    // get background colour
    m_BackgroundColour = GetBackgroundColour ();

    return okay;
} // Create
Ejemplo n.º 8
0
CStatusLineCtrl::CStatusLineCtrl(CQueueView* pParent, const t_EngineData* const pEngineData, const wxRect& initialPosition)
	: m_pEngineData(pEngineData)
{
	m_mdc = 0;
	m_pPreviousStatusText = 0;
	m_last_elapsed_seconds = 0;
	m_last_left = 0;
	m_last_bar_split = -1;
	m_last_permill = -1;

	wxASSERT(pEngineData);

#ifdef __WXMSW__
	Create(pParent, wxID_ANY, initialPosition.GetPosition(), initialPosition.GetSize());
#else
	Create(pParent->GetMainWindow(), wxID_ANY, initialPosition.GetPosition(), initialPosition.GetSize());
#endif

	SetOwnFont(pParent->GetFont());
	SetForegroundColour(pParent->GetForegroundColour());
	SetBackgroundStyle(wxBG_STYLE_CUSTOM);
	SetBackgroundColour(pParent->GetBackgroundColour());

	m_transferStatusTimer.SetOwner(this);

	m_pParent = pParent;
	m_pStatus = 0;
	m_lastOffset = -1;
	
	m_gcLastTimeStamp = wxDateTime::Now();
	m_gcLastOffset = -1;
	m_gcLastSpeed = -1;

	SetTransferStatus(0);


	// Calculate field widths so that the contents fit under every language.
	if (!m_initialized)
	{
		m_initialized = true;
		wxClientDC dc(this);
		dc.SetFont(GetFont());

		wxCoord w, h;
		wxTimeSpan elapsed(100, 0, 0);
		dc.GetTextExtent(elapsed.Format(_("%H:%M:%S elapsed")), &w, &h);
		m_textHeight = h;
		m_fieldOffsets[0] = 50 + w;

		dc.GetTextExtent(elapsed.Format(_("%H:%M:%S left")), &w, &h);
		m_fieldOffsets[1] = m_fieldOffsets[0] + 20 + w;

		m_fieldOffsets[2] = m_fieldOffsets[1] + 20;
		m_fieldOffsets[3] = m_fieldOffsets[2] + PROGRESSBAR_WIDTH + 20;
	}

#ifdef __WXGTK__
	ResetCursor(this);
#endif
}
Ejemplo n.º 9
0
moPreviewFrame::moPreviewFrame(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{

  m_pGLCanvas = NULL;
	m_pSizer = NULL;
  //Create(parent, wxID_ANY, _("Moldeo output"), pos, size, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
	//(*Initialize(moPreviewFrame)
  Create(parent, wxID_ANY, _("Moldeo output"), pos, size, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
	SetClientSize(wxSize(400,300));
	SetForegroundColour(wxColour(255,255,255));
	SetBackgroundColour(wxColour(0,0,0));
/*
	ToolBar1 = new wxToolBar(this, ID_TOOLBAR1, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL|wxNO_BORDER, _T("ID_TOOLBAR1"));
	ToolBar1->SetToolBitmapSize(wxSize(32,32));
	ToolBarItem1 = ToolBar1->AddTool(TOOLPLAY, _("Play"), wxBitmap(wxImage(_T(MOLDEODATADIR"/icons/play32.png"))), wxBitmap(wxImage(_T(MOLDEODATADIR"/icons/play32dis.png"))), wxITEM_NORMAL, _("Play syncro"), _("Help text"));
	ToolBarItem2 = ToolBar1->AddTool(TOOLPAUSE, _("Pause"), wxBitmap(wxImage(_T(MOLDEODATADIR"/icons/pause32.png"))), wxBitmap(wxImage(_T(MOLDEODATADIR"/icons/pause32.png"))), wxITEM_NORMAL, _("Pause"), _("Pause"));
	ToolBarItem3 = ToolBar1->AddTool(TOOLFULLSCREEN, _("Fullscreen"), wxBitmap(wxImage(_T(MOLDEODATADIR"/icons/onofficon32.png"))), wxNullBitmap, wxITEM_NORMAL, _("Fullscreen"), _("Fullscreen"));
	ToolBar1->Realize();
	SetToolBar(ToolBar1);
*/

	Connect(wxID_ANY,wxEVT_CLOSE_WINDOW,(wxObjectEventFunction)&moPreviewFrame::OnClose);
	//*)

	//ToolBar1->Hide();

}
Ejemplo n.º 10
0
// class constructor
Resound::MonitorNodeWidget::MonitorNodeWidget(wxWindow* parent, int id, ParameterAddress _addr)
		: Resound::ParameterAddressWidgetBase(parent,id,_addr)
{
	SetWindowStyle(wxSIMPLE_BORDER | wxCLIP_CHILDREN);
	SetBackgroundColour(wxColour(30,100,150));
	SetForegroundColour(wxColour(255,255,255));

	wxSize size(45,45);
	SetSize(size);
	SetMinSize(size);
	SetMaxSize(size);

	// construct the sub objects and sizer
	wxBoxSizer *topSizer = new wxBoxSizer( wxHORIZONTAL );
	wxBoxSizer *leftSizer = new wxBoxSizer( wxVERTICAL );
	SetToolTip(wxConvertMB2WX(addr.get_address().c_str())); 
	//leftSizer->Add(new wxStaticText(this,MNW_LABEL,label, wxPoint(0,0),wxSize(40,18),wxALIGN_CENTRE),wxSizerFlags(0).Align(0).Border(wxALL,0));
	//leftSizer->Add(new wxToggleButton(this,MNW_LOCKBUTTON,_("L"), wxPoint(0,0),wxSize(20,20)),wxSizerFlags(0).Center().Border(wxALL,0));
	topSizer->Add(leftSizer);
	meter = new Resound::ParameterVUMeterWidget(this,MNW_METER,rand() % 128,0,128,_(RESOURCE_DIR "/image/smMeterOff.png"),_(RESOURCE_DIR "/image/smMeterOn.png"));
	meter->SetTarget(addr);
	topSizer->Add(meter,wxSizerFlags(0).Align(0).Border(wxALL,0)); //meter1
	SetSizer(topSizer);
	//topSizer->SetSizeHints(this);   // set size hints to honour minimum size
	topSizer->Layout();
}
Ejemplo n.º 11
0
StripMenuButton::StripMenuButton(wxWindow *parent, wxString text, const wxSize &size) : gcFlickerFreePaint<wxPanel>(parent, wxID_ANY, wxDefaultPosition, size, wxFULL_REPAINT_ON_RESIZE|wxWANTS_CHARS), BaseMenuButton((wxPanel*)this)
{
	SetSize(size);
	SetMinSize(size);

	Bind( wxEVT_LEFT_DCLICK, &StripMenuButton::onMouseEvent, this);
	Bind( wxEVT_MOTION, &StripMenuButton::onMouseEvent, this);
	Bind( wxEVT_LEFT_DOWN, &StripMenuButton::onMouseDown, this);
	Bind( wxEVT_LEFT_UP, &StripMenuButton::onMouseUp, this);

	Bind( wxEVT_ENTER_WINDOW, &StripMenuButton::onMouseOver, this);
	Bind( wxEVT_LEAVE_WINDOW, &StripMenuButton::onMouseOut, this);
	Bind( wxEVT_UPDATE_UI, &StripMenuButton::onUpdateUI, this);

	GetParent()->Bind( wxEVT_MOTION, &StripMenuButton::onMouseEvent, this);

	m_bHovering = false;
	m_bBold = false;
	m_bHasFocus = false;
	m_bUsesFocus = false;

	m_uiOffset = 0;

	m_colHover = wxColor(GetGCThemeManager()->getColor("hyperlinkmenu", "hov-fg"));
	m_colNormal = wxColor(GetGCThemeManager()->getColor("hyperlinkmenu", "fg"));
	SetForegroundColour( m_colNormal );
	
	m_szLabel = text;
}
Ejemplo n.º 12
0
bool wxMenuButton::Create( wxWindow* parent, wxWindowID id,
                           const wxString &label,
                           const wxBitmap &bitmap,
                           const wxPoint& pos,
                           const wxSize& size,
                           long style,
                           const wxValidator& val,
                           const wxString& name)
{
    m_style = style;

    long flat = style & wxMENUBUT_FLAT;

    wxControl::Create(parent,id,pos,size,wxNO_BORDER|wxCLIP_CHILDREN,val,name);
    wxControl::SetLabel(label);
    SetBackgroundColour(parent->GetBackgroundColour());
    SetForegroundColour(parent->GetForegroundColour());
    SetFont(parent->GetFont());

    m_labelButton = new MenuLabelButton(this, id, label, bitmap, wxCUSTBUT_BUTTON|flat);
    m_dropdownButton = new MenuDropButton(this, IDD_DROPDOWN_BUTTON, wxCUSTBUT_BUTTON|flat);

    wxSize bestSize = DoGetBestSize();
    SetSize( wxSize(size.x < 0 ? bestSize.x : size.x,
                    size.y < 0 ? bestSize.y : size.y) );

#if (wxMINOR_VERSION<8)
    SetBestSize(GetSize());
#else
    SetInitialSize(GetSize());
#endif

    return TRUE;
}
Ejemplo n.º 13
0
moPreviewWindow::moPreviewWindow(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
    wxInitAllImageHandlers();
	//(*Initialize(moPreviewWindow)
	Create(parent, id, wxDefaultPosition, wxSize(401,336), wxTAB_TRAVERSAL, _T("id"));
	SetForegroundColour(wxColour(255,255,255));
	SetBackgroundColour(wxColour(0,0,0));
	BitmapButtonPlay = new wxBitmapButton(this, ID_BITMAPBUTTONPLAY, wxBitmap(wxImage(_T("../../doc/icons/play32.png"))), wxPoint(0,0), wxSize(32,32), wxBU_AUTODRAW, wxDefaultValidator, _T("ID_BITMAPBUTTONPLAY"));
	BitmapButtonPlay->SetDefault();
	BitmapButtonPause = new wxBitmapButton(this, ID_BITMAPBUTTONPAUSE, wxBitmap(wxImage(_T("../../doc/icons/pause32.png"))), wxPoint(32,0), wxSize(32,32), wxBU_AUTODRAW, wxDefaultValidator, _T("ID_BITMAPBUTTONPAUSE"));
	BitmapButtonPause->SetDefault();
	ButtonFullSCreen = new wxBitmapButton(this, ID_BITMAPBUTTONFULLSCREEN, wxBitmap(wxImage(_T("../../doc/icons/fullscreen32.png"))), wxPoint(96,0), wxSize(32,32), wxBU_AUTODRAW, wxDefaultValidator, _T("ID_BITMAPBUTTONFULLSCREEN"));
	ButtonFullSCreen->SetDefault();
	BitmapButtonScreenshot = new wxBitmapButton(this, ID_BITMAPBUTTONSCREENSHOT, wxBitmap(wxImage(_T("../../doc/icons/screenshot32.png"))), wxPoint(312,0), wxSize(32,32), wxBU_AUTODRAW, wxDefaultValidator, _T("ID_BITMAPBUTTONSCREENSHOT"));
	BitmapButtonScreenshot->SetDefault();
	BitmapButtonSaveVideo = new wxBitmapButton(this, ID_BITMAPBUTTONSAVEVIDEO, wxBitmap(wxImage(_T("../../doc/icons/savevideo32.png"))), wxPoint(344,0), wxSize(32,32), wxBU_AUTODRAW, wxDefaultValidator, _T("ID_BITMAPBUTTONSAVEVIDEO"));
	BitmapButtonSaveVideo->SetDefault();
	BitmapButtonSaveSession = new wxBitmapButton(this, ID_BITMAPBUTTONSAVESESSION, wxBitmap(wxImage(_T("../../doc/icons/savesession32.png"))), wxPoint(64,0), wxSize(32,32), wxBU_AUTODRAW, wxDefaultValidator, _T("ID_BITMAPBUTTONSAVESESSION"));
	BitmapButtonFocusOutput = new wxBitmapButton(this, ID_BITMAPBUTTONFOCUSOUTPUT, wxNullBitmap, wxPoint(136,5), wxSize(24,23), wxBU_AUTODRAW, wxDefaultValidator, _T("ID_BITMAPBUTTONFOCUSOUTPUT"));
	BitmapButtonFocusOutput->SetDefault();

	Connect(ID_BITMAPBUTTONFULLSCREEN,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&moPreviewWindow::OnButtonFullSCreenClick);
	Connect(ID_BITMAPBUTTONFOCUSOUTPUT,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&moPreviewWindow::OnBitmapButtonFocusAndActivate);
	//*)
	m_pGLCanvas = NULL;
}
FOOTPRINT_PREVIEW_WIDGET::FOOTPRINT_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway ):
    wxPanel( aParent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
             wxFULL_REPAINT_ON_RESIZE | wxSUNKEN_BORDER | wxTAB_TRAVERSAL ),
    m_prev_panel( nullptr ),
    m_status_label( nullptr ),
    m_sizer( nullptr )
{
    m_prev_panel = FOOTPRINT_PREVIEW_PANEL_BASE::Create( this, aKiway );

    if( !m_prev_panel )
        return;

    SetBackgroundColour( *wxBLACK );
    SetForegroundColour( *wxWHITE );

    m_status_label = new wxStaticText( this, -1, wxEmptyString );
    m_sizer = new wxBoxSizer( wxVERTICAL );
    m_sizer->Add( 0, 0, 1 );
    m_sizer->Add( m_status_label, 0, wxALL | wxALIGN_CENTER, 0 );
    m_sizer->Add( 0, 0, 1 );

    auto outer_sizer = new wxBoxSizer( wxVERTICAL );
    outer_sizer->Add( m_prev_panel->GetWindow(), 1, wxALL | wxEXPAND, 0 );
    outer_sizer->Add( m_sizer, 1, wxALL | wxALIGN_CENTER, 0 );

    m_sizer->ShowItems( false );
    m_prev_panel->SetStatusHandler( [this]( FOOTPRINT_STATUS s ){ this->OnStatusChange( s ); } );

    SetSizer( outer_sizer );
}
Ejemplo n.º 15
0
bool CTransparentStaticText::Create(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) { 
    bool bRetVal = wxStaticText::Create(parent, id, label, pos, size, style|wxTRANSPARENT_WINDOW, name);

    SetBackgroundColour(parent->GetBackgroundColour());
    SetForegroundColour(parent->GetForegroundColour());

    return bRetVal;
}
Ejemplo n.º 16
0
void CMusikEQGauge::Colourize()
{
	/*
	if ( wxGetApp().Prefs.nEQColourize != 1 )
		return;
	*/
	int nGreen = (int)( 200.0f * (float)GetValue() / 100.0f );
	SetForegroundColour( wxColour( 200 - nGreen, nGreen, 0 ) );
}
Ejemplo n.º 17
0
 InfoStaticText(wxWindow *parent) : wxStaticText(parent, wxID_ANY, "100%")
 {
     SetForegroundColour(ExplanationLabel::GetTextColor());
 #ifdef __WXMSW__
     SetFont(GetFont().Smaller());
 #else
     SetWindowVariant(wxWINDOW_VARIANT_SMALL);
 #endif
 }
Ejemplo n.º 18
0
void wxGenericHyperlinkCtrl::SetVisitedColour(const wxColour &colour)
{
    m_visitedColour = colour;
    if (m_visited)
    {
        SetForegroundColour(m_visitedColour);
        Refresh();
    }
}
Ejemplo n.º 19
0
void wxHyperlinkCtrl::SetNormalColour(const wxColour &colour)
{
    m_normalColour = colour;
    if (!m_visited)
    {
        SetForegroundColour(m_normalColour);
        Refresh();
    }
}
Ejemplo n.º 20
0
void wxBitmapComboBox::RecreateControl()
{
    //
    // Recreate control so that WM_MEASUREITEM gets called again.
    // Can't use CBS_OWNERDRAWVARIABLE because it has odd
    // mouse-wheel behaviour.
    //
    wxString value = GetValue();
    wxPoint pos = GetPosition();
    wxSize size = GetSize();
    wxArrayString strings = GetStrings();

    wxComboBox::DoClear();

    HWND hwnd = GetHwnd();
    DissociateHandle();
    ::DestroyWindow(hwnd);

    if ( !MSWCreateControl(wxT("COMBOBOX"), value, pos, size) )
        return;

    // initialize the controls contents
    for ( unsigned int i = 0; i < strings.size(); i++ )
    {
        wxComboBox::Append(strings[i]);
    }

    // and make sure it has the same attributes as before
    if ( m_hasFont )
    {
        // calling SetFont(m_font) would do nothing as the code would
        // notice that the font didn't change, so force it to believe
        // that it did
        wxFont font = m_font;
        m_font = wxNullFont;
        SetFont(font);
    }

    if ( m_hasFgCol )
    {
        wxColour colFg = m_foregroundColour;
        m_foregroundColour = wxNullColour;
        SetForegroundColour(colFg);
    }

    if ( m_hasBgCol )
    {
        wxColour colBg = m_backgroundColour;
        m_backgroundColour = wxNullColour;
        SetBackgroundColour(colBg);
    }
    else
    {
        SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
    }
}
Ejemplo n.º 21
0
bool CTransparentButton::Create(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name )
{
    bool bRetVal = wxButton::Create(parent, id, label, pos, size, style|wxTRANSPARENT_WINDOW, validator, name);

    SetBackgroundStyle(wxBG_STYLE_CUSTOM);
    SetBackgroundColour(parent->GetBackgroundColour());
    SetForegroundColour(parent->GetForegroundColour());

    return bRetVal;
}
Ejemplo n.º 22
0
bool CTransparentStaticBitmap::Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) {
    bool bRetVal = wxPanel::Create(parent, id, pos, size, style|wxTRANSPARENT_WINDOW, name);

    SetBackgroundColour(parent->GetBackgroundColour());
    SetForegroundColour(parent->GetForegroundColour());
    
    m_bitMap = wxBitmap(bitmap);

    return bRetVal;
}
Ejemplo n.º 23
0
void wxGenericHyperlinkCtrl::OnMotion(wxMouseEvent& event)
{
    wxRect textrc = GetLabelRect();

    if (textrc.Contains(event.GetPosition()))
    {
        SetCursor(wxCursor(wxCURSOR_HAND));
        SetForegroundColour(m_hoverColour);
        m_rollover = true;
        Refresh();
    }
    else if (m_rollover)
    {
        SetCursor(*wxSTANDARD_CURSOR);
        SetForegroundColour(!m_visited ? m_normalColour : m_visitedColour);
        m_rollover = false;
        Refresh();
    }
}
Ejemplo n.º 24
0
void FrameNotification::create(	wxString const& title,
								wxString const& message,
								wxBitmap const& bitmap,
								int	maxWidth)
{
	//SetMaxSize(wxSize(maxWidth, -1));
	
	//Création du titre et du message.
	_staticTextTitle = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize);
	_staticTextTitle->SetLabelMarkup("<big><b>"+title+"</b></big>");
	_staticTextMessage = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize);
	_staticTextMessage->SetLabelMarkup(message);
	
	//Création de la statice line.
	_staticLine = new wxStaticLine(this);
	
	//Créations du wxStaticBitmap
	_staticBitmap = nullptr;
	if(bitmap.IsOk())
	{
		_staticBitmap = new wxStaticBitmap(this, wxID_ANY, bitmap);
		maxWidth -= _staticBitmap->GetSize().GetWidth()+SIZE_BORDER;
	}
	
	//Wrap le TextMessage
	//_staticTextMessage->Wrap(maxWidth-5*SIZE_BORDER);
	
	//Mise en forme titre et du message avec un sizer.
	wxSizer* sizerNotification = new wxBoxSizer(wxVERTICAL);
	sizerNotification->Add(_staticTextTitle, 	0, wxEXPAND|wxLEFT, 		2*SIZE_BORDER);	
	sizerNotification->Add(_staticLine, 		0, wxEXPAND|wxTOP|wxBOTTOM,	SIZE_BORDER);	
	sizerNotification->Add(_staticTextMessage, 	0, wxEXPAND|wxLEFT, 		4*SIZE_BORDER);
	
	//Mise en forme du GUI avec un sizer.
	wxSizer* sizerMain = new wxBoxSizer(wxHORIZONTAL);
	if(_staticBitmap != nullptr)
		sizerMain->Add(_staticBitmap, 	0, wxALIGN_CENTER|	wxLEFT|wxBOTTOM|wxTOP, 	SIZE_BORDER);	
	sizerMain->Add(sizerNotification, 	0, 					wxRIGHT|wxBOTTOM|wxTOP,	SIZE_BORDER);
	SetSizerAndFit(sizerMain);
	
	SetMaxClientSize(GetSize());
	
	//Modification de des couleurs
	SetBackgroundColour(ManNotification::get().getColourBackground());
	SetForegroundColour(ManNotification::get().getColourText());
	
	//Bind
	Bind(wxEVT_TIMER, &FrameNotification::onTimeout, this);
	_staticTextTitle->Bind(wxEVT_LEFT_DOWN, &FrameNotification::onLeftDown, this);
	_staticLine->Bind(wxEVT_LEFT_DOWN, &FrameNotification::onLeftDown, this);
	_staticTextMessage->Bind(wxEVT_LEFT_DOWN, &FrameNotification::onLeftDown, this);
	if(_staticBitmap)
		_staticBitmap->Bind(wxEVT_LEFT_DOWN, &FrameNotification::onLeftDown, this);
	Bind(wxEVT_LEFT_DOWN, &FrameNotification::onLeftDown, this);
}
Ejemplo n.º 25
0
bool wxGenericHyperlinkCtrl::Create(wxWindow *parent, wxWindowID id,
                                    const wxString& label, const wxString& url, const wxPoint& pos,
                                    const wxSize& size, long style, const wxString& name)
{
    // do validation checks:
    CheckParams(label, url, style);

    if ((style & wxHL_ALIGN_LEFT) == 0)
        style |= wxFULL_REPAINT_ON_RESIZE;

    if (!wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name))
        return false;

    // set to non empty strings both the url and the label
    SetURL(url.empty() ? label : url);
    SetLabel(label.empty() ? url : label);

    m_rollover = false;
    m_clicking = false;
    m_visited = false;

    // colours
    m_normalColour = *wxBLUE;
    m_hoverColour = *wxRED;
    m_visitedColour = wxColour("#551a8b");
    SetForegroundColour(m_normalColour);

    // by default the font of an hyperlink control is underlined
    wxFont f = GetFont();
    f.SetUnderlined(true);
    SetFont(f);

    SetInitialSize(size);


    // connect our event handlers:
    // NOTE: since this class is the base class of the GTK+'s native implementation
    //       of wxHyperlinkCtrl, we cannot use the static macros in BEGIN/END_EVENT_TABLE
    //       blocks, otherwise the GTK+'s native impl of wxHyperlinkCtrl would not
    //       behave correctly (as we intercept events doing things which interfere
    //       with GTK+'s native handling):

    Connect( wxEVT_PAINT, wxPaintEventHandler(wxGenericHyperlinkCtrl::OnPaint) );
    Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler(wxGenericHyperlinkCtrl::OnLeaveWindow) );

    Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler(wxGenericHyperlinkCtrl::OnLeftDown) );
    Connect( wxEVT_LEFT_UP, wxMouseEventHandler(wxGenericHyperlinkCtrl::OnLeftUp) );
    Connect( wxEVT_RIGHT_UP, wxMouseEventHandler(wxGenericHyperlinkCtrl::OnRightUp) );
    Connect( wxEVT_MOTION, wxMouseEventHandler(wxGenericHyperlinkCtrl::OnMotion) );

    Connect( wxHYPERLINK_POPUP_COPY_ID, wxEVT_COMMAND_MENU_SELECTED,
             wxCommandEventHandler(wxGenericHyperlinkCtrl::OnPopUpCopy) );

    return true;
}
Ejemplo n.º 26
0
wxStaticLink::wxStaticLink(wxWindow* parent, const wxString& label, const wxString& url) : wxStaticText(parent, wxID_ANY, label)
{
    SetForegroundColour(*wxBLUE);
    wxFont font = GetFont();
    font.SetWeight(wxFONTWEIGHT_BOLD);
    font.SetUnderlined(true);
    SetFont(font);
    SetCursor(wxCursor(wxCURSOR_HAND));
    SetToolTip(url);
    m_url = url;
}
Ejemplo n.º 27
0
CScrolledTextBox::CScrolledTextBox( wxWindow* parent) :
    wxScrolledWindow( parent, ID_SGPROJECTDESCRIPTION, wxDefaultPosition, wxDefaultSize, wxVSCROLL)
{
    SetForegroundColour(*wxBLACK);

    m_TextSizer = new wxBoxSizer( wxVERTICAL );

    this->SetSizerAndFit( m_TextSizer );
    this->Layout();
    this->FitInside();
}
Ejemplo n.º 28
0
void PropertiesDialog::DisableSourcesControls()
{
    m_basePath->Disable();
    m_paths->Disable();
    for (auto c: m_paths->GetChildren())
        c->Disable();

    auto label = XRCCTRL(*this, "sources_path_label", wxStaticText);
    label->SetLabel(_("Please save the file first. This section cannot be edited until then."));
    label->SetForegroundColour(*wxRED);
}
Ejemplo n.º 29
0
ExplanationLabel::ExplanationLabel(wxWindow *parent, const wxString& label)
    : wxStaticText(parent, wxID_ANY, ""),
      m_text(label),
      m_wrapWidth(-1)
{
    m_text.Replace("\n", " ");
    SetLabel(m_text);

#if defined(__WXOSX__)
    SetWindowVariant(wxWINDOW_VARIANT_SMALL);
    SetForegroundColour(wxColour("#777777"));
#elif defined(__WXGTK__)
    SetWindowVariant(wxWINDOW_VARIANT_SMALL);
#else
    SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
#endif

    SetInitialSize(wxSize(10,10));
    Bind(wxEVT_SIZE, &ExplanationLabel::OnSize, this);
}
Ejemplo n.º 30
0
void wxHyperLink::OnLinkActivate (wxMouseEvent &WXUNUSED(event)) {
    m_Visited = TRUE;
    SetForegroundColour (m_VisitedColour);
    SetBackgroundColour (m_BackgroundColour);
    Refresh();
    if (m_URL.IsEmpty()) {
       ExecuteLink (GetLabel());
    }else{
       ExecuteLink (m_URL);
    }
}