GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
Loading...
Searching...
No Matches
AccountsTreeView.h
Go to the documentation of this file.
1#line 2 "src/Gui/AccountsTreeView.h"
2
3#ifndef __GUI_ACCOUNTSTREEVIEW_H___
4#define __GUI_ACCOUNTSTREEVIEW_H___
5
6#include <Wt/Json/Object.h>
7#include <Wt/WContainerWidget.h>
8#include <Wt/WTreeView.h>
9#include <Wt/WStandardItem.h>
10#include <Wt/WStandardItemModel.h>
11#include <Wt/WGridLayout.h>
12
13#include "../define.h"
14#include "../GnuCashew.h"
15//#include "../Dbo/SessionGnuCash.h"
16//#include "../Dbo/SessionGnuCashew.h"
17#include "../Eng/AccountsTreeViewModel.h"
18#include "../Dbo/Vars/Vars.h"
19
20namespace GCW {
21 namespace Gui {
22 class AccountEditor;
23
24/*!
25** \brief AccountsTreeView
26**
27** The AccountsTreeView is a widget that displays all of the accounts
28** within the system. It displays the accounts in a tree-like format
29** with multiple columns representing other field values such as;
30** 'notes', 'tax info', 'balance remaining' and so on. The view is
31** sortable and browsable, and facilitates gaining access to the
32** individual account registers.
33**
34*/
37{
38 public:
39
40 class ColDef
41 {
42 public:
43
44 std::string m_name;
45
46 };
47
49
51 AccountsTreeView( const std::string & _selectedAccountGuid, int _columnCount );
52
53 auto model () const-> std::shared_ptr< Model > { return m_model; }
54 auto view () const-> Wt::WTreeView * { return m_view; }
55
57
58 auto selectedAccount() const-> std::string;
59
60 auto editAccount( const std::string & _accountGuid )-> void;
62
63 /*!
64 ** \brief Config Item
65 **
66 ** This returns the single 'config item' that contains the properties of the
67 ** tree view.
68 **
69 */
70 auto configItem()-> GCW::Dbo::Vars::Item::Ptr ;
71
72 auto saveConfig()-> void ;
73 auto loadConfig()-> void ;
74
75 auto toJson() const-> Wt::Json::Object ;
76 auto fromJson( Wt::Json::Object & _jobj )-> bool ;
77
78 auto test()-> void;
79
80 private:
81
82 auto init()-> void;
83 auto setModel()-> void;
84 auto on_doubleClicked( const Wt::WModelIndex & index, const Wt::WMouseEvent & event )-> void;
85 auto iterate( Wt::Json::Array & _jary, Wt::WModelIndex _parent = Wt::WModelIndex() ) const-> bool;
86 auto expandNode( const std::string & _accountGuid, Wt::WModelIndex _parent = Wt::WModelIndex() )-> bool;
87 auto expandTreeNodes( Wt::Json::Object & _jobj )-> bool;
88 auto setSelected( const std::string & _accountGuid )-> bool;
89 auto findIndex( const std::string & _accountGuid, Wt::WModelIndex _parentIndex = Wt::WModelIndex() )-> Wt::WModelIndex;
90 auto on_showPopup_triggered( const Wt::WModelIndex & _index, const Wt::WMouseEvent & _event )-> void;
91
92 int m_columnCount = -1 ;
93 Wt::WGridLayout * m_gridLayout = nullptr ;
94 Wt::WTreeView * m_view = nullptr ;
96 std::vector< std::string > m_columns ;
97 Wt::Signal< std::string > m_doubleClicked ;
99
100}; // endclass AccountsTreeView
101
102 } // endnamespace Gui {
103} // endnamespace GCW {
104
105#endif // end __GUI_ACCOUNTSTREEVIEW_H___
106
107
auto toJson() const -> Wt::Json::Object
auto on_doubleClicked(const Wt::WModelIndex &index, const Wt::WMouseEvent &event) -> void
auto expandNode(const std::string &_accountGuid, Wt::WModelIndex _parent=Wt::WModelIndex()) -> bool
GCW::Gui::AccountEditor * m_editAccountWidget
Wt::Signal< std::string > m_doubleClicked
auto view() const -> Wt::WTreeView *
std::vector< std::string > m_columns
std::shared_ptr< Model > m_model
Wt::WGridLayout * m_gridLayout
auto configItem() -> GCW::Dbo::Vars::Item::Ptr
Config Item.
auto expandTreeNodes(Wt::Json::Object &_jobj) -> bool
auto findIndex(const std::string &_accountGuid, Wt::WModelIndex _parentIndex=Wt::WModelIndex()) -> Wt::WModelIndex
Find Index by AccountGuid.
auto doubleClicked() -> Wt::Signal< std::string > &
auto on_showPopup_triggered(const Wt::WModelIndex &_index, const Wt::WMouseEvent &_event) -> void
auto iterate(Wt::Json::Array &_jary, Wt::WModelIndex _parent=Wt::WModelIndex()) const -> bool
auto fromJson(Wt::Json::Object &_jobj) -> bool
auto setSelected(const std::string &_accountGuid) -> bool
auto selectedAccount() const -> std::string
auto model() const -> std::shared_ptr< Model >
auto editAccount(const std::string &_accountGuid) -> void
Widget * addNew(Args &&...args)
Definition App.h:18