First work for KissPanel
This commit is contained in:
parent
a43dd6bd95
commit
9101da3e2b
|
@ -38,7 +38,7 @@ EVT_BUTTON(GROUP_ID, AccountPanel::OnGroup)
|
|||
EVT_BUTTON(UNGROUP_ID, AccountPanel::OnUnGroup)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*parent)), _curMonth(-1), _curYear(-1), _kiss(kiss), _wxUI(parent), _tree(this, CALENDAR_TREE_ID, wxDefaultPosition, wxDefaultSize, wxTR_HIDE_ROOT)
|
||||
AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _curMonth(-1), _curYear(-1), _tree(this, CALENDAR_TREE_ID, wxDefaultPosition, wxDefaultSize, wxTR_HIDE_ROOT)
|
||||
{
|
||||
wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer *hbox2 = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -156,6 +156,24 @@ AccountPanel::~AccountPanel()
|
|||
delete[] _accounts;
|
||||
}
|
||||
|
||||
KissPanel* AccountPanel::CreatePanel()
|
||||
{
|
||||
return new AccountPanel(_kiss, _wxUI);
|
||||
}
|
||||
|
||||
wxBitmapButton* AccountPanel::GetButton(int id)
|
||||
{
|
||||
if (!_KissButton)
|
||||
_KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(ACCOUNT_ICON)), wxDefaultPosition, wxSize(128, 128));
|
||||
|
||||
return _KissButton;
|
||||
}
|
||||
|
||||
wxString AccountPanel::GetToolTip()
|
||||
{
|
||||
return _("Operations");
|
||||
}
|
||||
|
||||
void AccountPanel::InitStatsGrid(User* user)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -25,26 +25,27 @@
|
|||
#include <wx/treectrl.h>
|
||||
#include <wx/pie/pieplot.h>
|
||||
#include <wx/chartpanel.h>
|
||||
#include <wx/scrolwin.h>
|
||||
#include "grid/CalendarEditor.h"
|
||||
#include "grid/wxGridCellBitmapRenderer.h"
|
||||
|
||||
#include "view.h"
|
||||
|
||||
#include <controller/KissCount.h>
|
||||
#include "wxUI.h"
|
||||
#include <model/model.h>
|
||||
#include "grid/GridAccount.h"
|
||||
#include <wx/category/categorysimpledataset.h>
|
||||
|
||||
class wxUI;
|
||||
class KissCount;
|
||||
|
||||
class AccountPanel: public wxScrolledWindow
|
||||
class AccountPanel: public KissPanel
|
||||
{
|
||||
public:
|
||||
AccountPanel(KissCount* kiss, wxUI *parent);
|
||||
~AccountPanel();
|
||||
|
||||
KissPanel* CreatePanel();
|
||||
wxBitmapButton* GetButton(int id);
|
||||
wxString GetToolTip();
|
||||
void OnShow(wxShowEvent& event);
|
||||
|
||||
void ChangeUser();
|
||||
void LoadYear(int year, bool showMonth=true);
|
||||
void ShowMonth(int month, int year);
|
||||
|
@ -56,7 +57,6 @@ public:
|
|||
void OnTreeChange(wxTreeEvent& event);
|
||||
void OnMenuGenerate(wxCommandEvent& event);
|
||||
void OnMenuDelete(wxCommandEvent& event);
|
||||
void OnShow(wxShowEvent& event);
|
||||
void OnCalendarChange(wxCalendarEvent& event);
|
||||
void OnCheckMode(wxCommandEvent& event);
|
||||
void OnGroup(wxCommandEvent& event);
|
||||
|
@ -65,8 +65,6 @@ public:
|
|||
int _curMonth, _curYear;
|
||||
|
||||
private:
|
||||
KissCount* _kiss;
|
||||
wxUI* _wxUI;
|
||||
wxTreeCtrl _tree;
|
||||
wxCalendarCtrl* _calendar;
|
||||
GridAccount* _grid;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#define BUTTONPANEL_H
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
|
||||
#include <controller/KissCount.h>
|
||||
#include "wxUI.h"
|
||||
|
|
51
src/view/KissPanel.h
Normal file
51
src/view/KissPanel.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
Copyright 2010 Grégory Soutadé
|
||||
|
||||
This file is part of KissCount.
|
||||
|
||||
KissCount is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
KissCount is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KISSPANEL_H
|
||||
#define KISSPANEL_H
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
|
||||
class wxUI;
|
||||
class KissCount;
|
||||
|
||||
class KissPanel: public wxScrolledWindow
|
||||
{
|
||||
public:
|
||||
KissPanel(KissCount* kiss, wxUI* parent) :
|
||||
wxScrolledWindow((wxFrame*)parent),
|
||||
_kiss(kiss),
|
||||
_wxUI(parent),
|
||||
_KissButton(NULL)
|
||||
{Hide();}
|
||||
|
||||
virtual void OnShow(wxShowEvent& event)=0;
|
||||
virtual KissPanel* CreatePanel()=0;
|
||||
virtual wxBitmapButton* GetButton(int id) {return NULL;}
|
||||
virtual wxString GetToolTip() {return wxT("");}
|
||||
|
||||
protected:
|
||||
KissCount* _kiss;
|
||||
wxUI* _wxUI;
|
||||
wxBitmapButton* _KissButton;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -38,7 +38,7 @@ EVT_CHECKLISTBOX(SHARED_WITH_ID, PreferencesPanel::OnSharedChange)
|
|||
EVT_SHOW(PreferencesPanel::OnShow)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _kiss(kiss), _wxUI(parent), _sharedWith(NULL), _curAccountRow(-1)
|
||||
PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _sharedWith(NULL), _curAccountRow(-1)
|
||||
{
|
||||
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *hbox1 = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -160,8 +160,24 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p
|
|||
|
||||
Fit();
|
||||
SetMinSize(GetSize());
|
||||
}
|
||||
|
||||
Hide();
|
||||
KissPanel* PreferencesPanel::CreatePanel()
|
||||
{
|
||||
return new PreferencesPanel(_kiss, _wxUI);
|
||||
}
|
||||
|
||||
wxBitmapButton* PreferencesPanel::GetButton(int id)
|
||||
{
|
||||
if (!_KissButton)
|
||||
_KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(PREFS_ICON)), wxDefaultPosition, wxSize(128, 128));
|
||||
|
||||
return _KissButton;
|
||||
}
|
||||
|
||||
wxString PreferencesPanel::GetToolTip()
|
||||
{
|
||||
return _("Preferences");
|
||||
}
|
||||
|
||||
void PreferencesPanel::InitAccounts(User* user)
|
||||
|
|
|
@ -31,20 +31,22 @@
|
|||
#include <wx/colordlg.h>
|
||||
#include <wx/fontdlg.h>
|
||||
|
||||
#include <controller/KissCount.h>
|
||||
#include "wxUI.h"
|
||||
#include "view.h"
|
||||
#include <model/model.h>
|
||||
#include "PasswordDialog.h"
|
||||
#include "SupportedLanguages.h"
|
||||
#include "wxGridCellStarEditor.h"
|
||||
|
||||
class wxUI;
|
||||
class KissCount;
|
||||
|
||||
class PreferencesPanel: public wxPanel
|
||||
class PreferencesPanel: public KissPanel
|
||||
{
|
||||
public:
|
||||
PreferencesPanel(KissCount* kiss, wxUI *parent);
|
||||
|
||||
KissPanel* CreatePanel();
|
||||
wxBitmapButton* GetButton(int id);
|
||||
wxString GetToolTip();
|
||||
void OnShow(wxShowEvent& event);
|
||||
|
||||
void ChangeUser();
|
||||
|
||||
void OnAccountModified(wxGridEvent& event);
|
||||
|
@ -55,12 +57,9 @@ public:
|
|||
void OnChangePassword(wxCommandEvent& event);
|
||||
void OnOperationOrderChange(wxCommandEvent& event);
|
||||
void OnLanguageChange(wxCommandEvent& event);
|
||||
void OnShow(wxShowEvent& event);
|
||||
void OnKillMe(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
KissCount* _kiss;
|
||||
wxUI* _wxUI;
|
||||
wxGrid* _accountsGrid;
|
||||
wxGrid* _categoriesGrid;
|
||||
wxTextCtrl* _name;
|
||||
|
|
|
@ -34,7 +34,7 @@ END_EVENT_TABLE()
|
|||
s.Replace(wxT("\\\'"), wxT("\'"), true); \
|
||||
}
|
||||
|
||||
SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*parent)), _kiss(kiss), _wxUI(parent), _operations(NULL)
|
||||
SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _operations(NULL)
|
||||
{
|
||||
DEFAULT_FONT(font);
|
||||
User* user = _kiss->GetUser();
|
||||
|
@ -117,8 +117,6 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*pa
|
|||
|
||||
SetMinSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25));
|
||||
SetScrollbars(10, 10, 100/10, 100/10);
|
||||
|
||||
Hide();
|
||||
}
|
||||
|
||||
SearchPanel::~SearchPanel()
|
||||
|
@ -126,6 +124,24 @@ SearchPanel::~SearchPanel()
|
|||
if (_operations) delete _operations;
|
||||
}
|
||||
|
||||
KissPanel* SearchPanel::CreatePanel()
|
||||
{
|
||||
return new SearchPanel(_kiss, _wxUI);
|
||||
}
|
||||
|
||||
wxBitmapButton* SearchPanel::GetButton(int id)
|
||||
{
|
||||
if (!_KissButton)
|
||||
_KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(SEARCH_ICON)), wxDefaultPosition, wxSize(128, 128));
|
||||
|
||||
return _KissButton;
|
||||
}
|
||||
|
||||
wxString SearchPanel::GetToolTip()
|
||||
{
|
||||
return _("Search");
|
||||
}
|
||||
|
||||
void SearchPanel::OnButtonSearch(wxCommandEvent& event)
|
||||
{
|
||||
wxString *description=NULL, *amountFrom=NULL, *amountTo=NULL;
|
||||
|
|
|
@ -24,35 +24,33 @@
|
|||
#include <wx/grid.h>
|
||||
#include <wx/treectrl.h>
|
||||
#include <wx/scrolwin.h>
|
||||
#include "view.h"
|
||||
#include "grid/CalendarEditor.h"
|
||||
#include "grid/wxGridCellBitmapRenderer.h"
|
||||
#include "AccountPanel.h"
|
||||
#include "grid/GridAccount.h"
|
||||
#include "view.h"
|
||||
#include "AccountPanel.h"
|
||||
|
||||
#include <controller/KissCount.h>
|
||||
#include "wxUI.h"
|
||||
#include <model/model.h>
|
||||
|
||||
class wxUI;
|
||||
class KissCount;
|
||||
class GridAccount;
|
||||
|
||||
class SearchPanel: public wxScrolledWindow
|
||||
class SearchPanel: public KissPanel
|
||||
{
|
||||
public:
|
||||
SearchPanel(KissCount* kiss, wxUI *parent);
|
||||
~SearchPanel();
|
||||
|
||||
KissPanel* CreatePanel();
|
||||
wxBitmapButton* GetButton(int id);
|
||||
wxString GetToolTip();
|
||||
void OnShow(wxShowEvent& event);
|
||||
|
||||
void OnButtonSearch(wxCommandEvent& event);
|
||||
void OnOperationModified(wxGridEvent& event);
|
||||
void OnShow(wxShowEvent& event);
|
||||
void OnCalendarFromChange(wxCalendarEvent& event);
|
||||
void OnCalendarToChange(wxCalendarEvent& event);
|
||||
|
||||
private:
|
||||
KissCount* _kiss;
|
||||
wxUI* _wxUI;
|
||||
std::vector<Operation> *_operations;
|
||||
wxCalendarCtrl* _calendarFrom, *_calendarTo;
|
||||
GridAccount *_grid;
|
||||
|
|
|
@ -26,7 +26,7 @@ EVT_CHOICE(RANGE_ID, StatsPanel::OnRangeChange)
|
|||
EVT_CHECKLISTBOX(ACCOUNTS_ID, StatsPanel::OnAccountsChange)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _kiss(kiss), _wxUI(parent), _plot(NULL), _chart(NULL)
|
||||
StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _plot(NULL), _chart(NULL)
|
||||
{
|
||||
wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
|
||||
_hbox2 = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -138,8 +138,24 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _ki
|
|||
OnRangeChange(event);
|
||||
|
||||
Fit();
|
||||
}
|
||||
|
||||
Hide();
|
||||
KissPanel* StatsPanel::CreatePanel()
|
||||
{
|
||||
return new StatsPanel(_kiss, _wxUI);
|
||||
}
|
||||
|
||||
wxBitmapButton* StatsPanel::GetButton(int id)
|
||||
{
|
||||
if (!_KissButton)
|
||||
_KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(STATS_ICON)), wxDefaultPosition, wxSize(128, 128));
|
||||
|
||||
return _KissButton;
|
||||
}
|
||||
|
||||
wxString StatsPanel::GetToolTip()
|
||||
{
|
||||
return _("Statistics");
|
||||
}
|
||||
|
||||
void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearTo)
|
||||
|
|
|
@ -34,24 +34,20 @@
|
|||
#include <wx/category/categorysimpledataset.h>
|
||||
|
||||
#include <controller/KissCount.h>
|
||||
#include "wxUI.h"
|
||||
#include <model/model.h>
|
||||
#include "view.h"
|
||||
#include <model/model.h>
|
||||
|
||||
class wxUI;
|
||||
class KissCount;
|
||||
|
||||
class StatsPanel: public wxPanel //public wxScrolledWindow
|
||||
class StatsPanel: public KissPanel
|
||||
{
|
||||
public:
|
||||
StatsPanel(KissCount* kiss, wxUI *parent);
|
||||
//~StatsPanel();
|
||||
|
||||
KissPanel* CreatePanel();
|
||||
wxBitmapButton* GetButton(int id);
|
||||
wxString GetToolTip();
|
||||
void OnShow(wxShowEvent& event);
|
||||
|
||||
private:
|
||||
KissCount* _kiss;
|
||||
wxUI* _wxUI;
|
||||
wxCalendarCtrl* _calendarFrom, *_calendarTo;
|
||||
wxChoice* _monthFrom, *_yearFrom, *_monthTo, *_yearTo;
|
||||
wxGrid *_statsGrid;
|
||||
|
|
|
@ -38,4 +38,6 @@
|
|||
#define ABOUT_ICON "ressources/icons/windows-users-icon.png"
|
||||
#define QUIT_ICON "ressources/icons/system-log-out.png"
|
||||
|
||||
#include "KissPanel.h"
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user