~ubuntu-branches/ubuntu/maverick/codelite/maverick

« back to all changes in this revision

Viewing changes to LiteEditor/cc_box.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-07-29 19:42:47 UTC
  • mfrom: (1.1.9 upstream) (18.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20100729194247-cuibfk03wog33nxq
Tags: 2.6.0.4189~dfsg-1
* New upstream release.
* Bump Standards.
* Refresh patches.
* Add license information about files under ./Debugger/

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//////////////////////////////////////////////////////////////////////////////
2
 
//////////////////////////////////////////////////////////////////////////////
3
 
//
4
 
// copyright            : (C) 2008 by Eran Ifrah
5
 
// file name            : cc_box.h
6
 
//
7
 
// -------------------------------------------------------------------------
8
 
// A
9
 
//              _____           _      _     _ _
10
 
//             /  __ \         | |    | |   (_) |
11
 
//             | /  \/ ___   __| | ___| |    _| |_ ___
12
 
//             | |    / _ \ / _  |/ _ \ |   | | __/ _ )
13
 
//             | \__/\ (_) | (_| |  __/ |___| | ||  __/
14
 
//              \____/\___/ \__,_|\___\_____/_|\__\___|
15
 
//
16
 
//                                                  F i l e
17
 
//
18
 
//    This program is free software; you can redistribute it and/or modify
19
 
//    it under the terms of the GNU General Public License as published by
20
 
//    the Free Software Foundation; either version 2 of the License, or
21
 
//    (at your option) any later version.
22
 
//
23
 
//////////////////////////////////////////////////////////////////////////////
24
 
//////////////////////////////////////////////////////////////////////////////
25
 
#ifndef __cc_box__
26
 
#define __cc_box__
27
 
 
28
 
/**
29
 
@file
30
 
Subclass of CCBoxBase, which is generated by wxFormBuilder.
31
 
*/
32
 
 
33
 
#include "cc_boxbase.h"
34
 
#include "entry.h"
35
 
#include <vector>
36
 
#include <map>
37
 
 
38
 
class LEditor;
39
 
 
40
 
/** Implementing CCBoxBase */
41
 
class CCBox : public CCBoxBase {
42
 
        int                      m_selectedItem;
43
 
        std::vector<TagEntryPtr> m_tags;
44
 
        bool                     m_showFullDecl;
45
 
        int                      m_height;
46
 
        bool                     m_autoHide;
47
 
        bool                     m_insertSingleChoice;
48
 
        std::map<wxString, int>  m_userImages;
49
 
        wxEvtHandler *           m_owner;
50
 
        bool                     m_constructing;
51
 
 
52
 
protected:
53
 
        // Handlers for CCBoxBase events.
54
 
        void OnItemActivated( wxListEvent& event );
55
 
        void OnItemDeSelected( wxListEvent& event );
56
 
        void OnItemSelected( wxListEvent& event );
57
 
 
58
 
        void OnShowPublicItems(wxCommandEvent& event);
59
 
 
60
 
protected:
61
 
        // helper methods
62
 
        int GetImageId(const TagEntry &entry);
63
 
        void SelectItem(long item);
64
 
        void Show(const wxString &word);
65
 
        void DoInsertSelection(const wxString &word, bool triggerTip = true);
66
 
 
67
 
public:
68
 
 
69
 
        /** Constructor */
70
 
        CCBox(LEditor* parent, bool autoHide = true, bool autoInsertSingleChoice = true);
71
 
 
72
 
        void HideCCBox();
73
 
        void Show(const std::vector<TagEntryPtr> &tags, const wxString &word, bool showFullDecl, wxEvtHandler *owner = NULL);
74
 
        void InsertSelection();
75
 
 
76
 
        void Adjust();
77
 
 
78
 
        // can this window have focus? (no)
79
 
        bool AcceptsFocus() const {
80
 
                return false;
81
 
        }
82
 
 
83
 
        bool SelectWord(const wxString &word);
84
 
        void Next();
85
 
        void Previous();
86
 
 
87
 
        //Setters
88
 
        void SetAutoHide(const bool& autoHide) {
89
 
                this->m_autoHide = autoHide;
90
 
        }
91
 
        void SetInsertSingleChoice(const bool& insertSingleChoice) {
92
 
                this->m_insertSingleChoice = insertSingleChoice;
93
 
        }
94
 
        //Getters
95
 
        const bool& GetAutoHide() const {
96
 
                return m_autoHide;
97
 
        }
98
 
        const bool& GetInsertSingleChoice() const {
99
 
                return m_insertSingleChoice;
100
 
        }
101
 
 
102
 
        /**
103
 
         * @brief register new user image fot TagEntry kind
104
 
         * @param kind the kind string that will be associated with the bitmap (TagEntry::GetKind())
105
 
         * @param bmp 16x16 bitmap
106
 
         */
107
 
        void RegisterImageForKind(const wxString &kind, const wxBitmap &bmp);
108
 
        void NextPage();
109
 
        void PreviousPage();
110
 
};
111
 
 
112
 
#endif // __cc_box__
 
1
//////////////////////////////////////////////////////////////////////////////
 
2
//////////////////////////////////////////////////////////////////////////////
 
3
//
 
4
// copyright            : (C) 2008 by Eran Ifrah
 
5
// file name            : cc_box.h
 
6
//
 
7
// -------------------------------------------------------------------------
 
8
// A
 
9
//              _____           _      _     _ _
 
10
//             /  __ \         | |    | |   (_) |
 
11
//             | /  \/ ___   __| | ___| |    _| |_ ___
 
12
//             | |    / _ \ / _  |/ _ \ |   | | __/ _ )
 
13
//             | \__/\ (_) | (_| |  __/ |___| | ||  __/
 
14
//              \____/\___/ \__,_|\___\_____/_|\__\___|
 
15
//
 
16
//                                                  F i l e
 
17
//
 
18
//    This program is free software; you can redistribute it and/or modify
 
19
//    it under the terms of the GNU General Public License as published by
 
20
//    the Free Software Foundation; either version 2 of the License, or
 
21
//    (at your option) any later version.
 
22
//
 
23
//////////////////////////////////////////////////////////////////////////////
 
24
//////////////////////////////////////////////////////////////////////////////
 
25
#ifndef __cc_box__
 
26
#define __cc_box__
 
27
 
 
28
/**
 
29
@file
 
30
Subclass of CCBoxBase, which is generated by wxFormBuilder.
 
31
*/
 
32
 
 
33
#include "cc_boxbase.h"
 
34
#include "comment_parser.h"
 
35
#include "entry.h"
 
36
#include <vector>
 
37
#include <map>
 
38
#include "wx/wxscintilla.h"
 
39
 
 
40
class LEditor;
 
41
 
 
42
/** Implementing CCBoxBase */
 
43
class CCBox : public CCBoxBase
 
44
{
 
45
        int                      m_selectedItem;
 
46
        std::vector<TagEntryPtr> m_tags;
 
47
        bool                     m_showFullDecl;
 
48
        int                      m_height;
 
49
        bool                     m_autoHide;
 
50
        bool                     m_insertSingleChoice;
 
51
        std::map<wxString, int>  m_userImages;
 
52
        wxEvtHandler *           m_owner;
 
53
        bool                     m_constructing;
 
54
        bool                     m_hideExtInfoPane;
 
55
        CommentParseResult       m_comments;
 
56
        int                      m_startPos;
 
57
        bool                     m_isTipBgDark;
 
58
        CCItemInfo               m_currentItem;
 
59
        LEditor*                 m_editor;
 
60
 
 
61
protected:
 
62
        LEditor*                 GetEditor();
 
63
 
 
64
protected:
 
65
        // Handlers for CCBoxBase events.
 
66
        void OnItemActivated( wxListEvent& event );
 
67
        void OnItemDeSelected( wxListEvent& event );
 
68
        void OnItemSelected( wxListEvent& event );
 
69
 
 
70
        void OnShowPublicItems(wxCommandEvent& event);
 
71
        void OnShowComments(wxCommandEvent& event);
 
72
        void OnTipClicked(wxScintillaEvent &event);
 
73
 
 
74
        void OnKeyDown(wxListEvent& event);
 
75
 
 
76
protected:
 
77
        // helper methods
 
78
        int GetImageId(TagEntryPtr entry);
 
79
        void SelectItem(long item);
 
80
        void Show(const wxString &word);
 
81
        void DoInsertSelection(const wxString &word, bool triggerTip = true);
 
82
        void DoFormatDescriptionPage(const CCItemInfo& tag);
 
83
        void DoShowTagTip();
 
84
        void DoHideCCHelpTab();
 
85
        void DoFilterCompletionEntries(CCItemInfo& item);
 
86
public:
 
87
        /** Constructor */
 
88
        CCBox(LEditor* parent, bool autoHide = true, bool autoInsertSingleChoice = true);
 
89
        virtual ~CCBox();
 
90
 
 
91
        void HideCCBox();
 
92
        void Show(const std::vector<TagEntryPtr> &tags, const wxString &word, bool showFullDecl, wxEvtHandler *owner = NULL);
 
93
        void InsertSelection();
 
94
 
 
95
        void Adjust();
 
96
 
 
97
        // can this window have focus? (no)
 
98
        bool AcceptsFocus() const {
 
99
                return false;
 
100
        }
 
101
 
 
102
        void EnableExtInfoPane();
 
103
        bool SelectWord(const wxString &word);
 
104
        void Next();
 
105
        void Previous();
 
106
 
 
107
        //Setters
 
108
        void SetAutoHide(const bool& autoHide) {
 
109
                this->m_autoHide = autoHide;
 
110
        }
 
111
        void SetInsertSingleChoice(const bool& insertSingleChoice) {
 
112
                this->m_insertSingleChoice = insertSingleChoice;
 
113
        }
 
114
        //Getters
 
115
        const bool& GetAutoHide() const {
 
116
                return m_autoHide;
 
117
        }
 
118
        const bool& GetInsertSingleChoice() const {
 
119
                return m_insertSingleChoice;
 
120
        }
 
121
 
 
122
        /**
 
123
         * @brief register new user image fot TagEntry kind
 
124
         * @param kind the kind string that will be associated with the bitmap (TagEntry::GetKind())
 
125
         * @param bmp 16x16 bitmap
 
126
         */
 
127
        void RegisterImageForKind(const wxString &kind, const wxBitmap &bmp);
 
128
        void NextPage();
 
129
        void PreviousPage();
 
130
};
 
131
 
 
132
#endif // __cc_box__