summaryrefslogtreecommitdiff
path: root/helpbox.h
blob: 0b2037c43ca262b23c8e052e0a0fef980649ef26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef BDE_HELPBOX_H
#define BDE_HELPBOX_H

#include "editbox.h"
#include "label.h"

class Editor;

class HelpBox : public EditBox {

    Editor *app;
    Label statusmsg;

    int toc_first_line;
    int toc_last_line;
    std::vector<unistring> toc_items;
    
    struct Position {
	CombinedLine top_line;
	Point cursor;
    };
    static std::vector<Position> positions_stack;

public:

    HAS_ACTIONS_MAP(HelpBox, EditBox);
    HAS_BINDINGS_MAP(HelpBox, EditBox);

    HelpBox(Editor *aApp, const EditBox &settings);
    bool load_user_manual();
    void jump_to_topic(const char *topic);

    void exec();
    virtual bool handle_event(const Event &evt);

    INTERACTIVE void layout_windows();
    INTERACTIVE void refresh_and_center();
    void push_position();
    INTERACTIVE void pop_position();
    INTERACTIVE void move_to_toc();
    INTERACTIVE void jump_to_topic();

protected:

    void scan_toc();
    virtual void do_syntax_highlight(const unistring &str, 
	    AttributeArray &attributes, int para_num);
};

#endif