Example #1
0
void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
{
    int leftMargin = 2;
    int w, h ;
    GetSize( &w , &h ) ;
    wxRect rect;
    GetFieldRect(i, rect);
    
    if ( !MacIsReallyHilited()  )
    {
        dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
    }
    
    wxString text(GetStatusText(i));
    
    long x, y;
    
    dc.GetTextExtent(text, &x, &y);
    
    int xpos = rect.x + leftMargin + 1 ;
    int ypos = 1 ;
    
    if ( MacGetTopLevelWindow()->MacGetMetalAppearance()  )
        ypos++ ;
        
    dc.SetClippingRegion(rect.x, 0, rect.width, h);
    
    dc.DrawText(text, xpos, ypos);
    
    dc.DestroyClippingRegion();
}
Example #2
0
void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event))
{
    wxPaintDC dc(this);
    dc.Clear();

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

    // Notice that wxOSXGetKeyWindow (aka [NSApp keyWindow] used below is
    // subtly different from IsActive() (aka [NSWindow iskeyWindow]): the
    // former remains non-NULL if another application shows a temporary
    // floating window or a status icon's menu is used. That's what we want: in
    // that case, statusbar appearance shouldn't change. It also shouldn't
    // change if a window-modal sheet attached to this window is key.
    wxTopLevelWindow *tlw = wxDynamicCast(MacGetTopLevelWindow(), wxTopLevelWindow);
    wxNonOwnedWindow* directKeyWindow = wxNonOwnedWindow::GetFromWXWindow(wxOSXGetKeyWindow());
    wxWindow *keyWindow = directKeyWindow ? directKeyWindow->MacGetTopLevelWindow() : NULL;
    while ( keyWindow && keyWindow != tlw )
    {
        wxDialog *dlg = wxDynamicCast(keyWindow, wxDialog);
        if ( dlg && dlg->GetModality() == wxDIALOG_MODALITY_WINDOW_MODAL )
            keyWindow = dlg->GetParent();
        else
            break;
    }

    if ( tlw == keyWindow )
    {
        dc.GradientFillLinear(dc.GetSize(), m_bgActiveFrom, m_bgActiveTo, wxBOTTOM);

        // Finder statusbar border color
        dc.SetPen(wxPen(m_borderActive, 2, wxPENSTYLE_SOLID));
        dc.SetTextForeground(m_textActive);
    }
    else
    {
        // Finder statusbar border color
        dc.SetPen(wxPen(m_borderInactive, 2, wxPENSTYLE_SOLID));
        dc.SetTextForeground(m_textInactive);
    }

    dc.DrawLine(0, 0, w, 0);

    if ( GetFont().IsOk() )
        dc.SetFont(GetFont());
    dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);

    // compute char height only once for all panes:
    int textHeight = dc.GetCharHeight();

    for ( size_t i = 0; i < m_panes.GetCount(); i ++ )
        DrawField(dc, i, textHeight);
}
Example #3
0
void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event))
{
    wxPaintDC dc(this);
    dc.Clear();

    int major, minor;
    wxGetOsVersion( &major, &minor );
    int w, h;
    GetSize( &w, &h );

    if ( MacIsReallyHilited() )
    {
        wxPen white( *wxWHITE , 1 , wxSOLID );
        if (major >= 10)
        {
            // Finder statusbar border color: (Project Builder similar is 9B9B9B)
            if ( MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL )
                dc.SetPen(wxPen(wxColour(0x40, 0x40, 0x40), 1, wxSOLID));
            else
                dc.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID));
        }
        else
        {
            wxPen black( *wxBLACK , 1 , wxSOLID );
            dc.SetPen(black);
        }

        dc.DrawLine(0, 0, w, 0);
        dc.SetPen(white);
        dc.DrawLine(0, 1, w, 1);
    }
    else
    {
        if (major >= 10)
            // Finder statusbar border color: (Project Builder similar is 9B9B9B)
            dc.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID));
        else
            dc.SetPen(wxPen(wxColour(0x80, 0x80, 0x80), 1, wxSOLID));

        dc.DrawLine(0, 0, w, 0);
    }

    if ( GetFont().IsOk() )
        dc.SetFont(GetFont());
    dc.SetBackgroundMode(wxTRANSPARENT);

    // compute char height only once for all panes:
    int textHeight = dc.GetCharHeight();

    for ( size_t i = 0; i < m_panes.GetCount(); i ++ )
        DrawField(dc, i, textHeight);
}
Example #4
0
void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
{
  	wxPaintDC dc(this);
  	dc.Clear() ;

    int major,minor;
    wxGetOsVersion( &major, &minor );
    int w, h ;
    GetSize( &w , &h ) ;

	if ( MacIsReallyHilited() )
	{
		wxPen white( *wxWHITE , 1 , wxSOLID ) ;
        if (major >= 10 ) 
        {
            //Finder statusbar border color: (Project builder similar is 9B9B9B)
            if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
                dc.SetPen(wxPen(wxColour(0x40,40,40) ,1,wxSOLID)) ;
            else
                dc.SetPen(wxPen(wxColour(0xB1,0xB1,0xB1),1,wxSOLID));  
        }
        else
        {
            wxPen black( *wxBLACK , 1 , wxSOLID ) ;
            dc.SetPen(black);
    	}
		dc.DrawLine(0, 0 ,
		       w , 0);
		dc.SetPen(white);
		dc.DrawLine(0, 1 ,
		       w , 1);
	}
	else
	{
        if (major >= 10) 
            //Finder statusbar border color: (Project builder similar is 9B9B9B)
            dc.SetPen(wxPen(wxColour(0xB1,0xB1,0xB1),1,wxSOLID)); 
        else
            dc.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID));

		dc.DrawLine(0, 0 ,
		       w , 0);
	}

	int i;
	if ( GetFont().Ok() )
		dc.SetFont(GetFont());
	dc.SetBackgroundMode(wxTRANSPARENT);

	for ( i = 0; i < m_nFields; i ++ )
		DrawField(dc, i);
}
Example #5
0
void wxStatusBarMac::DrawFieldText(wxDC& dc, const wxRect& rect, int i, int textHeight)
{
    int w, h;
    GetSize( &w , &h );

    wxString text(GetStatusText( i ));

    int xpos = rect.x + wxFIELD_TEXT_MARGIN + 1;
    int ypos = 2 + (rect.height - textHeight) / 2;

    if ( MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL )
        ypos++;

    dc.SetClippingRegion(rect.x, 0, rect.width, h);
    dc.DrawText(text, xpos, ypos);
    dc.DestroyClippingRegion();
}
Example #6
0
void wxStatusBarMac::DrawFieldText(wxDC& dc, const wxRect& rect, int i, int WXUNUSED(textHeight))
{
    int w, h;
    GetSize( &w , &h );

    if ( !MacIsReallyHilited() )
        dc.SetTextForeground( wxColour( 0x80, 0x80, 0x80 ) );

    wxString text(GetStatusText( i ));

    /*wxCoord x, y;
    dc.GetTextExtent(text, &x, &y);    -- seems unused (FM)*/

    int xpos = rect.x + wxFIELD_TEXT_MARGIN + 1;
    int ypos = 1;

    if ( MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL )
        ypos++;

    dc.SetClippingRegion(rect.x, 0, rect.width, h);
    dc.DrawText(text, xpos, ypos);
    dc.DestroyClippingRegion();
}
Example #7
0
void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event))
{
    wxPaintDC dc(this);
    dc.Clear();

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

    wxTopLevelWindow *tlw = wxDynamicCast(MacGetTopLevelWindow(), wxTopLevelWindow);
    if ( tlw && tlw->IsActive() )
    {
        dc.GradientFillLinear(dc.GetSize(), m_bgActiveFrom, m_bgActiveTo, wxBOTTOM);

        // Finder statusbar border color
        dc.SetPen(wxPen(m_borderActive, 2, wxPENSTYLE_SOLID));
        dc.SetTextForeground(m_textActive);
    }
    else
    {
        // Finder statusbar border color
        dc.SetPen(wxPen(m_borderInactive, 2, wxPENSTYLE_SOLID));
        dc.SetTextForeground(m_textInactive);
    }

    dc.DrawLine(0, 0, w, 0);

    if ( GetFont().IsOk() )
        dc.SetFont(GetFont());
    dc.SetBackgroundMode(wxTRANSPARENT);

    // compute char height only once for all panes:
    int textHeight = dc.GetCharHeight();

    for ( size_t i = 0; i < m_panes.GetCount(); i ++ )
        DrawField(dc, i, textHeight);
}