// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
-
#ifndef __WXGRID_H__
#define __WXGRID_H__
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma interface "grid.h"
-#endif
-
#include "wx/hashmap.h"
#include "wx/panel.h"
#include "wx/scrolwin.h"
protected:
// set the text colours before drawing
- void SetTextColoursAndFont(wxGrid& grid,
- wxGridCellAttr& attr,
+ void SetTextColoursAndFont(const wxGrid& grid,
+ const wxGridCellAttr& attr,
wxDC& dc,
bool isSelected);
// calc the string extent for given string/font
- wxSize DoGetBestSize(wxGridCellAttr& attr,
+ wxSize DoGetBestSize(const wxGridCellAttr& attr,
wxDC& dc,
const wxString& text);
};
{ return new wxGridCellNumberRenderer; }
protected:
- wxString GetString(wxGrid& grid, int row, int col);
+ wxString GetString(const wxGrid& grid, int row, int col);
};
class WXDLLIMPEXP_ADV wxGridCellFloatRenderer : public wxGridCellStringRenderer
virtual wxGridCellRenderer *Clone() const;
protected:
- wxString GetString(wxGrid& grid, int row, int col);
+ wxString GetString(const wxGrid& grid, int row, int col);
private:
// formatting parameters
virtual void Reset();
virtual void StartingClick();
+ virtual void StartingKey(wxKeyEvent& event);
virtual wxGridCellEditor *Clone() const
{ return new wxGridCellBoolEditor; }
bool HasEditor() const { return m_editor != NULL; }
bool HasReadWriteMode() const { return m_isReadOnly != Unset; }
bool HasOverflowMode() const { return m_overflow != UnsetOverflow; }
+ bool HasSize() const { return m_sizeRows != 1 || m_sizeCols != 1; }
const wxColour& GetTextColour() const;
const wxColour& GetBackgroundColour() const;
void SetDefAttr(wxGridCellAttr* defAttr) { m_defGridAttr = defAttr; }
+protected:
+ // the dtor is private because only DecRef() can delete us
+ virtual ~wxGridCellAttr()
+ {
+ wxSafeDecRef(m_renderer);
+ wxSafeDecRef(m_editor);
+ }
+
private:
enum wxAttrReadMode
{
// the common part of all ctors
void Init(wxGridCellAttr *attrDefault = NULL);
- // the dtor is private because only DecRef() can delete us
- ~wxGridCellAttr()
- {
- wxSafeDecRef(m_renderer);
- wxSafeDecRef(m_editor);
- }
// the ref count - when it goes to 0, we die
size_t m_nRef;
//
void StringToLines( const wxString& value, wxArrayString& lines );
- void GetTextBoxSize( wxDC& dc,
+ void GetTextBoxSize( const wxDC& dc,
const wxArrayString& lines,
long *width, long *height );
// DecRef() must be called on the returned pointer, as usual
wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const;
-
+
// shortcuts for setting the column parameters
// set the format for the data in the column: default is string
void OnSize( wxSizeEvent& );
void OnKeyDown( wxKeyEvent& );
void OnKeyUp( wxKeyEvent& );
+ void OnChar( wxKeyEvent& );
void OnEraseBackground( wxEraseEvent& );
typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction)(wxGridEditorCreatedEvent&);
#define wxGridEventHandler(func) \
- (wxObjectEventFunction)wxStaticCastEvent(wxGridEventFunction, &func)
+ (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxGridEventFunction, &func)
#define wxGridSizeEventHandler(func) \
- (wxObjectEventFunction)wxStaticCastEvent(wxGridSizeEventFunction, &func)
+ (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxGridSizeEventFunction, &func)
#define wxGridRangeSelectEventHandler(func) \
- (wxObjectEventFunction)wxStaticCastEvent(wxGridRangeSelectEventFunction, &func)
+ (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxGridRangeSelectEventFunction, &func)
#define wxGridEditorCreatedEventHandler(func) \
- (wxObjectEventFunction)wxStaticCastEvent(wxGridEditorCreatedEventFunction, &func)
+ (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxGridEditorCreatedEventFunction, &func)
#define wx__DECLARE_GRIDEVT(evt, id, fn) \
wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridEventHandler(fn))