This commit is contained in:
2010-07-14 11:15:48 +02:00
parent e4a81539a1
commit 6ca15e23b0
7 changed files with 48 additions and 26 deletions

View File

@@ -22,8 +22,8 @@ along with KissCount. If not, see <http://www.gnu.org/licenses/>.
wxString months[12] ;
wxUI::wxUI(KissCount* kiss, const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame(NULL, -1, title, pos, size), _kiss(kiss), _accountPanel(NULL), _preferencesPanel(NULL), _curPanel(NULL),
_locale(NULL), _needReload(false)
: wxFrame(NULL, -1, title, pos, size), _kiss(kiss), _accountPanel(NULL), _searchPanel(NULL), _preferencesPanel(NULL),
_curPanel(NULL), _locale(NULL), _needReload(false)
{
_hbox = new wxBoxSizer(wxVERTICAL);
ButtonPanel* buttons = new ButtonPanel(_kiss, this);
@@ -50,6 +50,7 @@ wxUI::~wxUI()
{
if (_accountPanel) delete _accountPanel;
if (_preferencesPanel) delete _preferencesPanel;
if (_searchPanel) delete _searchPanel;
if (_locale) delete _locale;
}
@@ -111,6 +112,11 @@ void wxUI::ShowAccount()
ShowPanel(_accountPanel);
}
void wxUI::ShowSearch()
{
ShowPanel(_searchPanel);
}
void wxUI::ShowPreferences()
{
ShowPanel(_preferencesPanel);
@@ -138,18 +144,22 @@ void wxUI::LoadUser()
if (_preferencesPanel)
delete _preferencesPanel;
if (_searchPanel)
delete _searchPanel;
if (user->_preferences[wxT("language")] != wxT(""))
SetLanguage(user->GetLanguage());
_preferencesPanel = new PreferencesPanel(_kiss, this);
_accountPanel = new AccountPanel(_kiss, this);
_searchPanel = new SearchPanel(_kiss, this);
_preferencesPanel = new PreferencesPanel(_kiss, this);
ShowPanel(_accountPanel);
}
void wxUI::ShowPanel(wxPanel* panel)
{
int month, year, account=0, preferences=0;
int month, year, account=0, preferences=0, search=0;
wxShowEvent event;
if (!panel) return;
@@ -174,13 +184,20 @@ void wxUI::ShowPanel(wxPanel* panel)
preferences = 1;
}
if (panel == _searchPanel)
{
search = 1;
}
delete _accountPanel;
delete _preferencesPanel;
delete _searchPanel;
_accountPanel = new AccountPanel(_kiss, this);
if (year != -1)
_accountPanel->ShowMonth(month, year);
_preferencesPanel = new PreferencesPanel(_kiss, this);
_searchPanel = new SearchPanel(_kiss, this);
if (account)
{
@@ -192,7 +209,12 @@ void wxUI::ShowPanel(wxPanel* panel)
_preferencesPanel->OnShow(event);
panel = _preferencesPanel;
}
if (search)
{
_searchPanel->OnShow(event);
panel = _searchPanel;
}
_needReload = false;
}
@@ -221,8 +243,12 @@ void wxUI::KillMe()
if (_preferencesPanel)
delete _preferencesPanel;
if (_searchPanel)
delete _searchPanel;
_accountPanel = NULL;
_preferencesPanel = NULL;
_searchPanel = NULL;
}
void wxUI::NeedReload()