source: trunk/SL/MASKS/input_mask.hxx

Last change on this file was 19598, checked in by westram, 2 weeks ago
  • move rest of awt.hxx to input_mask.hxx.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.4 KB
Line 
1//  ==================================================================== //
2//                                                                       //
3//    File      : input_mask.hxx                                         //
4//    Purpose   : General input masks                                    //
5//                                                                       //
6//                                                                       //
7//  Coded by Ralf Westram (coder@reallysoft.de) in August 2001           //
8//  Copyright Department of Microbiology (Technical University Munich)   //
9//                                                                       //
10//  Visit our web site at: http://www.arb-home.de/                       //
11//                                                                       //
12//                                                                       //
13//  ==================================================================== //
14
15#ifndef INPUT_MASK_HXX
16#define INPUT_MASK_HXX
17
18#ifndef _GLIBCXX_STRING
19#include <string>
20#endif
21#ifndef AW_BASE_HXX
22#include <aw_base.hxx>
23#endif
24#ifndef CB_H
25#include <cb.h>
26#endif
27
28
29enum awt_item_type {
30    AWT_IT_UNKNOWN,
31    AWT_IT_SPECIES,
32    AWT_IT_ORGANISM,
33    AWT_IT_GENE,
34    AWT_IT_EXPERIMENT,
35
36    AWT_IT_TYPES
37};
38
39//  -------------------------------------
40//      class awt_item_type_selector
41//  -------------------------------------
42// awt_item_type_selector is an interface for specific item-types
43//
44// derive from awt_item_type_selector to get the functionality for
45// other item types.
46//
47// (implemented for Species in nt_item_type_species_selector (see NTREE/NT_extern.cxx) )
48//
49
50class awt_item_type_selector {
51private:
52    awt_item_type my_type;
53public:
54    awt_item_type_selector(awt_item_type for_type) : my_type(for_type) {}
55    virtual ~awt_item_type_selector() {}
56
57    awt_item_type get_item_type() const { return my_type; }
58
59    // add/remove callbacks to awars (i.e. to AWAR_SPECIES_NAME)
60    void add_awar_callbacks(AW_root *root, const RootCallback& cb) const;
61    void remove_awar_callbacks(AW_root *root, const RootCallback& cb) const;
62
63    // returns the current item
64    virtual GBDATA *current(AW_root *root, GBDATA *gb_main) const = 0;
65
66    // returns the keypath for items
67    virtual const char *getKeyPath() const = 0;
68
69    // returns the name of an awar containing the name of the current item
70    virtual const char *get_self_awar() const = 0;
71
72    // returns the maximum length of the name of the current item
73    virtual size_t get_self_awar_content_length() const = 0;
74};
75
76typedef void (*AWT_OpenMaskWindowCallback)(AW_window* aww, int id, GBDATA *gb_main);
77
78awt_item_type AWT_getItemType(const std::string& itemtype_name);
79void          AWT_create_mask_submenu(class AW_window_menu_modes *awm, awt_item_type wanted_item_type, AWT_OpenMaskWindowCallback open_mask_window_cb, GBDATA *gb_main);
80void          AWT_destroy_input_masks();
81
82// open database viewer using input-mask-file
83GB_ERROR AWT_initialize_input_mask(AW_root *root, GBDATA *gb_main, const awt_item_type_selector *sel, const char* mask_name, bool localMask);
84
85// ----------------------------------------
86
87class awt_input_mask_descriptor FINAL_TYPE {
88private:
89    char *title;                // title of the input mask
90    char *internal_maskname;    // starts with 0 for local mask and with 1 for global mask
91    // followed by file name w/o path
92    char *itemtypename;         // name of the itemtype
93    bool  local_mask;           // true if mask file was found in "$ARB_PROP/inputMasks"
94    bool  hidden;               // if true, mask is NOT shown in Menus
95
96public:
97    awt_input_mask_descriptor(const char *title_, const char *maskname_, const char *itemtypename_, bool local, bool hidden_);
98    awt_input_mask_descriptor(const awt_input_mask_descriptor& other);
99    virtual ~awt_input_mask_descriptor();
100
101    awt_input_mask_descriptor& operator = (const awt_input_mask_descriptor& other);
102
103    const char *get_title() const { return title; }
104    const char *get_maskname() const { return internal_maskname+1; }
105    const char *get_internal_maskname() const { return internal_maskname; }
106    const char *get_itemtypename() const { return itemtypename; }
107
108    bool is_local_mask() const { return local_mask; }
109    bool is_hidden() const { return hidden; }
110};
111
112const awt_input_mask_descriptor *AWT_look_input_mask(int id); // id starts with 0; returns 0 if no more masks
113
114
115#else
116#error input_mask.hxx included twice
117#endif // INPUT_MASK_HXX
118
Note: See TracBrowser for help on using the repository browser.