GnuCashew ~ GnuCash Enabled Web
GCW
TableView.cpp
Go to the documentation of this file.
1 #line 2 "src/Gui/BillPay/TableView.cpp"
2 
3 #include <Wt/WModelIndex.h>
4 #include <Wt/WStandardItem.h>
5 
6 #include "../../Dbo/Accounts/Accounts.h"
7 #include "BillPay.h"
8 
10 TableView( int _selectedMonth, const Status _status )
11 {
12  /*
13  ** Add 'Unpaid', 'Paid', 'Disabled' to the style class of this
14  ** table for styling and such as.
15  */
16  addStyleClass( asStyleClass( _status ) );
17 
18  /*
19  ** Set up some controls
20  */
21  setSortingEnabled ( false );
22  setSelectionBehavior ( Wt::SelectionBehavior::Rows );
23  setSelectionMode ( Wt::SelectionMode::Single );
24  setColumnResizeEnabled ( false );
25  setAlternatingRowColors ( true );
26 
27  /*
28  ** Make a data model
29  */
30  m_model = std::make_shared< TableModel >( _selectedMonth, _status );
31 
32  /*
33  ** Set the model in to the table
34  */
35  setModel( m_model );
36 
37  /*
38  ** Apply the column widths and alignments
39  */
40  for( int col=0; col< m_model-> columnCount(); col++ )
41  {
42  setColumnWidth ( col, m_model-> columnDef(col).width );
43  setColumnAlignment( col, m_model-> columnDef(col).alignment );
44  }
45 
46 } // endTableView()
47 
48 
49 void
51 setMonth( int _month )
52 {
53  int selected_row = -1;
54 
55  if( selectedIndexes().size() > 0 )
56  {
57  selected_row = selectedIndexes().begin()-> row();
58  }
59 
60  m_model-> loadData( _month );
61 
62  if( selected_row > -1 )
63  {
64  select( m_model-> index( selected_row, 0 ) );
65  }
66 
67 } // endsetMonth( int _month )
68 
69 
std::shared_ptr< TableModel > m_model
Definition: TableView.h:37
void setMonth(int _month)
Definition: TableView.cpp:51
TableView(int _selectedMonth, const Status _status)
Definition: TableView.cpp:10
Status
Bill Status.
Definition: Status.h:21
std::string asStyleClass(Status _status)
Get Status as Style Class.
Definition: Status.cpp:22