From 32cb97237e7691d31977ab503c6ea4511e8eb3a8 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:18:53 +0200 Subject: 5.0 --- ui/custom_grid.h | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 ui/custom_grid.h (limited to 'ui/custom_grid.h') diff --git a/ui/custom_grid.h b/ui/custom_grid.h new file mode 100644 index 00000000..4c07c150 --- /dev/null +++ b/ui/custom_grid.h @@ -0,0 +1,83 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) ZenJu (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// ************************************************************************** + +#ifndef CUSTOMGRID_H_INCLUDED +#define CUSTOMGRID_H_INCLUDED + +#include +#include "grid_view.h" +#include "column_attr.h" +#include "../lib/icon_buffer.h" + +namespace zen +{ +//setup grid to show grid view within three components: +namespace gridview +{ +static const size_t COMP_LEFT = 0; +static const size_t COMP_MIDDLE = 1; +static const size_t COMP_RIGHT = 2; + +void init(Grid& grid, const std::shared_ptr& gridDataView); + +std::vector convertConfig(const std::vector& attribs); //+ make consistent +std::vector convertConfig(const std::vector& attribs); // + +void setSyncPreviewActive(Grid& grid, bool value); + +void setIconSize(Grid& grid, IconBuffer::IconSize sz); + +void clearSelection(Grid& grid); //clear all components + +//mark rows selected in navigation/compressed tree and navigate to leading object +void setNavigationMarker(Grid& grid, + std::vector&& markedFiles, //mark files/symlinks directly within a container + std::vector&& markedContainer); //mark full container including child-objects +} + +wxBitmap getSyncOpImage(SyncOperation syncOp); +wxBitmap getCmpResultImage(CompareFilesResult cmpResult); + + +//---------- custom events for middle grid ---------- + +//(UN-)CHECKING ROWS FROM SYNCHRONIZATION +extern const wxEventType EVENT_GRID_CHECK_ROWS; +//SELECTING SYNC DIRECTION +extern const wxEventType EVENT_GRID_SYNC_DIRECTION; + +struct CheckRowsEvent : public wxCommandEvent +{ + CheckRowsEvent(int rowFrom, int rowTo, bool setIncluded) : wxCommandEvent(EVENT_GRID_CHECK_ROWS), rowFrom_(rowFrom), rowTo_(rowTo), setIncluded_(setIncluded) {} + virtual wxEvent* Clone() const { return new CheckRowsEvent(*this); } + + const int rowFrom_; + const int rowTo_; + const bool setIncluded_; +}; + + +struct SyncDirectionEvent : public wxCommandEvent +{ + SyncDirectionEvent(int rowFrom, int rowTo, SyncDirection direction) : wxCommandEvent(EVENT_GRID_SYNC_DIRECTION), rowFrom_(rowFrom), rowTo_(rowTo), direction_(direction) {} + virtual wxEvent* Clone() const { return new SyncDirectionEvent(*this); } + + const int rowFrom_; + const int rowTo_; + const SyncDirection direction_; +}; + +typedef void (wxEvtHandler::*CheckRowsEventFunction)(CheckRowsEvent&); +typedef void (wxEvtHandler::*SyncDirectionEventFunction)(SyncDirectionEvent&); + +#define CheckRowsEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(CheckRowsEventFunction, &func) + +#define SyncDirectionEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(SyncDirectionEventFunction, &func) +} + +#endif // CUSTOMGRID_H_INCLUDED -- cgit