Bumped copyright dates for 2013
[barry.git] / desktop / src / BaseFrame.h
blob8658c2eca5415e03b6ae715b22c1bb8a8555797d
1 ///
2 /// \file BaseFrame.h
3 /// Class for the fixed-size frame that holds the main app
4 ///
6 /*
7 Copyright (C) 2009-2013, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRYDESKTOP_BASEFRAME_H__
23 #define __BARRYDESKTOP_BASEFRAME_H__
25 #include <wx/wx.h>
26 #include <wx/process.h>
27 #include <memory>
28 #include <barry/pin.h>
29 #include "exechelper.h"
31 #define MAIN_HEADER_OFFSET 40
33 class MainMenuMode;
34 class SyncMode;
35 class BrowseMode;
36 class ClickableImage;
37 class Mode;
39 class BaseFrame : public wxFrame, public TermCatcher
41 private:
42 DECLARE_EVENT_TABLE() // sets to protected:
44 private:
45 std::auto_ptr<wxBitmap> m_background;
46 std::auto_ptr<MainMenuMode> m_main_menu_mode;// only this mode is
47 // never reset()
48 std::auto_ptr<SyncMode> m_sync_mode;
49 std::auto_ptr<BrowseMode> m_browse_mode;
50 std::auto_ptr<ClickableImage> m_barry_logo, m_netdirect_logo;
51 std::auto_ptr<wxMenu> m_sysmenu;
52 std::auto_ptr<wxComboBox> m_device_combo;
53 std::auto_ptr<wxButton> m_back_button;
54 int m_width, m_height;
56 Mode *m_current_mode;
58 ExecHelper m_backup_process;
60 bool m_rescan_pending;
62 public:
63 BaseFrame(const wxImage &background);
65 // utility functions
66 void UpdateMenuState();
67 void CreateDeviceCombo(Barry::Pin pin = Barry::Pin());
68 Barry::Pin GetCurrentComboPin();
69 void EnableBackButton(Mode *new_mode);
70 void DisableBackButton(); // also returns to the main menu
72 // events
73 void OnSize(wxSizeEvent &event);
74 void OnPaint(wxPaintEvent &event);
75 void OnMouseMotion(wxMouseEvent &event);
76 void OnLeftDown(wxMouseEvent &event);
77 void OnLeftUp(wxMouseEvent &event);
78 void OnBackupRestore(wxCommandEvent &event);
79 void OnSync(wxCommandEvent &event);
80 void OnModem(wxCommandEvent &event);
81 void OnAppLoader(wxCommandEvent &event);
82 void OnMigrateDevice(wxCommandEvent &event);
83 void OnBrowseDatabases(wxCommandEvent &event);
84 void OnMediaManagement(wxCommandEvent &event);
85 void OnMisc(wxCommandEvent &event);
86 void OnBackButton(wxCommandEvent &event);
87 void OnTermBackupAndRestore(wxProcessEvent &event);
88 void OnBarryLogoClicked(wxCommandEvent &event);
89 void OnNetDirectLogoClicked(wxCommandEvent &event);
90 void OnDeviceComboChange(wxCommandEvent &event);
92 // sys menu (triggered by the Barry logo)
93 void OnVerboseLogging(wxCommandEvent &event);
94 void OnRenameDevice(wxCommandEvent &event);
95 void OnResetDevice(wxCommandEvent &event);
96 void OnRescanUsb(wxCommandEvent &event);
97 void OnAbout(wxCommandEvent &event);
98 void OnExit(wxCommandEvent &event);
101 #endif