~efargaspro/+junk/codeblocks-16.01-release

« back to all changes in this revision

Viewing changes to src/include/infowindow.h

  • Committer: damienlmoore at gmail
  • Date: 2016-02-02 02:43:22 UTC
  • Revision ID: damienlmoore@gmail.com-20160202024322-yql5qmtbwdyamdwd
Code::BlocksĀ 16.01

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
 
3
 * http://www.gnu.org/licenses/lgpl-3.0.html
 
4
 */
 
5
 
 
6
/*
 
7
 * Objects of type InfoWindow are autonomous and must therefore always be instantiated using operator new.
 
8
 * In addition to this, InfoWindow does not have any non-static public class members.
 
9
 *
 
10
 * Since a (technically 100% correct) statement like
 
11
 *   new InfoWindow("foo", "bar");
 
12
 * is unintuitive, confusing or even objective to some people, this class uses a variation of the "Named Constructor Idiom".
 
13
 *
 
14
 * InfoWindow::Display("foo", "bar");
 
15
 * does the exact same thing as the above statement but looks a lot nicer.
 
16
 */
 
17
 
 
18
#ifndef INFOWINDOW_H
 
19
#define INFOWINDOW_H
 
20
 
 
21
#include <wx/event.h>
 
22
#include <wx/timer.h>
 
23
#include <wx/string.h>
 
24
 
 
25
#include "settings.h" // DLLIMPORT
 
26
 
 
27
#if wxUSE_POPUPWIN
 
28
    #include <wx/popupwin.h>
 
29
    typedef wxPopupWindow wxInfoWindowBase;
 
30
#else
 
31
    #include "scrollingdialog.h"
 
32
    typedef wxScrollingDialog wxInfoWindowBase;
 
33
#endif
 
34
 
 
35
#undef new
 
36
#include <list>
 
37
#include <algorithm>
 
38
 
 
39
class DLLIMPORT InfoWindow : public wxInfoWindowBase
 
40
{
 
41
        InfoWindow(const wxString& title, const wxString& message, unsigned int delay, unsigned int hysteresis);
 
42
        virtual ~InfoWindow();
 
43
        void OnTimer(wxTimerEvent& e);
 
44
        void OnMove(wxMouseEvent& e);
 
45
        void OnClick(wxMouseEvent& e);
 
46
 
 
47
    public:
 
48
        static void Display(const wxString& title, const wxString& message,
 
49
                            unsigned int delay = 5000, unsigned int hysteresis = 1);
 
50
    private:
 
51
        wxTimer *m_timer;
 
52
        int left;
 
53
        int top;
 
54
        int hMin;
 
55
        int pos;
 
56
        unsigned int status;
 
57
        unsigned int m_delay;
 
58
        unsigned int ks;
 
59
        std::list<wxString>::iterator my_message_iterator;
 
60
    private:
 
61
        DECLARE_EVENT_TABLE()
 
62
};
 
63
 
 
64
#endif