GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
Loading...
Searching...
No Matches
DelegateDate.h
Go to the documentation of this file.
1#line 2 "src/Gui/AccountRegister/DelegateDate.h"
2
3#ifndef __GUI_ACCOUNTREGISTER_DELEGATEDATE_H___
4#define __GUI_ACCOUNTREGISTER_DELEGATEDATE_H___
5
6#include "DelegateBase.h"
7
8namespace GCW {
9 namespace Gui {
10 namespace AccountRegister {
11 class Editor ;
12
13
14/*!
15** \brief Date Delegate
16**
17** The date delegate handles the WDateTime value from the model. Even though a 'transaction'
18** is posted on a 'date' and not particularly a time, the gnucash system still is sensitive
19** to time values in date-only fields. In the case of the transactions, the 'time'
20** component is set to 10:59:00. There is a macro that contains this value
21** 'GCW_DATE_DEFAULT_TIME' which should be used to reference the correct time-value. The
22** time-component is important since when reading items out of the database, gnucash
23** responds poorly to posted dates that have a 00:00:00 time component set, it must be set
24** to the 10:59:00 value. This delegate makes sure that happens (probably shouldn't be
25** done here).
26**
27*/
29: public DelegateBase
30{
31 public:
32
35 virtual auto createEditor( const Wt::WModelIndex & _index, Wt::WFlags< Wt::ViewItemRenderFlag > _flags ) const-> std::unique_ptr< Wt::WWidget > ;
36
37 /*!
38 ** \brief Edit State
39 **
40 ** A thing about editState, setEditState, setModelData. Each of these use 'cpp17::any' data
41 ** for handling data. When you 'editState' you can return anything you want that will also
42 ** be digested by 'setEditState'. Then, also, therefore, setModelData will also receive
43 ** anything from 'editState'. So, this can be a handy tool for passing around different
44 ** editor info that is specifically tied to a row or item that is being edited. Right now
45 ** we just return the date value, since that's what we're using and poking straight in to the
46 ** model and what not, but we could be passing around any object/date/type... just sayin.
47 */
48 virtual auto editState( Wt::WWidget * _editor, const Wt::WModelIndex & _index ) const-> Wt::cpp17::any override ;
49 virtual auto setEditState( Wt::WWidget * _editor, const Wt::WModelIndex & _index, const Wt::cpp17::any & _value ) const-> void ;
50 virtual auto setModelData ( const Wt::cpp17::any & _editState, Wt::WAbstractItemModel * _model, const Wt::WModelIndex & _index ) const-> void ;
51
52 auto doCloseEditor( Wt::WDateEdit * _dateEdit, bool _save ) const-> void ;
53 auto doTabAction( Wt::WKeyEvent _keyEvent ) const-> void ;
54
55 private:
56
57 auto setDate( Wt::WDateEdit * _dateEdit, Wt::cpp17::any _value ) const-> void ;
58
59}; // endclass DelegateDate
60
61
62 } // endnamespace AccountRegister {
63 } // endnamespace Gui {
64} // endnamespace GCW {
65
66#endif // __GUI_ACCOUNTREGISTER_DELEGATEDATE_H___
67
68
virtual auto setModelData(const Wt::cpp17::any &_editState, Wt::WAbstractItemModel *_model, const Wt::WModelIndex &_index) const -> void
auto doTabAction(Wt::WKeyEvent _keyEvent) const -> void
auto setDate(Wt::WDateEdit *_dateEdit, Wt::cpp17::any _value) const -> void
auto doCloseEditor(Wt::WDateEdit *_dateEdit, bool _save) const -> void
virtual auto editState(Wt::WWidget *_editor, const Wt::WModelIndex &_index) const -> Wt::cpp17::any override
Edit State.
virtual auto createEditor(const Wt::WModelIndex &_index, Wt::WFlags< Wt::ViewItemRenderFlag > _flags) const -> std::unique_ptr< Wt::WWidget >
virtual auto setEditState(Wt::WWidget *_editor, const Wt::WModelIndex &_index, const Wt::cpp17::any &_value) const -> void
Definition App.h:18