source: branches/species/SL/MASKS/input_mask.hxx

Last change on this file was 19654, checked in by westram, 5 weeks ago
  • reintegrates 'macros' into 'trunk'
    • improves program termination (#867)
      • introduces MacroExitor classes
        • handles confirmation (to quit)
        • waits for macros to finish, then exits w/o confirmation
        • provides specialized termination for different programs via derived classes
          • has been implemented for "normal" arb and merge-tool.
      • introduces ARB_disconnect_from_db
        • generalizes code to terminate all interconnections between GUI, database and macro-ability
        • allow to install atdisconnect-callbacks
          • usable by modules operating on a database; allow to inform module that database will vanish.
        • now used by all arb applications to disconnect from all their database(s), except the properties.
    • fixes some broken behavior
      • merge-tool
        • crashed when quitting via macro
        • wrong restarts, if originally started with arguments,
      • importer
        • failed to record/playback macros
        • crashed in modules operating on the temporary import database
      • database browser
        • crashed on disappearing database
  • adds: log:branches/macros@19620:19653
  • 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);
80
81// open database viewer using input-mask-file
82GB_ERROR AWT_initialize_input_mask(AW_root *root, GBDATA *gb_main, const awt_item_type_selector *sel, const char* mask_name, bool localMask);
83
84// ----------------------------------------
85
86class awt_input_mask_descriptor FINAL_TYPE {
87private:
88    char *title;                // title of the input mask
89    char *internal_maskname;    // starts with 0 for local mask and with 1 for global mask
90    // followed by file name w/o path
91    char *itemtypename;         // name of the itemtype
92    bool  local_mask;           // true if mask file was found in "$ARB_PROP/inputMasks"
93    bool  hidden;               // if true, mask is NOT shown in Menus
94
95public:
96    awt_input_mask_descriptor(const char *title_, const char *maskname_, const char *itemtypename_, bool local, bool hidden_);
97    awt_input_mask_descriptor(const awt_input_mask_descriptor& other);
98    virtual ~awt_input_mask_descriptor();
99
100    awt_input_mask_descriptor& operator = (const awt_input_mask_descriptor& other);
101
102    const char *get_title() const { return title; }
103    const char *get_maskname() const { return internal_maskname+1; }
104    const char *get_internal_maskname() const { return internal_maskname; }
105    const char *get_itemtypename() const { return itemtypename; }
106
107    bool is_local_mask() const { return local_mask; }
108    bool is_hidden() const { return hidden; }
109};
110
111const awt_input_mask_descriptor *AWT_look_input_mask(int id); // id starts with 0; returns 0 if no more masks
112
113
114#else
115#error input_mask.hxx included twice
116#endif // INPUT_MASK_HXX
117
Note: See TracBrowser for help on using the repository browser.