diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:57:45 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:57:45 +0200 |
commit | 2a3ebac62eb6dd88122c0f447ea90ce368373d3a (patch) | |
tree | fae5c18deaecfb6f39d4d66dd3de8ce730b2025b /library/CustomGrid.h | |
parent | 1.17 (diff) | |
download | FreeFileSync-2a3ebac62eb6dd88122c0f447ea90ce368373d3a.tar.gz FreeFileSync-2a3ebac62eb6dd88122c0f447ea90ce368373d3a.tar.bz2 FreeFileSync-2a3ebac62eb6dd88122c0f447ea90ce368373d3a.zip |
1.18
Diffstat (limited to 'library/CustomGrid.h')
-rw-r--r-- | library/CustomGrid.h | 153 |
1 files changed, 98 insertions, 55 deletions
diff --git a/library/CustomGrid.h b/library/CustomGrid.h index 14d62255..802db231 100644 --- a/library/CustomGrid.h +++ b/library/CustomGrid.h @@ -3,15 +3,33 @@ #include <vector> #include <wx/grid.h> -#include "../FreeFileSync.h" +#include "../structures.h" #include "processXml.h" -using namespace FreeFileSync; - class CustomGridTable; +class CustomGridTableRim; +class CustomGridTableMiddle; + +namespace FreeFileSync +{ + class GridView; +} //################################################################################## +/* +class hierarchy: + CustomGrid + /|\ + ____________|____________ + | | + CustomGridRim | + /|\ | + ________|_______ | + | | | +CustomGridLeft CustomGridRight CustomGridMiddle +*/ + class CustomGrid : public wxGrid { public: @@ -24,27 +42,46 @@ public: virtual ~CustomGrid() {} - //overwrite virtual method to finally get rid of the scrollbars - virtual void SetScrollbar(int orientation, int position, int thumbSize, int range, bool refresh = true); - virtual void DrawColLabel(wxDC& dc, int col); - void initSettings(const bool enableScrollbars, - const bool showFileIcons, - CustomGrid* gridLeft, - CustomGrid* gridRight, - CustomGrid* gridMiddle, - GridView* gridRefUI, - FileCompareResult* gridData); + //set sort direction indicator on UI + void setSortMarker(const int sortColumn, const wxBitmap* bitmap = &wxNullBitmap); + + bool isLeadGrid() const; - virtual void initGridRenderer(const bool showFileIcons) = 0; +protected: + CustomGrid* m_gridLeft; + CustomGrid* m_gridMiddle; + CustomGrid* m_gridRight; + +private: + void onGridAccess(wxEvent& event); + void adjustGridHeights(wxEvent& event); + + bool isLeading; //identify grid that has user focus + int currentSortColumn; + const wxBitmap* sortMarker; +}; + + +//############## SPECIALIZATIONS ################### +class CustomGridRim : public CustomGrid +{ +public: + CustomGridRim(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) : + CustomGrid(parent, id, pos, size, style, name), + gridDataTable(NULL) {} + + ~CustomGridRim() {} //notify wxGrid that underlying table size has changed void updateGridSizes(); - //set sort direction indicator on UI - void setSortMarker(const int sortColumn, const wxBitmap* bitmap = &wxNullBitmap); - //set visibility, position and width of columns static xmlAccess::ColumnAttributes getDefaultColumnAttributes(); xmlAccess::ColumnAttributes getColumnAttributes(); @@ -54,30 +91,15 @@ public: static wxString getTypeName(xmlAccess::ColumnTypes colType); - const wxGrid* getLeadGrid(); - bool isLeadGrid(); - protected: - void onGridAccess(wxEvent& event); - void adjustGridHeights(wxEvent& event); + CustomGridTableRim* gridDataTable; +private: xmlAccess::ColumnAttributes columnSettings; //set visibility, position and width of columns - - const wxGrid* leadGrid; //grid that has user focus - bool scrollbarsEnabled; - CustomGrid* m_gridLeft; - CustomGrid* m_gridMiddle; - CustomGrid* m_gridRight; - - CustomGridTable* gridDataTable; - - int currentSortColumn; - const wxBitmap* sortMarker; }; -//############## SPECIALIZATIONS ################### -class CustomGridLeft : public CustomGrid +class CustomGridLeft : public CustomGridRim { public: CustomGridLeft(wxWindow *parent, @@ -89,12 +111,41 @@ public: ~CustomGridLeft() {} + virtual bool CreateGrid(int numRows, int numCols, wxGrid::wxGridSelectionModes selmode = wxGrid::wxGridSelectCells); + + void initSettings(const bool showFileIcons, //workaround: though this coding better belongs into a constructor + CustomGrid* gridLeft, //this is not possible due to source code generation (information not available at time of construction) + CustomGrid* gridRight, + CustomGrid* gridMiddle, + FreeFileSync::GridView* gridDataView); + //this method is called when grid view changes: useful for parallel updating of multiple grids virtual void DoPrepareDC(wxDC& dc); +}; + + +class CustomGridRight : public CustomGridRim +{ +public: + CustomGridRight(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxWANTS_CHARS, + const wxString& name = wxGridNameStr); + + ~CustomGridRight() {} virtual bool CreateGrid(int numRows, int numCols, wxGrid::wxGridSelectionModes selmode = wxGrid::wxGridSelectCells); - virtual void initGridRenderer(const bool showFileIcons); + void initSettings(const bool showFileIcons, //workaround: though this coding better belongs into a constructor + CustomGrid* gridLeft, //this is not possible due to source code generation (information not available at time of construction) + CustomGrid* gridRight, + CustomGrid* gridMiddle, + FreeFileSync::GridView* gridDataView); + + //this method is called when grid view changes: useful for parallel updating of multiple grids + virtual void DoPrepareDC(wxDC& dc); }; @@ -110,33 +161,25 @@ public: ~CustomGridMiddle() {} - //this method is called when grid view changes: useful for parallel updating of multiple grids - virtual void DoPrepareDC(wxDC& dc); - virtual bool CreateGrid(int numRows, int numCols, wxGrid::wxGridSelectionModes selmode = wxGrid::wxGridSelectCells); - virtual void initGridRenderer(const bool showFileIcons) {} -}; - + void initSettings(CustomGrid* gridLeft, //workaround: though this coding better belongs into a constructor + CustomGrid* gridRight, //this is not possible due to source code generation (information not available at time of construction) + CustomGrid* gridMiddle, + FreeFileSync::GridView* gridDataView); -class CustomGridRight : public CustomGrid -{ -public: - CustomGridRight(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxWANTS_CHARS, - const wxString& name = wxGridNameStr); + //notify wxGrid that underlying table size has changed + void updateGridSizes(); - ~CustomGridRight() {} +#ifdef FFS_WIN //get rid of scrollbars; Windows: overwrite virtual method + virtual void SetScrollbar(int orientation, int position, int thumbSize, int range, bool refresh = true); +#endif //this method is called when grid view changes: useful for parallel updating of multiple grids virtual void DoPrepareDC(wxDC& dc); - virtual bool CreateGrid(int numRows, int numCols, wxGrid::wxGridSelectionModes selmode = wxGrid::wxGridSelectCells); - - virtual void initGridRenderer(const bool showFileIcons); +private: + CustomGridTableMiddle* gridDataTable; }; #endif // CUSTOMGRID_H_INCLUDED |