ARB
SEC_graphic.hxx
Go to the documentation of this file.
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 
22 using namespace AW;
23 
24 // names for database:
25 #define NAME_OF_STRUCT_SEQ "_STRUCT"
26 #define NAME_OF_REF_SEQ "_REF"
27 
28 class SEC_root;
29 
31  SEC_UPDATE_OK = 0, // no update needed
32  // bit '1' is unused atm
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 
38 class SEC_base;
39 
40 class SEC_graphic FINAL_TYPE : public AWT_graphic, virtual Noncopyable {
41  SEC_update_request update_requested;
42  char *load_error; // error occurred during load()
43 
44  void update_structure() OVERRIDE;
45 
46 protected:
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 
53 public:
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  ~SEC_graphic() OVERRIDE;
67 
68  AW_gc_manager *init_devices(AW_window *, AW_device *, AWT_canvas *scr) OVERRIDE;
69 
70  void show(AW_device *device) OVERRIDE;
71  void handle_command(AW_device *device, AWT_graphic_event& event) OVERRIDE;
72 
73  GB_ERROR load_from_DB(GBDATA *gb_main, const char *name) OVERRIDE; // load structure from DB
74  GB_ERROR save_to_DB(GBDATA *gb_main, const char *name) OVERRIDE; // save structure to DB
75  void check_for_DB_update(GBDATA *gb_main) OVERRIDE;
76  void notify_synchronized(GBDATA *gb_main) OVERRIDE;
77 
78  GB_ERROR write_data_to_db(const char *data, const char *x_string) const;
79  GB_ERROR read_data_from_db(char **data, char **x_string) const;
80 
81  void request_update(SEC_update_request req) {
82  update_requested = static_cast<SEC_update_request>(update_requested|req);
83  exports.request_structure_update();
84  }
85 };
86 
87 
88 #endif
AW_event_type
Definition: aw_window.hxx:62
SEC_update_request
Definition: SEC_graphic.hxx:30
AWT_COMMAND_MODE
Definition: awt_canvas.hxx:25
xml element
AW_key_code
Definition: aw_keysym.hxx:14
#define OVERRIDE
Definition: cxxforward.h:112
AW_key_mod
Definition: aw_keysym.hxx:46
GBDATA * gb_main
Definition: adname.cxx:32