GnuCashew ~ GnuCash Enabled Web
GCW
Table.cpp
Go to the documentation of this file.
1 #line 2 "src/Gui/BillPay/Table.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 Table( 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  */
17  addStyleClass( asStyleClass( _status ) );
18 
19  /*
20  ** Set up some controls
21  **
22  */
23  setSortingEnabled ( false );
24  setSelectionBehavior ( Wt::SelectionBehavior::Rows );
25  setSelectionMode ( Wt::SelectionMode::Single );
26  setAlternatingRowColors ( true );
27 
28  /*
29  ** Make a data model
30  **
31  */
32  m_model = std::make_shared< Model >( _selectedMonth, _status );
33 
34  /*
35  ** Set the model in to the table
36  **
37  */
38  setModel( m_model );
39 
40  /*
41  ** Apply the column widths and alignments
42  **
43  */
44  for( int col=0; col< m_model-> columnCount(); col++ )
45  {
46  setColumnWidth ( col, m_model-> columnDef(col).width );
47  setColumnAlignment( col, m_model-> columnDef(col).alignment );
48  }
49 
50 } // endTable()
51 
52 
53 void
55 setMonth( int _month )
56 {
57  int selected_row = -1;
58 
59  if( selectedIndexes().size() > 0 )
60  {
61  selected_row = selectedIndexes().begin()-> row();
62  }
63 
64  m_model-> loadData( _month );
65 
66  if( selected_row > -1 )
67  {
68  select( m_model-> index( selected_row, 0 ) );
69  }
70 
71 } // endsetMonth( int _month )
72 
73 
std::shared_ptr< Model > m_model
Definition: Table.h:37
Table(int _selectedMonth, const Status _status)
Definition: Table.cpp:10
void setMonth(int _month)
Definition: Table.cpp:55
Status
Bill Status.
Definition: Status.h:21
std::string asStyleClass(Status _status)
Get Status as Style Class.
Definition: Status.cpp:21