~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxSmithContribItems/wxthings/wxthings/include/wx/things/dropdown.h

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/////////////////////////////////////////////////////////////////////////////
2
 
// Name:        DropDownBase
3
 
// Purpose:     base class for a control like a combobox
4
 
// Author:      John Labenski
5
 
// Modified by:
6
 
// Created:     11/05/2002
7
 
// Copyright:   (c) John Labenski
8
 
// Licence:     wxWidgets licence
9
 
/////////////////////////////////////////////////////////////////////////////
10
 
 
11
 
/*
12
 
 
13
 
YOU MUST USE A wxWIDGETS RELEASE NEWER THAN 1/29/05 - AFTER POPUPWINDOW FIX
14
 
 
15
 
DropDownBase is a class that has a DropDownPopup as a child. It works like a
16
 
wxComboBox in that there is a button to the right that you use to drop down
17
 
a window. You can put whatever you want in the DropDownPopup by calling
18
 
GetPopupWindow()->SetChild(win) in your DoShowPopup function.
19
 
Additionally, you'll want to put a window to the left of the dropdown button.
20
 
 
21
 
You need to subclass this to make a new control.
22
 
 
23
 
You need to override these function in DropDownBase
24
 
DoGetBestSize() let wxWidgets know how big this control wants to be
25
 
DoGetBestDropHeight(max) - max is the # pixels to bottom of screen, you probably want
26
 
    it smaller so return that height, return -1 if you don't want the popup shown.
27
 
DoShowPopup() - this is called from ShowPopup after creating the m_popupWin.
28
 
    Create your child window with the popup as the parent and call
29
 
    GetPopupWindow()->SetChild(win). Make sure you call
30
 
    DropDownBase::DoShowPopup() to have the popup window shown.
31
 
*/
32
 
 
33
 
#ifndef _WX_DROPDOWNBASE_H_
34
 
#define _WX_DROPDOWNBASE_H_
35
 
 
36
 
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
37
 
    #pragma interface "dropdown.h"
38
 
#endif
39
 
 
40
 
#include "wx/popupwin.h"
41
 
#include "wx/things/thingdef.h"
42
 
 
43
 
class WXDLLEXPORT wxTimer;
44
 
class WXDLLEXPORT wxTimerEvent;
45
 
class WXDLLEXPORT wxCustomButton;
46
 
class WXDLLIMPEXP_THINGS DropDownPopup;
47
 
 
48
 
#define DROPDOWN_DROP_WIDTH  14  // these are the default sizes
49
 
#define DROPDOWN_DROP_HEIGHT 22
50
 
 
51
 
//-----------------------------------------------------------------------------
52
 
// DropDownBase generic combobox type widget that drops down a DropDownPopup
53
 
//-----------------------------------------------------------------------------
54
 
 
55
 
class WXDLLIMPEXP_THINGS DropDownBase : public wxControl
56
 
{
57
 
public:
58
 
 
59
 
    DropDownBase() : wxControl() { Init(); }
60
 
 
61
 
    DropDownBase( wxWindow *parent, wxWindowID id = wxID_ANY,
62
 
                  const wxPoint& pos = wxDefaultPosition,
63
 
                  const wxSize& size = wxDefaultSize,
64
 
                  long style = 0,
65
 
                  const wxValidator& val = wxDefaultValidator,
66
 
                  const wxString& name = wxT("DropDownBase"))
67
 
                  : wxControl()
68
 
    {
69
 
        Init();
70
 
        Create(parent, id, pos, size, style, val, name);
71
 
    }
72
 
 
73
 
    virtual ~DropDownBase();
74
 
 
75
 
    bool Create(wxWindow* parent,
76
 
                wxWindowID id = wxID_ANY,
77
 
                const wxPoint& pos = wxDefaultPosition,
78
 
                const wxSize& size = wxDefaultSize,
79
 
                long style = 0,
80
 
                const wxValidator& val = wxDefaultValidator,
81
 
                const wxString& name = wxT("DropDownBase"));
82
 
 
83
 
    virtual bool ShowPopup();
84
 
    virtual void HidePopup();
85
 
    bool IsPopupShown();
86
 
 
87
 
    // implementation
88
 
    void OnDropButton( wxCommandEvent &event );
89
 
    wxCustomButton* GetDropDownButton() { return m_dropdownButton; }
90
 
    // Get the popup window, NULL when not shown
91
 
    DropDownPopup* GetPopupWindow() { return m_popupWin; }
92
 
 
93
 
protected:
94
 
    virtual void DoSetSize(int x, int y, int width, int height,
95
 
                           int sizeFlags = wxSIZE_AUTO);
96
 
 
97
 
    void OnSize( wxSizeEvent& event );
98
 
    virtual wxSize DoGetBestSize() const;
99
 
 
100
 
    virtual bool DoShowPopup();
101
 
 
102
 
    // override to set the height of the dropdown box
103
 
    //   input max_height is height from bottom of ctrl to bottom of screen
104
 
    //   return < 1 to not have the popup displayed
105
 
    virtual int DoGetBestDropHeight(int max_height) { return max_height; }
106
 
 
107
 
    wxCustomButton *m_dropdownButton;
108
 
    DropDownPopup *m_popupWin;
109
 
 
110
 
private:
111
 
    void Init();
112
 
    DECLARE_DYNAMIC_CLASS(DropDownBase)
113
 
    DECLARE_EVENT_TABLE()
114
 
};
115
 
 
116
 
//-----------------------------------------------------------------------------
117
 
// DropDownPopup generic popup window, call SetChild
118
 
//-----------------------------------------------------------------------------
119
 
 
120
 
class WXDLLIMPEXP_THINGS DropDownPopup : public wxPopupTransientWindow
121
 
{
122
 
public:
123
 
    DropDownPopup() : wxPopupTransientWindow() { Init(); }
124
 
    DropDownPopup(DropDownBase *parent, int style = wxBORDER_NONE) : wxPopupTransientWindow()
125
 
    {
126
 
        Init();
127
 
        Create(parent, style);
128
 
    }
129
 
    virtual ~DropDownPopup();
130
 
 
131
 
    bool Create(DropDownBase *parent, int style = wxBORDER_NONE);
132
 
 
133
 
    virtual void Popup(wxWindow *focus = NULL);
134
 
    virtual void Dismiss();
135
 
    virtual bool ProcessLeftDown(wxMouseEvent& event);
136
 
 
137
 
    virtual void SetChild(wxWindow *child);
138
 
    virtual wxWindow *GetChild() const { return m_childWin; }
139
 
    bool m_ignore_popup;
140
 
 
141
 
protected:
142
 
 
143
 
    // start/stop timer shat pushes and pops handler when the mouse goes over
144
 
    //  the scrollbars (if any) of the child window
145
 
    void StartTimer();
146
 
    void StopTimer();
147
 
    void PushPopupHandler(wxWindow* child);
148
 
    void PopPopupHandler(wxWindow* child);
149
 
 
150
 
    void OnMouse( wxMouseEvent& event );
151
 
    void OnKeyDown( wxKeyEvent &event );
152
 
    void OnTimer( wxTimerEvent& event );
153
 
    void OnIdle( wxIdleEvent& event );
154
 
 
155
 
    wxPoint       m_mouse;           // last/current mouse position
156
 
    wxWindow     *m_childWin;        // store our own child pointer
157
 
    DropDownBase *m_owner;
158
 
    wxTimer      *m_timer;           // timer for tracking mouse position
159
 
    bool          m_popped_handler;  // state of the event handler
160
 
 
161
 
private:
162
 
    void Init();
163
 
    DECLARE_DYNAMIC_CLASS(DropDownPopup)
164
 
    DECLARE_EVENT_TABLE()
165
 
};
166
 
 
167
 
#endif  // _WX_DROPDOWNBASE_H_