summaryrefslogtreecommitdiff
path: root/library/CustomGrid.h
diff options
context:
space:
mode:
Diffstat (limited to 'library/CustomGrid.h')
-rw-r--r--library/CustomGrid.h113
1 files changed, 101 insertions, 12 deletions
diff --git a/library/CustomGrid.h b/library/CustomGrid.h
index 802db231..89ec39d0 100644
--- a/library/CustomGrid.h
+++ b/library/CustomGrid.h
@@ -10,6 +10,7 @@
class CustomGridTable;
class CustomGridTableRim;
class CustomGridTableMiddle;
+class GridCellRendererMiddle;
namespace FreeFileSync
{
@@ -44,6 +45,8 @@ public:
virtual void DrawColLabel(wxDC& dc, int col);
+ std::set<int> getAllSelectedRows() const;
+
//set sort direction indicator on UI
void setSortMarker(const int sortColumn, const wxBitmap* bitmap = &wxNullBitmap);
@@ -79,6 +82,12 @@ public:
~CustomGridRim() {}
+ 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,
+ const FreeFileSync::GridView* gridDataView);
+
//notify wxGrid that underlying table size has changed
void updateGridSizes();
@@ -88,9 +97,10 @@ public:
void setColumnAttributes(const xmlAccess::ColumnAttributes& attr);
xmlAccess::ColumnTypes getTypeAtPos(unsigned pos) const;
-
static wxString getTypeName(xmlAccess::ColumnTypes colType);
+ virtual void enableFileIcons(const bool value) = 0;
+
protected:
CustomGridTableRim* gridDataTable;
@@ -113,11 +123,7 @@ public:
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);
+ virtual void enableFileIcons(const bool value);
//this method is called when grid view changes: useful for parallel updating of multiple grids
virtual void DoPrepareDC(wxDC& dc);
@@ -138,11 +144,7 @@ public:
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);
+ virtual void enableFileIcons(const bool value);
//this method is called when grid view changes: useful for parallel updating of multiple grids
virtual void DoPrepareDC(wxDC& dc);
@@ -151,6 +153,8 @@ public:
class CustomGridMiddle : public CustomGrid
{
+ friend class GridCellRendererMiddle;
+
public:
CustomGridMiddle(wxWindow *parent,
wxWindowID id,
@@ -166,7 +170,9 @@ public:
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);
+ const FreeFileSync::GridView* gridDataView);
+
+ void enableSyncPreview(bool value);
//notify wxGrid that underlying table size has changed
void updateGridSizes();
@@ -179,7 +185,90 @@ public:
virtual void DoPrepareDC(wxDC& dc);
private:
+ void OnMouseMovement(wxMouseEvent& event);
+ void OnLeaveWindow(wxMouseEvent& event);
+ void OnLeftMouseDown(wxMouseEvent& event);
+ void OnLeftMouseUp(wxMouseEvent& event);
+
+ //small helper methods
+ void RefreshRow(int row);
+ enum BlockPosition //each cell can be divided into four blocks concerning mouse selections
+ {
+ BLOCKPOS_CHECK_BOX,
+ BLOCKPOS_LEFT,
+ BLOCKPOS_MIDDLE,
+ BLOCKPOS_RIGHT
+ };
+ int mousePosToRow(const wxPoint pos, BlockPosition* block = NULL);
+
+ //variables for selecting sync direction
+ int selectionRowBegin;
+ BlockPosition selectionPos;
+
+ //variables for highlightning on mouse-over
+ int highlightedRow;
+ BlockPosition highlightedPos;
+
CustomGridTableMiddle* gridDataTable;
};
+//custom events for middle grid:
+
+//--------------------------------------------------------------------------------------------
+//(UN-)CHECKING ROWS FROM SYNCHRONIZATION
+
+extern const wxEventType FFS_CHECK_ROWS_EVENT; //define new event type
+
+class FFSCheckRowsEvent : public wxCommandEvent
+{
+public:
+ FFSCheckRowsEvent(const int from, const int to) :
+ wxCommandEvent(FFS_CHECK_ROWS_EVENT),
+ rowFrom(from),
+ rowTo(to) {}
+
+ virtual wxEvent* Clone() const
+ {
+ return new FFSCheckRowsEvent(rowFrom, rowTo);
+ }
+
+ const int rowFrom;
+ const int rowTo;
+};
+
+typedef void (wxEvtHandler::*FFSCheckRowsEventFunction)(FFSCheckRowsEvent&);
+
+#define FFSCheckRowsEventHandler(func) \
+ (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(FFSCheckRowsEventFunction, &func)
+
+//--------------------------------------------------------------------------------------------
+//SELECTING SYNC DIRECTION
+
+extern const wxEventType FFS_SYNC_DIRECTION_EVENT; //define new event type
+
+class FFSSyncDirectionEvent : public wxCommandEvent
+{
+public:
+ FFSSyncDirectionEvent(const int from, const int to, const FreeFileSync::SyncDirection dir) :
+ wxCommandEvent(FFS_SYNC_DIRECTION_EVENT),
+ rowFrom(from),
+ rowTo(to),
+ direction(dir) {}
+
+ virtual wxEvent* Clone() const
+ {
+ return new FFSSyncDirectionEvent(rowFrom, rowTo, direction);
+ }
+
+ const int rowFrom;
+ const int rowTo;
+ const FreeFileSync::SyncDirection direction;
+};
+
+typedef void (wxEvtHandler::*FFSSyncDirectionEventFunction)(FFSSyncDirectionEvent&);
+
+#define FFSSyncDirectionEventHandler(func) \
+ (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(FFSSyncDirectionEventFunction, &func)
+
+
#endif // CUSTOMGRID_H_INCLUDED
bgstack15