// ========================================================= //
//                                                           //
//   File      : selection_admin.h                           //
//   Purpose   : species selection admin                     //
//                                                           //
//   Coded by Ralf Westram (coder@reallysoft.de) in Feb 26   //
//   http://www.arb-home.de/                                 //
//                                                           //
// ========================================================= //

#ifndef SELECTION_ADMIN_H
#define SELECTION_ADMIN_H

#ifndef AW_BASE_HXX
#include <aw_base.hxx>
#endif
#ifndef CB_H
#include <cb.h>
#endif

struct SelectionAdmin {
    virtual ~SelectionAdmin() {}

    virtual const char *get_macro_suffix() const = 0;
    virtual GBDATA *get_gb_main() const          = 0;

    virtual const char *get_selection_awarname() const        = 0;
    virtual const char *get_selectionComment_awarname() const = 0;

    virtual const char *get_window_title() const = 0;

    virtual const char *get_name_of_tree() const  = 0;
    virtual class TreeNode *get_tree_root() const = 0;

    virtual const char *get_toparea_SAIs() const = 0;

    virtual void speciesSelection_renamed_cb(const char *old_name, const char *new_name) const = 0;
    virtual void speciesSelection_deleted_cb(const char *name) const                           = 0;
};

enum SelectionCreation {
    BY_CALLING_THE_EDITOR,
    FROM_IMPORTER,
    FROM_MANAGER,
};

enum SelectionExtractType {
    SELECTION_EXTRACT, // unmark all + mark selection
    SELECTION_MARK,    // mark selection (= logical OR)
    SELECTION_UNMARK,  // unmark selection
    SELECTION_INVERT,  // invert selection (= logical XOR)
    SELECTION_COMBINE  // logical AND (i.e. unmark all that are not member from selection)
};

GB_ERROR   create_species_selection(const SelectionAdmin& selection, const char *conf_name, int use_species_aside, SelectionCreation creation);
void       extract_species_selection(GBDATA *gb_main, const char *selectionName, SelectionExtractType ext_type);
AW_window *create_species_selection_window(AW_root *root, const SelectionAdmin *selection);

void create_species_selection_button(AW_window *awm, WindowCallback wcb, const char *macro_id, const char *awarname_buttontext, GBDATA *gb_main);

#else
#error selection_admin.h included twice
#endif // SELECTION_ADMIN_H
