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 "../Eng/AccountsTreeViewModel.h"
16#include "../Dbo/Vars/Vars.h"
17
18namespace GCW {
19 namespace Gui {
20 class AccountEditor;
21
22/*!
23** \brief AccountsTreeView
24**
25** The AccountsTreeView is a widget that displays all of the accounts
26** within the system. It displays the accounts in a tree-like format
27** with multiple columns representing other field values such as;
28** 'notes', 'tax info', 'balance remaining' and so on. The view is
29** sortable and browsable, and facilitates gaining access to the
30** individual account registers.
31**
32*/
35{
36 public:
37
38 class ColDef
39 {
40 public:
41
42 std::string m_name;
43
44 };
45
47
49 AccountsTreeView( const std::string & _selectedAccountGuid, int _columnCount );
50
51 auto model () const-> std::shared_ptr< Model > { return m_model; }
52 auto view () const-> Wt::WTreeView * { return m_view; }
53
55
56 auto selectedAccount() const-> std::string;
57
58 auto editAccount( const std::string & _accountGuid )-> void;
60
61 /*!
62 ** \brief Config Item
63 **
64 ** This returns the single 'config item' that contains the properties of the
65 ** tree view.
66 **
67 */
68 auto configItem()-> GCW::Dbo::Vars::Item::Ptr ;
69
70 auto saveConfig()-> void ;
71 auto loadConfig()-> void ;
72
73 auto toJson() const-> Wt::Json::Object ;
74 auto fromJson( Wt::Json::Object & _jobj )-> bool ;
75
76 auto test()-> void;
77
78 private:
79
80 auto init()-> void;
81 auto setModel()-> void;
82 auto on_doubleClicked( const Wt::WModelIndex & index, const Wt::WMouseEvent & event )-> void;
83 auto iterate( Wt::Json::Array & _jary, Wt::WModelIndex _parent = Wt::WModelIndex() ) const-> bool;
84 auto expandNode( const std::string & _accountGuid, Wt::WModelIndex _parent = Wt::WModelIndex() )-> bool;
85 auto expandTreeNodes( Wt::Json::Object & _jobj )-> bool;
86 auto setSelected( const std::string & _accountGuid )-> bool;
87 auto findIndex( const std::string & _accountGuid, Wt::WModelIndex _parentIndex = Wt::WModelIndex() )-> Wt::WModelIndex;
88 auto on_showPopup_triggered( const Wt::WModelIndex & _index, const Wt::WMouseEvent & _event )-> void;
89
90 int m_columnCount = -1 ;
91 Wt::WGridLayout * m_gridLayout = nullptr ;
92 Wt::WTreeView * m_view = nullptr ;
94 std::vector< std::string > m_columns ;
95 Wt::Signal< std::string > m_doubleClicked ;
97
98}; // endclass AccountsTreeView
99
100 } // endnamespace Gui {
101} // endnamespace GCW {
102
103#endif // end __GUI_ACCOUNTSTREEVIEW_H___
104
105
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