#ifndef _WB_COMPONENT_BASIC_H_
#define _WB_COMPONENT_BASIC_H_

// Basic Model Handling (layers etc)

#include "wb_component.h"


namespace wb {

  // basic tool names
  #define WB_TOOL_SELECT     "basic/select"
  #define WB_TOOL_HAND       "basic/hand"
  #define WB_TOOL_DELETE     "basic/delete"
  #define WB_TOOL_LAYER      "basic/layer"
  #define WB_TOOL_NOTE       "basic/note"
  #define WB_TOOL_IMAGE      "basic/image"

  class WBComponentBasic : public WBComponent
  {
  public:
    WBComponentBasic(WBContext *wb);
    virtual ~WBComponentBasic();

    static std::string name() { return "basic"; }
    virtual std::string get_name() { return WBComponentBasic::name(); }
    virtual std::string get_diagram_class_name() { return model_Diagram::static_class_name(); }

    void delete_selection();
    
  protected:
    virtual void load_app_options(bool update);

    // Canvas Handling
    virtual void setup_canvas_tool(ModelDiagramForm *view, const std::string &tool);

    // Toolbar Handling
    virtual grt::ListRef<app_ToolbarItem> get_toolbar_items(const std::string &toolbar);

    virtual std::vector<std::string> get_command_dropdown_items(const std::string &option);

    virtual grt::ListRef<app_ShortcutItem> get_shortcut_items();

    virtual bool handles_figure(const model_ObjectRef &object);

    virtual void activate_canvas_object(const model_ObjectRef &figure, bool newwindow);

  private:
    std::map<std::string, app_ToolbarRef> _toolbars;
    grt::ListRef<app_ShortcutItem> _shortcuts;

    // Model Objects
    void place_layer(ModelDiagramForm *view, const mdc::Rect &rect);
    grt::ValueRef place_layer_grt(grt::GRT *grt, ModelDiagramForm *view, 
                                      const mdc::Rect &rect);

    void delete_object(ModelDiagramForm *view, const mdc::Point &pos);
    virtual model_ObjectRef clone_object(const model_ObjectRef &object, const model_LayerRef &destlayer, bool copy_only);

    virtual bool delete_model_object(const model_ObjectRef &object, std::map<std::string,bool> &options);

    void reset_tool(ModelDiagramForm *view, void*);
    bool handle_motion_event(ModelDiagramForm*, mdc::Point, mdc::EventState, void*);
    bool handle_button_event(ModelDiagramForm*, mdc::MouseButton, bool, mdc::Point, mdc::EventState, void*);
  };

};


#endif 
