re-checking in files in Unix mode

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5827 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-02-03 13:30:28 +00:00
parent 8f0b51916e
commit 60ff3b9976
2 changed files with 461 additions and 437 deletions

View File

@@ -63,8 +63,6 @@ class WXDLLEXPORT wxGrid;
class WXDLLEXPORT wxGridTableBase : public wxObject class WXDLLEXPORT wxGridTableBase : public wxObject
{ {
wxGrid * m_view;
public: public:
wxGridTableBase(); wxGridTableBase();
virtual ~wxGridTableBase(); virtual ~wxGridTableBase();
@@ -95,6 +93,9 @@ class WXDLLEXPORT wxGridTableBase : public wxObject
virtual void SetRowLabelValue( int WXUNUSED(row), const wxString& ) {} virtual void SetRowLabelValue( int WXUNUSED(row), const wxString& ) {}
virtual void SetColLabelValue( int WXUNUSED(col), const wxString& ) {} virtual void SetColLabelValue( int WXUNUSED(col), const wxString& ) {}
private:
wxGrid * m_view;
DECLARE_ABSTRACT_CLASS( wxGridTableBase ); DECLARE_ABSTRACT_CLASS( wxGridTableBase );
}; };
@@ -102,7 +103,8 @@ class WXDLLEXPORT wxGridTableBase : public wxObject
// IDs for messages sent from grid table to view // IDs for messages sent from grid table to view
// //
enum wxGridTableRequest { enum wxGridTableRequest
{
wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000, wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000,
wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES, wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES,
wxGRIDTABLE_NOTIFY_ROWS_INSERTED, wxGRIDTABLE_NOTIFY_ROWS_INSERTED,
@@ -115,11 +117,6 @@ enum wxGridTableRequest {
class WXDLLEXPORT wxGridTableMessage class WXDLLEXPORT wxGridTableMessage
{ {
wxGridTableBase *m_table;
int m_id;
int m_comInt1;
int m_comInt2;
public: public:
wxGridTableMessage(); wxGridTableMessage();
wxGridTableMessage( wxGridTableBase *table, int id, wxGridTableMessage( wxGridTableBase *table, int id,
@@ -134,6 +131,12 @@ class WXDLLEXPORT wxGridTableMessage
int GetCommandInt() { return m_comInt1; } int GetCommandInt() { return m_comInt1; }
void SetCommandInt2( int comInt2 ) { m_comInt2 = comInt2; } void SetCommandInt2( int comInt2 ) { m_comInt2 = comInt2; }
int GetCommandInt2() { return m_comInt2; } int GetCommandInt2() { return m_comInt2; }
private:
wxGridTableBase *m_table;
int m_id;
int m_comInt1;
int m_comInt2;
}; };
@@ -154,14 +157,6 @@ WX_DECLARE_EXPORTED_OBJARRAY(wxArrayString, wxGridStringArray);
class WXDLLEXPORT wxGridStringTable : public wxGridTableBase class WXDLLEXPORT wxGridStringTable : public wxGridTableBase
{ {
wxGridStringArray m_data;
// These only get used if you set your own labels, otherwise the
// GetRow/ColLabelValue functions return wxGridTableBase defaults
//
wxArrayString m_rowLabels;
wxArrayString m_colLabels;
public: public:
wxGridStringTable(); wxGridStringTable();
wxGridStringTable( int numRows, int numCols ); wxGridStringTable( int numRows, int numCols );
@@ -190,6 +185,15 @@ class WXDLLEXPORT wxGridStringTable : public wxGridTableBase
wxString GetRowLabelValue( int row ); wxString GetRowLabelValue( int row );
wxString GetColLabelValue( int col ); wxString GetColLabelValue( int col );
private:
wxGridStringArray m_data;
// These only get used if you set your own labels, otherwise the
// GetRow/ColLabelValue functions return wxGridTableBase defaults
//
wxArrayString m_rowLabels;
wxArrayString m_colLabels;
DECLARE_DYNAMIC_CLASS( wxGridStringTable ) DECLARE_DYNAMIC_CLASS( wxGridStringTable )
}; };
@@ -203,9 +207,6 @@ class WXDLLEXPORT wxGridStringTable : public wxGridTableBase
class WXDLLEXPORT wxGridCellCoords class WXDLLEXPORT wxGridCellCoords
{ {
long m_row;
long m_col;
public: public:
wxGridCellCoords() { m_row = m_col = -1; } wxGridCellCoords() { m_row = m_col = -1; }
wxGridCellCoords( int r, int c ) { m_row = r; m_col = c; } wxGridCellCoords( int r, int c ) { m_row = r; m_col = c; }
@@ -242,6 +243,10 @@ class WXDLLEXPORT wxGridCellCoords
{ {
return (m_row == -1 && m_col == -1 ); return (m_row == -1 && m_col == -1 );
} }
private:
long m_row;
long m_col;
}; };
@@ -262,16 +267,6 @@ WX_DECLARE_EXPORTED_OBJARRAY(wxGridCellCoords, wxGridCellCoordsArray);
class WXDLLEXPORT wxGridTextCtrl : public wxTextCtrl class WXDLLEXPORT wxGridTextCtrl : public wxTextCtrl
{ {
wxGrid *m_grid;
// TRUE for controls placed over cells,
// FALSE for a control on a grid control panel
bool m_isCellControl;
wxString startValue;
void OnKeyDown( wxKeyEvent& );
public: public:
wxGridTextCtrl() {} wxGridTextCtrl() {}
wxGridTextCtrl( wxWindow *, wxGridTextCtrl( wxWindow *,
@@ -286,6 +281,17 @@ class WXDLLEXPORT wxGridTextCtrl : public wxTextCtrl
void SetStartValue( const wxString& ); void SetStartValue( const wxString& );
wxString GetStartValue() { return startValue; } wxString GetStartValue() { return startValue; }
private:
wxGrid *m_grid;
// TRUE for controls placed over cells,
// FALSE for a control on a grid control panel
bool m_isCellControl;
wxString startValue;
void OnKeyDown( wxKeyEvent& );
DECLARE_DYNAMIC_CLASS( wxGridTextCtrl ) DECLARE_DYNAMIC_CLASS( wxGridTextCtrl )
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -293,17 +299,18 @@ class WXDLLEXPORT wxGridTextCtrl : public wxTextCtrl
class WXDLLEXPORT wxGridRowLabelWindow : public wxWindow class WXDLLEXPORT wxGridRowLabelWindow : public wxWindow
{ {
public:
wxGridRowLabelWindow() { m_owner = (wxGrid *)NULL; }
wxGridRowLabelWindow( wxGrid *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size );
private:
wxGrid *m_owner; wxGrid *m_owner;
void OnPaint( wxPaintEvent& event ); void OnPaint( wxPaintEvent& event );
void OnMouseEvent( wxMouseEvent& event ); void OnMouseEvent( wxMouseEvent& event );
void OnKeyDown( wxKeyEvent& event ); void OnKeyDown( wxKeyEvent& event );
public:
wxGridRowLabelWindow() {}
wxGridRowLabelWindow( wxGrid *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size );
DECLARE_DYNAMIC_CLASS(wxGridRowLabelWindow) DECLARE_DYNAMIC_CLASS(wxGridRowLabelWindow)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -311,17 +318,18 @@ public:
class WXDLLEXPORT wxGridColLabelWindow : public wxWindow class WXDLLEXPORT wxGridColLabelWindow : public wxWindow
{ {
public:
wxGridColLabelWindow() { m_owner = (wxGrid *)NULL; }
wxGridColLabelWindow( wxGrid *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size );
private:
wxGrid *m_owner; wxGrid *m_owner;
void OnPaint( wxPaintEvent &event ); void OnPaint( wxPaintEvent &event );
void OnMouseEvent( wxMouseEvent& event ); void OnMouseEvent( wxMouseEvent& event );
void OnKeyDown( wxKeyEvent& event ); void OnKeyDown( wxKeyEvent& event );
public:
wxGridColLabelWindow() {}
wxGridColLabelWindow( wxGrid *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size );
DECLARE_DYNAMIC_CLASS(wxGridColLabelWindow) DECLARE_DYNAMIC_CLASS(wxGridColLabelWindow)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -329,16 +337,17 @@ public:
class WXDLLEXPORT wxGridCornerLabelWindow : public wxWindow class WXDLLEXPORT wxGridCornerLabelWindow : public wxWindow
{ {
public:
wxGridCornerLabelWindow() { m_owner = (wxGrid *)NULL; }
wxGridCornerLabelWindow( wxGrid *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size );
private:
wxGrid *m_owner; wxGrid *m_owner;
void OnMouseEvent( wxMouseEvent& event ); void OnMouseEvent( wxMouseEvent& event );
void OnKeyDown( wxKeyEvent& event ); void OnKeyDown( wxKeyEvent& event );
public:
wxGridCornerLabelWindow() {}
wxGridCornerLabelWindow( wxGrid *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size );
DECLARE_DYNAMIC_CLASS(wxGridCornerLabelWindow) DECLARE_DYNAMIC_CLASS(wxGridCornerLabelWindow)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -347,16 +356,14 @@ class WXDLLEXPORT wxGridCornerLabelWindow : public wxWindow
class WXDLLEXPORT wxGridWindow : public wxPanel class WXDLLEXPORT wxGridWindow : public wxPanel
{ {
wxGrid *m_owner;
wxGridRowLabelWindow *m_rowLabelWin;
wxGridColLabelWindow *m_colLabelWin;
void OnPaint( wxPaintEvent &event );
void OnMouseEvent( wxMouseEvent& event );
void OnKeyDown( wxKeyEvent& );
public: public:
wxGridWindow() {} wxGridWindow()
{
m_owner = (wxGrid *)NULL;
m_rowLabelWin = (wxGridRowLabelWindow *)NULL;
m_colLabelWin = (wxGridColLabelWindow *)NULL;
}
wxGridWindow( wxGrid *parent, wxGridWindow( wxGrid *parent,
wxGridRowLabelWindow *rowLblWin, wxGridRowLabelWindow *rowLblWin,
wxGridColLabelWindow *colLblWin, wxGridColLabelWindow *colLblWin,
@@ -365,6 +372,15 @@ public:
void ScrollWindow( int dx, int dy, const wxRect *rect ); void ScrollWindow( int dx, int dy, const wxRect *rect );
private:
wxGrid *m_owner;
wxGridRowLabelWindow *m_rowLabelWin;
wxGridColLabelWindow *m_colLabelWin;
void OnPaint( wxPaintEvent &event );
void OnMouseEvent( wxMouseEvent& event );
void OnKeyDown( wxKeyEvent& );
DECLARE_DYNAMIC_CLASS(wxGridWindow) DECLARE_DYNAMIC_CLASS(wxGridWindow)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -373,126 +389,6 @@ public:
class WXDLLEXPORT wxGrid : public wxScrolledWindow class WXDLLEXPORT wxGrid : public wxScrolledWindow
{ {
protected:
bool m_created;
wxGridWindow *m_gridWin;
wxGridRowLabelWindow *m_rowLabelWin;
wxGridColLabelWindow *m_colLabelWin;
wxGridCornerLabelWindow *m_cornerLabelWin;
wxBoxSizer *m_mainSizer;
wxBoxSizer *m_topSizer;
wxBoxSizer *m_middleSizer;
wxGridTableBase *m_table;
int m_left;
int m_top;
int m_right;
int m_bottom;
int m_numRows;
int m_numCols;
wxGridCellCoords m_currentCellCoords;
wxGridCellCoords m_selectedTopLeft;
wxGridCellCoords m_selectedBottomRight;
int m_defaultRowHeight;
wxArrayInt m_rowHeights;
wxArrayInt m_rowBottoms;
int m_defaultColWidth;
wxArrayInt m_colWidths;
wxArrayInt m_colRights;
int m_rowLabelWidth;
int m_colLabelHeight;
wxColour m_labelBackgroundColour;
wxColour m_labelTextColour;
wxFont m_labelFont;
int m_rowLabelHorizAlign;
int m_rowLabelVertAlign;
int m_colLabelHorizAlign;
int m_colLabelVertAlign;
bool m_defaultRowLabelValues;
bool m_defaultColLabelValues;
wxColour m_gridLineColour;
bool m_gridLinesEnabled;
wxFont m_defaultCellFont;
wxGridCellCoordsArray m_cellsExposed;
wxArrayInt m_rowsExposed;
wxArrayInt m_colsExposed;
wxArrayInt m_rowLabelsExposed;
wxArrayInt m_colLabelsExposed;
bool m_inOnKeyDown;
int m_batchCount;
int m_cursorMode;
enum { WXGRID_CURSOR_DEFAULT,
WXGRID_CURSOR_SELECT_CELL,
WXGRID_CURSOR_RESIZE_ROW,
WXGRID_CURSOR_RESIZE_COL,
WXGRID_CURSOR_SELECT_ROW,
WXGRID_CURSOR_SELECT_COL
};
int m_dragLastPos;
int m_dragRowOrCol;
bool m_isDragging;
wxGridCellCoords m_selectionStart;
wxCursor m_rowResizeCursor;
wxCursor m_colResizeCursor;
bool m_editable; // applies to whole grid
int m_editCtrlType; // for current cell
wxWindow* m_cellEditCtrl;
bool m_cellEditCtrlEnabled;
void Create();
void Init();
void CalcDimensions();
bool Redimension( wxGridTableMessage& );
bool SendEvent( const wxEventType,
int row, int col,
wxMouseEvent& );
bool SendEvent( const wxEventType,
int row, int col );
void OnPaint( wxPaintEvent& );
void OnSize( wxSizeEvent& );
void OnKeyDown( wxKeyEvent& );
void SetCurrentCell( const wxGridCellCoords& coords );
void SetCurrentCell( int row, int col )
{ SetCurrentCell( wxGridCellCoords(row, col) ); }
// ------ functions to get/send data (see also public functions)
//
bool GetModelValues();
bool SetModelValues();
////////////////////// Public section ////////////////////
public: public:
wxGrid() wxGrid()
{ Create(); } { Create(); }
@@ -937,6 +833,126 @@ class WXDLLEXPORT wxGrid : public wxScrolledWindow
wxGRID_CHOICE, wxGRID_CHOICE,
wxGRID_COMBOBOX }; wxGRID_COMBOBOX };
protected:
bool m_created;
wxGridWindow *m_gridWin;
wxGridRowLabelWindow *m_rowLabelWin;
wxGridColLabelWindow *m_colLabelWin;
wxGridCornerLabelWindow *m_cornerLabelWin;
wxBoxSizer *m_mainSizer;
wxBoxSizer *m_topSizer;
wxBoxSizer *m_middleSizer;
wxGridTableBase *m_table;
int m_left;
int m_top;
int m_right;
int m_bottom;
int m_numRows;
int m_numCols;
wxGridCellCoords m_currentCellCoords;
wxGridCellCoords m_selectedTopLeft;
wxGridCellCoords m_selectedBottomRight;
int m_defaultRowHeight;
wxArrayInt m_rowHeights;
wxArrayInt m_rowBottoms;
int m_defaultColWidth;
wxArrayInt m_colWidths;
wxArrayInt m_colRights;
int m_rowLabelWidth;
int m_colLabelHeight;
wxColour m_labelBackgroundColour;
wxColour m_labelTextColour;
wxFont m_labelFont;
int m_rowLabelHorizAlign;
int m_rowLabelVertAlign;
int m_colLabelHorizAlign;
int m_colLabelVertAlign;
bool m_defaultRowLabelValues;
bool m_defaultColLabelValues;
wxColour m_gridLineColour;
bool m_gridLinesEnabled;
wxFont m_defaultCellFont;
wxGridCellCoordsArray m_cellsExposed;
wxArrayInt m_rowsExposed;
wxArrayInt m_colsExposed;
wxArrayInt m_rowLabelsExposed;
wxArrayInt m_colLabelsExposed;
bool m_inOnKeyDown;
int m_batchCount;
int m_cursorMode;
enum { WXGRID_CURSOR_DEFAULT,
WXGRID_CURSOR_SELECT_CELL,
WXGRID_CURSOR_RESIZE_ROW,
WXGRID_CURSOR_RESIZE_COL,
WXGRID_CURSOR_SELECT_ROW,
WXGRID_CURSOR_SELECT_COL
};
int m_dragLastPos;
int m_dragRowOrCol;
bool m_isDragging;
wxGridCellCoords m_selectionStart;
wxCursor m_rowResizeCursor;
wxCursor m_colResizeCursor;
bool m_editable; // applies to whole grid
int m_editCtrlType; // for current cell
wxWindow* m_cellEditCtrl;
bool m_cellEditCtrlEnabled;
void Create();
void Init();
void CalcDimensions();
bool Redimension( wxGridTableMessage& );
bool SendEvent( const wxEventType,
int row, int col,
wxMouseEvent& );
bool SendEvent( const wxEventType,
int row, int col );
void OnPaint( wxPaintEvent& );
void OnSize( wxSizeEvent& );
void OnKeyDown( wxKeyEvent& );
void SetCurrentCell( const wxGridCellCoords& coords );
void SetCurrentCell( int row, int col )
{ SetCurrentCell( wxGridCellCoords(row, col) ); }
// ------ functions to get/send data (see also public functions)
//
bool GetModelValues();
bool SetModelValues();
////////////////////// Public section ////////////////////
DECLARE_DYNAMIC_CLASS( wxGrid ) DECLARE_DYNAMIC_CLASS( wxGrid )
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
@@ -952,16 +968,6 @@ class WXDLLEXPORT wxGrid : public wxScrolledWindow
class WXDLLEXPORT wxGridEvent : public wxNotifyEvent class WXDLLEXPORT wxGridEvent : public wxNotifyEvent
{ {
protected:
int m_row;
int m_col;
int m_x;
int m_y;
bool m_control;
bool m_meta;
bool m_shift;
bool m_alt;
public: public:
wxGridEvent() wxGridEvent()
: wxNotifyEvent(), m_row(-1), m_col(-1), m_x(-1), m_y(-1), : wxNotifyEvent(), m_row(-1), m_col(-1), m_x(-1), m_y(-1),
@@ -981,14 +987,9 @@ class WXDLLEXPORT wxGridEvent : public wxNotifyEvent
bool ShiftDown() { return m_shift; } bool ShiftDown() { return m_shift; }
bool AltDown() { return m_alt; } bool AltDown() { return m_alt; }
DECLARE_DYNAMIC_CLASS(wxGridEvent)
};
class WXDLLEXPORT wxGridSizeEvent : public wxNotifyEvent
{
protected: protected:
int m_rowOrCol; int m_row;
int m_col;
int m_x; int m_x;
int m_y; int m_y;
bool m_control; bool m_control;
@@ -996,6 +997,12 @@ class WXDLLEXPORT wxGridSizeEvent : public wxNotifyEvent
bool m_shift; bool m_shift;
bool m_alt; bool m_alt;
DECLARE_DYNAMIC_CLASS(wxGridEvent)
};
class WXDLLEXPORT wxGridSizeEvent : public wxNotifyEvent
{
public: public:
wxGridSizeEvent() wxGridSizeEvent()
: wxNotifyEvent(), m_rowOrCol(-1), m_x(-1), m_y(-1), : wxNotifyEvent(), m_rowOrCol(-1), m_x(-1), m_y(-1),
@@ -1014,20 +1021,21 @@ class WXDLLEXPORT wxGridSizeEvent : public wxNotifyEvent
bool ShiftDown() { return m_shift; } bool ShiftDown() { return m_shift; }
bool AltDown() { return m_alt; } bool AltDown() { return m_alt; }
protected:
int m_rowOrCol;
int m_x;
int m_y;
bool m_control;
bool m_meta;
bool m_shift;
bool m_alt;
DECLARE_DYNAMIC_CLASS(wxGridSizeEvent) DECLARE_DYNAMIC_CLASS(wxGridSizeEvent)
}; };
class WXDLLEXPORT wxGridRangeSelectEvent : public wxNotifyEvent class WXDLLEXPORT wxGridRangeSelectEvent : public wxNotifyEvent
{ {
protected:
wxGridCellCoords m_topLeft;
wxGridCellCoords m_bottomRight;
bool m_control;
bool m_meta;
bool m_shift;
bool m_alt;
public: public:
wxGridRangeSelectEvent() wxGridRangeSelectEvent()
: wxNotifyEvent() : wxNotifyEvent()
@@ -1057,6 +1065,14 @@ class WXDLLEXPORT wxGridRangeSelectEvent : public wxNotifyEvent
bool ShiftDown() { return m_shift; } bool ShiftDown() { return m_shift; }
bool AltDown() { return m_alt; } bool AltDown() { return m_alt; }
protected:
wxGridCellCoords m_topLeft;
wxGridCellCoords m_bottomRight;
bool m_control;
bool m_meta;
bool m_shift;
bool m_alt;
DECLARE_DYNAMIC_CLASS(wxGridRangeSelectEvent) DECLARE_DYNAMIC_CLASS(wxGridRangeSelectEvent)
}; };

View File

@@ -979,8 +979,16 @@ void wxGrid::Init()
m_rowLabelWidth = WXGRID_DEFAULT_ROW_LABEL_WIDTH; m_rowLabelWidth = WXGRID_DEFAULT_ROW_LABEL_WIDTH;
m_colLabelHeight = WXGRID_DEFAULT_COL_LABEL_HEIGHT; m_colLabelHeight = WXGRID_DEFAULT_COL_LABEL_HEIGHT;
if ( m_rowLabelWin )
{
m_labelBackgroundColour = m_rowLabelWin->GetBackgroundColour(); m_labelBackgroundColour = m_rowLabelWin->GetBackgroundColour();
m_labelTextColour = wxColour( "BLACK" ); }
else
{
m_labelBackgroundColour = wxColour( _T("WHITE") );
}
m_labelTextColour = wxColour( _T("BLACK") );
// TODO: something better than this ? // TODO: something better than this ?
// //