source: tags/arb-6.0.3/SECEDIT/SEC_graphic.hxx

Last change on this file was 11126, checked in by westram, 11 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1// =============================================================== //
2//                                                                 //
3//   File      : sec_graphic.hxx                                   //
4//   Purpose   : interface to structure GUI                        //
5//                                                                 //
6//   Institute of Microbiology (Technical University Munich)       //
7//   http://www.arb-home.de/                                       //
8//                                                                 //
9// =============================================================== //
10
11
12#ifndef SEC_GRAPHIC_HXX
13#define SEC_GRAPHIC_HXX
14
15#ifndef _GLIBCXX_CCTYPE
16#include <cctype>
17#endif
18#ifndef AWT_CANVAS_HXX
19#include <awt_canvas.hxx>
20#endif
21
22using namespace AW;
23
24// names for database:
25#define NAME_OF_STRUCT_SEQ      "_STRUCT"
26#define NAME_OF_REF_SEQ         "_REF"
27
28class SEC_root;
29
30enum SEC_update_request {
31    SEC_UPDATE_OK              = 0, // no update needed
32    SEC_UPDATE_ZOOM_RESET      = 1, // zoom reset needed
33    SEC_UPDATE_SHOWN_POSITIONS = 2, // recalculation of shown positions needed
34    SEC_UPDATE_RECOUNT         = 4, // complete relayout needed
35    SEC_UPDATE_RELOAD          = 8, // reload structure from DB
36};
37
38class SEC_base;
39
40class SEC_graphic : public AWT_graphic, virtual Noncopyable {
41    SEC_update_request  update_requested;
42    char               *load_error; // error occurred during load()
43
44    void update_structure() {}
45
46protected:
47
48    AW_device *disp_device; // device for recursive functions
49
50    GB_ERROR handleKey(AW_event_type event, AW_key_mod key_modifier, AW_key_code key_code, char key_char);
51    GB_ERROR handleMouse(AW_device *device, AW_event_type event, int button, AWT_COMMAND_MODE cmd, const Position& world, SEC_base *elem, int abspos);
52
53public:
54
55    GBDATA *gb_main;
56    AW_root *aw_root;
57    SEC_root *sec_root;
58
59    GBDATA *gb_struct;          // used to save the structure
60    GBDATA *gb_struct_ref;      // used to save reference numbers
61
62    mutable long last_saved;    // the transaction serial id when we last saved everything
63
64    // *********** public section
65    SEC_graphic(AW_root *aw_root, GBDATA *gb_main);
66    virtual ~SEC_graphic() OVERRIDE;
67
68    AW_gc_manager init_devices(AW_window *, AW_device *, AWT_canvas *scr) OVERRIDE;
69
70    virtual void show(AW_device *device) OVERRIDE;
71    virtual void info(AW_device *device, AW_pos x, AW_pos y, AW_clicked_line *cl, AW_clicked_text *ct) OVERRIDE;
72    void handle_command(AW_device *device, AWT_graphic_event& event) OVERRIDE;
73
74    GB_ERROR load(GBDATA *gb_main, const char *name, AW_CL cd1, AW_CL cd2) OVERRIDE; // load structure from DB
75    GB_ERROR save(GBDATA *gb_main, const char *name, AW_CL cd1, AW_CL cd2) OVERRIDE; // save structure to DB
76    int check_update(GBDATA *gb_main) OVERRIDE;  // perform requested updates
77    void update(GBDATA *gb_main) OVERRIDE;
78
79    GB_ERROR write_data_to_db(const char *data, const char *x_string) const;
80    GB_ERROR read_data_from_db(char **data, char **x_string) const;
81
82    void request_update(SEC_update_request req) { update_requested = static_cast<SEC_update_request>(update_requested|req); }
83};
84
85
86#endif
Note: See TracBrowser for help on using the repository browser.