GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
GCW::Gui::AccountRegister::DelegateDate Class Reference

Date Delegate. More...

#include <DelegateDate.h>

+ Inheritance diagram for GCW::Gui::AccountRegister::DelegateDate:

Public Member Functions

 DelegateDate ()
 
 ~DelegateDate ()
 
virtual auto createEditor (const Wt::WModelIndex &_index, Wt::WFlags< Wt::ViewItemRenderFlag > _flags) const -> std::unique_ptr< Wt::WWidget >
 
virtual auto editState (Wt::WWidget *_editor, const Wt::WModelIndex &_index) const -> Wt::cpp17::any override
 Edit State.
 
virtual auto setEditState (Wt::WWidget *_editor, const Wt::WModelIndex &_index, const Wt::cpp17::any &_value) const -> void
 
virtual auto setModelData (const Wt::cpp17::any &_editState, Wt::WAbstractItemModel *_model, const Wt::WModelIndex &_index) const -> void
 
auto doCloseEditor (Wt::WDateEdit *_dateEdit, bool _save) const -> void
 
auto doTabAction (Wt::WKeyEvent _keyEvent) const -> void
 
- Public Member Functions inherited from GCW::Gui::AccountRegister::DelegateBase
 DelegateBase ()
 Base Delegate.
 
 ~DelegateBase ()
 
virtual auto update (Wt::WWidget *_widget, const Wt::WModelIndex &_index, Wt::WFlags< Wt::ViewItemRenderFlag > _flags) -> std::unique_ptr< Wt::WWidget >
 
virtual auto updateModelIndex (Wt::WWidget *_widget, const Wt::WModelIndex &_index) -> void
 
virtual auto validate (const Wt::WModelIndex &_index, const Wt::cpp17::any &_editState) const -> Wt::ValidationState
 
- Public Member Functions inherited from Wt::WItemDelegate
 WItemDelegate ()
 
void setTextFormat (const WString &format)
 
const WStringtextFormat () const
 
virtual void setModelData (const cpp17::any &editState, WAbstractItemModel *model, const WModelIndex &index) const override
 
virtual void setEditState (WWidget *editor, const WModelIndex &index, const cpp17::any &value) const override
 
- Public Member Functions inherited from Wt::WAbstractItemDelegate
 WAbstractItemDelegate ()
 
virtual ~WAbstractItemDelegate ()
 
virtual ValidationState validate (const WModelIndex &index, const cpp17::any &editState) const
 
Signal< WWidget *, bool > & closeEditor ()
 
const Signal< WWidget *, bool > & closeEditor () const
 
- Public Member Functions inherited from Wt::WObject
void addChild (std::unique_ptr< WObject > child)
 
Child * addChild (std::unique_ptr< Child > child)
 
std::unique_ptr< WObjectremoveChild (WObject *child)
 
std::unique_ptr< Child > removeChild (Child *child)
 
virtual const std::string id () const
 
virtual void setObjectName (const std::string &name)
 
virtual std::string objectName () const
 
void resetLearnedSlots ()
 
void resetLearnedSlot (void(T::*method)())
 
WStatelessSlot * implementStateless (void(T::*method)())
 
WStatelessSlot * implementStateless (void(T::*method)(), void(T::*undoMethod)())
 
void isNotStateless ()
 
WStatelessSlot * implementJavaScript (void(T::*method)(), const std::string &jsCode)
 
- Public Member Functions inherited from Wt::Core::observable
 observable () noexcept
 
virtual ~observable ()
 
auto bindSafe (void(C::*method)(Args...)) noexcept
 
auto bindSafe (void(C::*method)(Args...) const) const noexcept
 
auto bindSafe (const Function &function) noexcept
 

Private Member Functions

auto setDate (Wt::WDateEdit *_dateEdit, Wt::cpp17::any _value) const -> void
 

Additional Inherited Members

- Public Types inherited from Wt::WObject
typedef void(WObject::* Method) ()
 
- Protected Member Functions inherited from Wt::WObject
virtual WStatelessSlot * getStateless (Method method)
 

Detailed Description

Date Delegate.

The date delegate handles the WDateTime value from the model. Even though a 'transaction' is posted on a 'date' and not particularly a time, the gnucash system still is sensitive to time values in date-only fields. In the case of the transactions, the 'time' component is set to 10:59:00. There is a macro that contains this value 'GCW_DATE_DEFAULT_TIME' which should be used to reference the correct time-value. The time-component is important since when reading items out of the database, gnucash responds poorly to posted dates that have a 00:00:00 time component set, it must be set to the 10:59:00 value. This delegate makes sure that happens (probably shouldn't be done here).

Definition at line 28 of file DelegateDate.h.

Constructor & Destructor Documentation

◆ DelegateDate()

GCW::Gui::AccountRegister::DelegateDate::DelegateDate ( )

Definition at line 11 of file DelegateDate.cpp.

References GCW_DATE_FORMAT_DISPLAY, and Wt::WItemDelegate::setTextFormat().

◆ ~DelegateDate()

GCW::Gui::AccountRegister::DelegateDate::~DelegateDate ( )

Definition at line 26 of file DelegateDate.cpp.

Member Function Documentation

◆ createEditor()

auto GCW::Gui::AccountRegister::DelegateDate::createEditor ( const Wt::WModelIndex _index,
Wt::WFlags< Wt::ViewItemRenderFlag _flags 
) const -> std::unique_ptr< Wt::WWidget >
virtual

◆ doCloseEditor()

auto GCW::Gui::AccountRegister::DelegateDate::doCloseEditor ( Wt::WDateEdit _dateEdit,
bool  _save 
) const -> void

Definition at line 110 of file DelegateDate.cpp.

◆ doTabAction()

auto GCW::Gui::AccountRegister::DelegateDate::doTabAction ( Wt::WKeyEvent  _keyEvent) const -> void

Definition at line 122 of file DelegateDate.cpp.

◆ editState()

auto GCW::Gui::AccountRegister::DelegateDate::editState ( Wt::WWidget _editor,
const Wt::WModelIndex _index 
) const -> Wt::cpp17::any
overridevirtual

Edit State.

A thing about editState, setEditState, setModelData. Each of these use 'cpp17::any' data for handling data. When you 'editState' you can return anything you want that will also be digested by 'setEditState'. Then, also, therefore, setModelData will also receive anything from 'editState'. So, this can be a handy tool for passing around different editor info that is specifically tied to a row or item that is being edited. Right now we just return the date value, since that's what we're using and poking straight in to the model and what not, but we could be passing around any object/date/type... just sayin.

Reimplemented from GCW::Gui::AccountRegister::DelegateBase.

Definition at line 132 of file DelegateDate.cpp.

References GCW_DATE_DEFAULT_TIME, Wt::WDateTime::setDate(), and Wt::WDateTime::setTime().

◆ setDate()

auto GCW::Gui::AccountRegister::DelegateDate::setDate ( Wt::WDateEdit _dateEdit,
Wt::cpp17::any  _value 
) const -> void
private

Definition at line 83 of file DelegateDate.cpp.

References Wt::asString(), and GCW::Cfg::date_format().

◆ setEditState()

auto GCW::Gui::AccountRegister::DelegateDate::setEditState ( Wt::WWidget _editor,
const Wt::WModelIndex _index,
const Wt::cpp17::any &  _value 
) const -> void
virtual

Reimplemented from GCW::Gui::AccountRegister::DelegateBase.

Definition at line 162 of file DelegateDate.cpp.

References Wt::asString().

◆ setModelData()

auto GCW::Gui::AccountRegister::DelegateDate::setModelData ( const Wt::cpp17::any &  _editState,
Wt::WAbstractItemModel _model,
const Wt::WModelIndex _index 
) const -> void
virtual

The documentation for this class was generated from the following files: