2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith/** \file
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith * Inkscape UI action implementation
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith *//*
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith * Author:
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith * Lauris Kaplinski <lauris@kaplinski.com>
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith *
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith * Copyright (C) 2003 Lauris Kaplinski
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith *
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith * This code is in public domain
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith */
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith#ifndef SEEN_INKSCAPE_SP_ACTION_H
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith#define SEEN_INKSCAPE_SP_ACTION_H
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith#include "helper/action-context.h"
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith#include <sigc++/signal.h>
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith#include <glibmm/ustring.h>
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith#define SP_TYPE_ACTION (sp_action_get_type())
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith#define SP_ACTION(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_ACTION, SPAction))
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith#define SP_ACTION_CLASS(o) (G_TYPE_CHECK_CLASS_CAST((o), SP_TYPE_ACTION, SPActionClass))
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith#define SP_IS_ACTION(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_ACTION))
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smithclass SPDesktop;
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smithclass SPDocument;
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smithnamespace Inkscape {
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smithclass Selection;
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smithclass Verb;
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith
5c45bb188ab729e501e48732842cb9de6a9813beAlex Valavanisnamespace UI {
eb4caa8f4cdc2955b58dcd2de06fe770533414c8Jon A. Cruznamespace View {
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smithclass View;
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith} // namespace View
a4142717644b885998f4de2b27be4e8648315decMarkus Engel} // namespace UI
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith}
9836787d16b657453784c30809d330f50d9bc6d8Liam P. White
9836787d16b657453784c30809d330f50d9bc6d8Liam P. White/** All the data that is required to be an action. This
9836787d16b657453784c30809d330f50d9bc6d8Liam P. White structure identifies the action and has the data to
a4142717644b885998f4de2b27be4e8648315decMarkus Engel create menus and toolbars for the action */
a4142717644b885998f4de2b27be4e8648315decMarkus Engelstruct SPAction : public GObject {
a4142717644b885998f4de2b27be4e8648315decMarkus Engel unsigned sensitive : 1; /**< Value to track whether the action is sensitive */
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith unsigned active : 1; /**< Value to track whether the action is active */
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith Inkscape::ActionContext context; /**< The context (doc/view) to which this action is attached */
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith gchar *id; /**< The identifier for the action */
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith gchar *name; /**< Full text name of the action */
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith gchar *tip; /**< A tooltip to describe the action */
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith gchar *image; /**< An image to visually identify the action */
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith Inkscape::Verb *verb; /**< The verb that produced this action */
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith sigc::signal<void> signal_perform;
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith sigc::signal<void, bool> signal_set_sensitive;
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith sigc::signal<void, bool> signal_set_active;
88381aa2b5d06411a23bed41ae19f73d15c92a80John Smith sigc::signal<void, Glib::ustring const &> signal_set_name;
88381aa2b5d06411a23bed41ae19f73d15c92a80John Smith};
88381aa2b5d06411a23bed41ae19f73d15c92a80John Smith
88381aa2b5d06411a23bed41ae19f73d15c92a80John Smith/** The action class is the same as its parent. */
88381aa2b5d06411a23bed41ae19f73d15c92a80John Smithstruct SPActionClass {
88381aa2b5d06411a23bed41ae19f73d15c92a80John Smith GObjectClass parent_class; /**< Parent Class */
88381aa2b5d06411a23bed41ae19f73d15c92a80John Smith};
88381aa2b5d06411a23bed41ae19f73d15c92a80John Smith
88381aa2b5d06411a23bed41ae19f73d15c92a80John SmithGType sp_action_get_type();
88381aa2b5d06411a23bed41ae19f73d15c92a80John Smith
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn SmithSPAction *sp_action_new(Inkscape::ActionContext const &context,
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith gchar const *id,
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith gchar const *name,
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith gchar const *tip,
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith gchar const *image,
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith Inkscape::Verb *verb);
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smithvoid sp_action_perform(SPAction *action, void *data);
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smithvoid sp_action_set_active(SPAction *action, unsigned active);
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smithvoid sp_action_set_sensitive(SPAction *action, unsigned sensitive);
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smithvoid sp_action_set_name(SPAction *action, Glib::ustring const &name);
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn SmithSPDocument *sp_action_get_document(SPAction *action);
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn SmithInkscape::Selection *sp_action_get_selection(SPAction *action);
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn SmithInkscape::UI::View::View *sp_action_get_view(SPAction *action);
88381aa2b5d06411a23bed41ae19f73d15c92a80John SmithSPDesktop *sp_action_get_desktop(SPAction *action);
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith#endif
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith/*
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith Local Variables:
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith mode:c++
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith c-file-style:"stroustrup"
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith indent-tabs-mode:nil
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith fill-column:99
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith End:
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith*/
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
2f5f997e354e7f4a02b6818bdc68fbece5cb237dJohn Smith