source: filezilla/trunk/fuentes/src/interface/statusbar.h @ 130

Last change on this file since 130 was 130, checked in by jrpelegrina, 4 years ago

First release to xenial

File size: 3.1 KB
Line 
1#ifndef __STATUSBAR_H__
2#define __STATUSBAR_H__
3
4#include <option_change_event_handler.h>
5#include "sizeformatting.h"
6#include "state.h"
7
8#include <wx/timer.h>
9
10enum widgets
11{
12        widget_led_send,
13        widget_led_recv,
14        widget_speedlimit,
15        widget_datatype,
16        widget_encryption,
17
18        WIDGET_COUNT
19};
20
21class wxStatusBarEx : public wxStatusBar
22{
23public:
24        wxStatusBarEx(wxTopLevelWindow* parent);
25        virtual ~wxStatusBarEx();
26
27        // We override these for two reasons:
28        // - wxWidgets does not provide a function to get the field widths back
29        // - fixup for last field. Under MSW it has a gripper if window is not
30        //   maximized, under GTK2 it always has a gripper. These grippers overlap
31        //   last field.
32        virtual void SetFieldsCount(int number = 1, const int* widths = NULL);
33        virtual void SetStatusWidths(int n, const int *widths);
34
35        virtual void SetFieldWidth(int field, int width);
36
37        int GetGripperWidth();
38
39#ifdef __WXGTK__
40        // Basically identical to the wx one, but not calling Update
41        virtual void SetStatusText(const wxString& text, int number = 0);
42#endif
43
44protected:
45        int GetFieldIndex(int field);
46
47        wxTopLevelWindow* m_pParent;
48#ifdef __WXMSW__
49        bool m_parentWasMaximized;
50#endif
51
52        void FixupFieldWidth(int field);
53
54        int* m_columnWidths;
55
56        DECLARE_EVENT_TABLE()
57        void OnSize(wxSizeEvent& event);
58};
59
60class CWidgetsStatusBar : public wxStatusBarEx
61{
62public:
63        CWidgetsStatusBar(wxTopLevelWindow* parent);
64        virtual ~CWidgetsStatusBar();
65
66        // Adds a child window that gets repositioned on window resize
67        // Positioned in the field given in the constructor,
68        // right aligned and in reverse order.
69        bool AddField(int field, int idx, wxWindow* pChild);
70
71        void RemoveField(int idx);
72
73        virtual void SetFieldWidth(int field, int width);
74protected:
75
76        struct t_statbar_child
77        {
78                int field;
79                wxWindow* pChild;
80        };
81
82        std::map<int, struct t_statbar_child> m_children;
83
84        void PositionChildren(int field);
85
86        DECLARE_EVENT_TABLE()
87        void OnSize(wxSizeEvent& event);
88};
89
90class CStatusBar : public CWidgetsStatusBar, protected COptionChangeEventHandler, protected CStateEventHandler
91{
92public:
93        CStatusBar(wxTopLevelWindow* parent);
94        virtual ~CStatusBar();
95
96        void DisplayQueueSize(int64_t totalSize, bool hasUnknown);
97
98        void OnHandleLeftClick(wxWindow* wnd);
99        void OnHandleRightClick(wxWindow* wnd);
100
101protected:
102        void UpdateSizeFormat();
103        void DisplayDataType();
104        void DisplayEncrypted();
105        void UpdateSpeedLimitsIcon();
106
107        void MeasureQueueSizeWidth();
108
109        void ShowDataTypeMenu();
110
111        virtual void OnOptionsChanged(changed_options_t const& options);
112        virtual void OnStateChange(CState* pState, enum t_statechange_notifications notification, const wxString& data, const void* data2);
113
114        void DoDisplayQueueSize();
115
116        CSizeFormat::_format m_sizeFormat;
117        bool m_sizeFormatThousandsSep;
118        int m_sizeFormatDecimalPlaces;
119        int64_t m_size{};
120        bool m_hasUnknownFiles{};
121
122        wxStaticBitmap* m_pDataTypeIndicator{};
123        wxStaticBitmap* m_pEncryptionIndicator{};
124        wxStaticBitmap* m_pSpeedLimitsIndicator{};
125
126        wxTimer m_queue_size_timer;
127        bool m_queue_size_changed{};
128
129        DECLARE_EVENT_TABLE()
130        void OnSpeedLimitsEnable(wxCommandEvent& event);
131        void OnSpeedLimitsConfigure(wxCommandEvent& event);
132        void OnTimer(wxTimerEvent& ev);
133};
134
135#endif //__STATUSBAR_H__
Note: See TracBrowser for help on using the repository browser.