ARB
AliAdmin.h
Go to the documentation of this file.
1 // ============================================================== //
2 // //
3 // File : AliAdmin.h //
4 // Purpose : //
5 // //
6 // Coded by Ralf Westram (coder@reallysoft.de) in August 2014 //
7 // http://www.arb-home.de/ //
8 // //
9 // ============================================================== //
10 
11 #ifndef ALIADMIN_H
12 #define ALIADMIN_H
13 
14 #ifndef AW_AWAR_HXX
15 #include <aw_awar.hxx>
16 #endif
17 #ifndef AW_ROOT_HXX
18 #include <aw_root.hxx>
19 #endif
20 #ifndef ARB_MSG_H
21 #include <arb_msg.h>
22 #endif
23 
24 #define ali_assert(cond) arb_assert(cond)
25 
26 enum AdminType {
30 
32 };
33 
34 class AliAdmin {
35  AdminType type;
36  GBDATA *const gb_main;
37  AW_window *aws;
38  const char *select_awarname;
39  const char *tmp_awarbase;
40 
41  const char *tmp_awarname(const char *entryName) const {
42  return GBS_global_string("%s%s", tmp_awarbase, entryName);
43  }
44 
45 public:
46  AliAdmin(AdminType type_, GBDATA *gb_main_, const char *select_awarname_, const char *tmp_awarbase_) :
47  type(type_),
48  gb_main(gb_main_),
49  aws(NULp),
50  select_awarname(select_awarname_),
51  tmp_awarbase(tmp_awarbase_)
52  {
53  ali_assert(type>=0 && type<ALI_ADMIN_TYPES);
54  ali_assert(strrchr(tmp_awarbase, '/')[1] == 0); // has to end with '/'
55  }
56 
57  GBDATA *get_gb_main() const { return gb_main; }
58 
59  void store_window(AW_window *aw) { ali_assert(!aws); aws = aw; }
60  AW_window *get_window() const { return aws; }
61 
62  void window_init(class AW_window_simple *aw, const char *id_templ, const char *title_templ) const;
63 
64  const char *select_name() const { return select_awarname; }
65  const char *type_name() const { return tmp_awarname("alignment_type"); }
66  const char *len_name() const { return tmp_awarname("alignment_len"); }
67  const char *aligned_name() const { return tmp_awarname("aligned"); }
68  const char *security_name()const { return tmp_awarname("security"); }
69  const char *remark_name() const { return tmp_awarname("alignment_rem"); }
70  const char *auto_name() const { return tmp_awarname("auto_format"); }
71 
74  AW_awar *len_awar() const { return AW_root::SINGLETON->awar(len_name()); }
79 
80  const char *get_selected_ali()const { return select_awar()->read_char_pntr(); }
81 };
82 
83 
85 
86 #else
87 #error AliAdmin.h included twice
88 #endif // ALIADMIN_H
AW_awar * len_awar() const
Definition: AliAdmin.h:74
const char * type_name() const
Definition: AliAdmin.h:65
const char * GBS_global_string(const char *templat,...)
Definition: arb_msg.cxx:203
AW_awar * select_awar() const
Definition: AliAdmin.h:72
void store_window(AW_window *aw)
Definition: AliAdmin.h:59
const char * get_selected_ali() const
Definition: AliAdmin.h:80
const char * auto_name() const
Definition: AliAdmin.h:70
AliAdmin(AdminType type_, GBDATA *gb_main_, const char *select_awarname_, const char *tmp_awarbase_)
Definition: AliAdmin.h:46
const char * read_char_pntr() const
Definition: AW_awar.cxx:168
static AW_root * SINGLETON
Definition: aw_root.hxx:102
const char * remark_name() const
Definition: AliAdmin.h:69
AW_awar * security_awar() const
Definition: AliAdmin.h:76
void window_init(class AW_window_simple *aw, const char *id_templ, const char *title_templ) const
Definition: AliAdmin.cxx:24
AW_awar * auto_awar() const
Definition: AliAdmin.h:78
AW_window * ALI_create_admin_window(AW_root *root, AliAdmin *admin)
Definition: AdminGui.cxx:162
AW_awar * remark_awar() const
Definition: AliAdmin.h:77
GBDATA * get_gb_main() const
Definition: AliAdmin.h:57
AW_window * get_window() const
Definition: AliAdmin.h:60
const char * len_name() const
Definition: AliAdmin.h:66
AW_awar * type_awar() const
Definition: AliAdmin.h:73
const char * aligned_name() const
Definition: AliAdmin.h:67
AW_awar * awar(const char *awar)
Definition: AW_root.cxx:554
const char * select_name() const
Definition: AliAdmin.h:64
AdminType
Definition: AliAdmin.h:26
#define ali_assert(cond)
Definition: AliAdmin.h:24
#define NULp
Definition: cxxforward.h:116
const char * security_name() const
Definition: AliAdmin.h:68
AW_awar * aligned_awar() const
Definition: AliAdmin.h:75