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

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

First release to xenial

File size: 1.7 KB
Line 
1#ifndef __WRAPENGINE_H__
2#define __WRAPENGINE_H__
3
4class CWrapEngine
5{
6public:
7        CWrapEngine();
8        virtual ~CWrapEngine() {}
9
10        bool LoadCache();
11
12        static void ClearCache();
13
14        enum wrap_result {
15                wrap_failed = 0x01,
16                wrap_didwrap = 0x02
17        };
18        // Find all wxStaticText controls in the given window(s) and wrap them, so
19        // that the window has the right aspect ratio...
20        bool WrapRecursive(wxWindow* wnd, double ratio, const char* name = "", wxSize canvas = wxSize(), wxSize minRequested = wxSize());
21        bool WrapRecursive(std::vector<wxWindow*>& windows, double ratio, const char* name = "", wxSize canvas = wxSize(), wxSize const& minRequested = wxSize());
22
23        // .. or does not exceed the given maximum length.
24        int WrapRecursive(wxWindow* wnd, wxSizer* sizer, int max);
25
26        // Find all wxStaticText controls in the window and unwrap them
27        bool UnwrapRecursive(wxWindow* wnd, wxSizer* sizer);
28
29        // Wrap the given text so its length in pixels does not exceed maxLength
30        bool WrapText(wxWindow* parent, wxString &text, unsigned long maxLength);
31        bool WrapTextChinese(wxWindow* parent, wxString &text, unsigned long maxLength);
32        bool WrapText(wxWindow* parent, int id, unsigned long maxLength);
33        wxString UnwrapText(const wxString& text);
34
35        int GetWidthFromCache(const char* name);
36
37        void CheckLanguage();
38
39protected:
40        void UnwrapRecursive_Wrapped(std::vector<int> const& wrapped, std::vector<wxWindow*> &windows, bool remove_fitting = false);
41
42        void SetWidthToCache(const char* name, int width);
43
44        std::map<wxChar, unsigned int> m_charWidths;
45
46        bool CanWrapBefore(const wxChar& c);
47        bool m_wrapOnEveryChar{};
48        const wxChar* m_noWrapChars{};
49
50        wxFont m_font;
51        int m_spaceWidth{-1};
52
53        static bool m_use_cache;
54};
55
56#endif //__WRAPENGINE_H__
Note: See TracBrowser for help on using the repository browser.