Whitespace
[amule.git] / src / utils / wxCas / src / wxcasframe.h
blob564cdbf5bb2882fae43ff18a4efa542d7e418e64
1 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 /// Name: wxCasFrame Class
3 ///
4 /// Purpose: wxCas main frame
5 ///
6 /// Author: ThePolish <thepolish@vipmail.ru>
7 ///
8 /// Copyright (c) 2004-2011 ThePolish ( thepolish@vipmail.ru )
9 ///
10 /// Derived from CAS by Pedro de Oliveira <falso@rdk.homeip.net>
11 ///
12 /// Pixmaps from aMule http://www.amule.org
13 ///
14 /// This program is free software; you can redistribute it and/or modify
15 /// it under the terms of the GNU General Public License as published by
16 /// the Free Software Foundation; either version 2 of the License, or
17 /// (at your option) any later version.
18 ///
19 /// This program is distributed in the hope that it will be useful,
20 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
21 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 /// GNU General Public License for more details.
23 ///
24 /// You should have received a copy of the GNU General Public License
25 /// along with this program; if not, write to the
26 /// Free Software Foundation, Inc.,
27 /// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
30 #ifndef _WXCASFRAME_H
31 #define _WXCASFRAME_H
34 #include <wx/bitmap.h>
35 #include <wx/button.h>
36 #include <wx/filename.h>
37 #include <wx/frame.h>
38 #include <wx/panel.h>
39 #include <wx/sizer.h>
40 #include <wx/statbox.h>
41 #include <wx/statline.h>
42 #include <wx/stattext.h>
43 #include <wx/timer.h>
44 #include <wx/toolbar.h>
47 #include "onlinesig.h"
49 #ifdef __LINUX__ // System monitoring on Linux
50 #include "linuxmon.h"
51 #endif
53 /// Main wxCas Frame
54 class WxCasFrame: public wxFrame
56 private:
57 wxToolBar *m_toolbar;
58 wxBitmap m_toolBarBitmaps[ 6 ];
60 wxBoxSizer *m_frameVBox;
61 wxBoxSizer *m_mainPanelVBox;
63 wxPanel *m_mainPanel;
65 wxStaticLine *m_staticLine;
66 #ifdef __WINDOWS__
68 wxStaticLine *m_BottomStaticLine;
69 #endif
71 wxStaticBox *m_sigPanelSBox;
72 wxStaticBoxSizer *m_sigPanelSBoxSizer;
74 wxStaticBox *m_monPanelSBox;
75 wxStaticBoxSizer *m_monPanelSBoxSizer;
77 wxStaticBox *m_hitPanelSBox;
78 wxStaticBoxSizer *m_hitPanelSBoxSizer;
80 wxStaticBox *m_absHitPanelSBox;
81 wxStaticBoxSizer *m_absHitPanelSBoxSizer;
83 wxStaticText *m_statLine_1;
84 wxStaticText *m_statLine_2;
85 wxStaticText *m_statLine_3;
86 wxStaticText *m_statLine_4;
87 wxStaticText *m_statLine_5;
88 wxStaticText *m_statLine_6;
89 wxStaticText *m_statLine_7;
91 wxStaticText *m_absHitLine;
92 wxButton *m_absHitButton;
94 wxStaticText *m_hitLine;
95 wxButton *m_hitButton;
98 wxTimer * m_refresh_timer;
99 wxTimer * m_ftp_update_timer;
101 OnLineSig *m_aMuleSig;
102 unsigned int m_maxLineCount;
104 #ifdef __LINUX__ // System monitoring on Linux
106 wxStaticText *m_sysLine_1;
107 wxStaticText *m_sysLine_2;
108 LinuxMon *m_sysMonitor;
109 #endif
111 enum
113 ID_BAR_REFRESH = 1000,
114 ID_BAR_SAVE,
115 ID_BAR_PRINT,
116 ID_BAR_PREFS,
117 ID_BAR_ABOUT,
118 ID_REFRESH_TIMER,
119 ID_FTP_UPDATE_TIMER,
120 ID_HIT_BUTTON,
121 ID_ABS_HIT_BUTTON
124 // Get maximum of 2 uint
125 unsigned int GetMaxUInt( const unsigned int a, const unsigned int b )
127 return ( ( a ) > ( b ) ? ( a ) : ( b ) );
130 // Constructing Stat_lines
131 wxString MakeStatLine_1() const;
132 wxString MakeStatLine_2() const;
133 wxString MakeStatLine_3() const;
134 wxString MakeStatLine_4() const;
135 wxString MakeStatLine_5() const;
136 wxString MakeStatLine_6() const;
137 wxString MakeStatLine_7() const;
139 // Constructing Hits_lines
140 wxString MakeHitsLine_1() const;
141 wxString MakeHitsLine_2() const;
143 #ifdef __LINUX__ // System monitoring on Linux
144 // Constructing Sys_lines
145 wxString MakeSysLine_1() const;
146 wxString MakeSysLine_2() const;
147 #endif
149 protected:
150 bool UpdateStatsPanel ();
151 void UpdateAll ( bool forceFitting = FALSE );
152 void SaveAbsoluteHits();
154 void OnBarRefresh ( wxCommandEvent & event );
155 void OnBarAbout ( wxCommandEvent & event );
156 void OnBarSave ( wxCommandEvent & event );
157 void OnBarPrint ( wxCommandEvent & event );
158 void OnBarPrefs ( wxCommandEvent & event );
159 void OnRefreshTimer ( wxTimerEvent & event );
160 void OnFtpUpdateTimer ( wxTimerEvent & event );
161 void OnHitButton ( wxCommandEvent & event );
162 void OnAbsHitButton ( wxCommandEvent & event );
164 DECLARE_EVENT_TABLE ()
166 public:
167 /// Constructor
168 WxCasFrame ( const wxString& title );
170 /// Destructor
171 ~WxCasFrame ();
173 /// Get Online statistics image
174 wxImage *GetStatImage () const;
176 /// Refresh timer period changing
177 bool ChangeRefreshPeriod( const int newPeriod );
179 /// Refresh timer period changing
180 bool ChangeFtpUpdatePeriod( const int newPeriod );
182 /// Set amulesig.dat file
183 void SetAmuleSigFile( const wxFileName& file );
186 #endif /* _WXCASFRAME_H */
187 // File_checked_for_headers