#include "wx/textfile.h"
#include "wx/spinctrl.h"
#include "wx/tokenzr.h"
+#include "wx/renderer.h"
#include "wx/grid.h"
#include "wx/generic/gridsel.h"
m_colBgOld = m_control->GetBackgroundColour();
m_control->SetBackgroundColour(attr->GetBackgroundColour());
- // Workaround for GTK+1 font setting problem on some platforms
+// Workaround for GTK+1 font setting problem on some platforms
#if !defined(__WXGTK__) || defined(__WXGTK20__)
m_fontOld = m_control->GetFont();
m_control->SetFont(attr->GetFont());
m_control->SetBackgroundColour(m_colBgOld);
m_colBgOld = wxNullColour;
}
-
- // Workaround for GTK+1 font setting problem on some platforms
+// Workaround for GTK+1 font setting problem on some platforms
#if !defined(__WXGTK__) || defined(__WXGTK20__)
if ( m_fontOld.Ok() )
{
default:
// accept 8 bit chars too if isprint() agrees
- if ( (keycode < 255) && (wxIsprint((wxChar)keycode)) )
+ if ( (keycode < 255) && (wxIsprint(keycode)) )
return true;
}
}
wxWindowID id,
wxEvtHandler* evtHandler)
{
+#if wxUSE_SPINCTRL
if ( HasRange() )
{
// create a spin ctrl
wxGridCellEditor::Create(parent, id, evtHandler);
}
else
+#endif
{
// just a text control
wxGridCellTextEditor::Create(parent, id, evtHandler);
}
}
+#if wxUSE_SPINCTRL
if ( HasRange() )
{
Spin()->SetValue((int)m_valueOld);
Spin()->SetFocus();
}
else
+#endif
{
DoBeginEdit(GetString());
}
long value = 0;
wxString text;
+#if wxUSE_SPINCTRL
if ( HasRange() )
{
value = Spin()->GetValue();
text = wxString::Format(wxT("%ld"), value);
}
else
+#endif
{
text = Text()->GetValue();
changed = (text.empty() || text.ToLong(&value)) && (value != m_valueOld);
void wxGridCellNumberEditor::Reset()
{
+#if wxUSE_SPINCTRL
if ( HasRange() )
{
Spin()->SetValue((int)m_valueOld);
}
else
+#endif
{
DoReset(GetString());
}
return true;
default:
- if ( (keycode < 128) && wxIsdigit((wxChar)keycode) )
+ if ( (keycode < 128) && wxIsdigit(keycode) )
return true;
}
}
if ( !HasRange() )
{
int keycode = event.GetKeyCode();
- if ( wxIsdigit((wxChar)keycode) || keycode == '+' || keycode == '-'
+ if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-'
|| keycode == WXK_NUMPAD0
|| keycode == WXK_NUMPAD1
|| keycode == WXK_NUMPAD2
// return the value in the spin control if it is there (the text control otherwise)
wxString wxGridCellNumberEditor::GetValue() const
{
- wxString s;
+ wxString s;
- if( HasRange() )
- {
- long value = Spin()->GetValue();
- s.Printf(wxT("%ld"), value);
- }
- else
- {
- s = Text()->GetValue();
- }
- return s;
+#if wxUSE_SPINCTRL
+ if( HasRange() )
+ {
+ long value = Spin()->GetValue();
+ s.Printf(wxT("%ld"), value);
+ }
+ else
+#endif
+ {
+ s = Text()->GetValue();
+ }
+
+ return s;
}
// ----------------------------------------------------------------------------
wxString strbuf(tmpbuf, *wxConvCurrent);
bool is_decimal_point = ( strbuf ==
wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER) );
- if ( wxIsdigit((wxChar)keycode) || keycode == '+' || keycode == '-'
+ if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-'
|| is_decimal_point
|| keycode == WXK_NUMPAD0
|| keycode == WXK_NUMPAD1
( strbuf == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT,
wxLOCALE_CAT_NUMBER) );
if ( (keycode < 128) &&
- (wxIsdigit((wxChar)keycode) || tolower(keycode) == 'e' ||
+ (wxIsdigit(keycode) || tolower(keycode) == 'e' ||
is_decimal_point || keycode == '+' || keycode == '-') )
return true;
}
int client_width = 0;
GetClientSize( &client_width, &client_height );
+#if __WXGTK__
+ wxRect rect;
+ rect.SetX( 1 );
+ rect.SetY( 1 );
+ rect.SetWidth( client_width - 2 );
+ rect.SetHeight( client_height - 2 );
+
+ wxRendererNative::Get().DrawHeaderButton( this, dc, rect, 0 );
+#else
dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW),1, wxSOLID) );
dc.DrawLine( client_width-1, client_height-1, client_width-1, 0 );
dc.DrawLine( client_width-1, client_height-1, 0, client_height-1 );
dc.SetPen( *wxWHITE_PEN );
dc.DrawLine( 1, 1, client_width-1, 1 );
dc.DrawLine( 1, 1, 1, client_height-1 );
+#endif
}
if ( GetRowHeight(row) <= 0 )
return;
+ wxRect rect;
+#ifdef __WXGTK__
+ rect.SetX( 1 );
+ rect.SetY( GetRowTop(row) + 1 );
+ rect.SetWidth( m_rowLabelWidth - 2 );
+ rect.SetHeight( GetRowHeight(row) - 2 );
+
+ CalcScrolledPosition( 0, rect.y, NULL, &rect.y );
+
+ wxWindowDC *win_dc = (wxWindowDC*) &dc;
+
+ wxRendererNative::Get().DrawHeaderButton( win_dc->m_owner, dc, rect, 0 );
+#else
int rowTop = GetRowTop(row),
rowBottom = GetRowBottom(row) - 1;
dc.SetPen( *wxWHITE_PEN );
dc.DrawLine( 1, rowTop, 1, rowBottom );
dc.DrawLine( 1, rowTop, m_rowLabelWidth-1, rowTop );
-
+#endif
dc.SetBackgroundMode( wxTRANSPARENT );
dc.SetTextForeground( GetLabelTextColour() );
dc.SetFont( GetLabelFont() );
int hAlign, vAlign;
GetRowLabelAlignment( &hAlign, &vAlign );
- wxRect rect;
rect.SetX( 2 );
rect.SetY( GetRowTop(row) + 2 );
rect.SetWidth( m_rowLabelWidth - 4 );
if ( GetColWidth(col) <= 0 )
return;
- int colLeft = GetColLeft(col),
- colRight = GetColRight(col) - 1;
+ int colLeft = GetColLeft(col);
+
+ wxRect rect;
+#ifdef __WXGTK__
+ rect.SetX( colLeft + 1 );
+ rect.SetY( 1 );
+ rect.SetWidth( GetColWidth(col) - 2 );
+ rect.SetHeight( m_colLabelHeight - 2 );
+
+ wxWindowDC *win_dc = (wxWindowDC*) &dc;
+
+ wxRendererNative::Get().DrawHeaderButton( win_dc->m_owner, dc, rect, 0 );
+#else
+ int colRight = GetColRight(col) - 1;
dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW),1, wxSOLID) );
dc.DrawLine( colRight, 0,
dc.SetPen( *wxWHITE_PEN );
dc.DrawLine( colLeft, 1, colLeft, m_colLabelHeight-1 );
dc.DrawLine( colLeft, 1, colRight, 1 );
-
+#endif
dc.SetBackgroundMode( wxTRANSPARENT );
dc.SetTextForeground( GetLabelTextColour() );
dc.SetFont( GetLabelFont() );
GetColLabelAlignment( &hAlign, &vAlign );
orient = GetColLabelTextOrientation();
- wxRect rect;
rect.SetX( colLeft + 2 );
rect.SetY( 2 );
rect.SetWidth( GetColWidth(col) - 4 );