swatches.h revision 101151f48224596a666f5c4bcd1f66025101bd32
2310N/A/** @file
2362N/A * @brief Color swatches dialog
2310N/A */
2310N/A/* Authors:
2310N/A * Jon A. Cruz
2310N/A *
2310N/A * Copyright (C) 2005 Jon A. Cruz
2310N/A * Released under GNU GPL, read the file 'COPYING' for more information
2310N/A */
2310N/A#ifndef SEEN_DIALOGS_SWATCHES_H
2310N/A#define SEEN_DIALOGS_SWATCHES_H
2310N/A
2310N/A#include <gtkmm/textview.h>
2310N/A#include <gtkmm/tooltips.h>
2310N/A
2310N/A#include "ui/widget/panel.h"
2310N/A#include "ui/previewholder.h"
2310N/A#include "dialogs/eek-color-def.h"
2362N/A
2362N/Ausing eek::ColorDef;
2362N/A
2310N/Anamespace Inkscape {
2310N/Anamespace UI {
2310N/Anamespace Dialogs {
2310N/A
2310N/A
2310N/Avoid _loadPaletteFile( gchar const *filename );
2310N/A
2310N/A/**
2310N/A * The color swatch you see on screen as a clickable box.
2310N/A */
2310N/Aclass ColorItem : public Inkscape::UI::Previewable
2310N/A{
2310N/A friend void _loadPaletteFile( gchar const *filename );
2310N/Apublic:
2310N/A ColorItem();
2310N/A ColorItem( unsigned int r, unsigned int g, unsigned int b,
2310N/A Glib::ustring& name );
2310N/A virtual ~ColorItem();
2310N/A ColorItem(ColorItem const &other);
2310N/A virtual ColorItem &operator=(ColorItem const &other);
2310N/A virtual Gtk::Widget* getPreview(PreviewStyle style,
2310N/A ViewType view,
2310N/A ::PreviewSize size,
2310N/A guint ratio);
2310N/A void buttonClicked(bool secondary = false);
2310N/A
2310N/A ColorDef def;
2310N/A
2310N/Aprivate:
4774N/A static void _dropDataIn( GtkWidget *widget,
2310N/A GdkDragContext *drag_context,
2310N/A gint x, gint y,
2310N/A GtkSelectionData *data,
2310N/A guint info,
4774N/A guint event_time,
4774N/A gpointer user_data);
4774N/A
4774N/A static void _dragGetColorData( GtkWidget *widget,
2310N/A GdkDragContext *drag_context,
2310N/A GtkSelectionData *data,
2310N/A guint info,
2310N/A guint time,
2310N/A gpointer user_data);
2310N/A
2310N/A static void _wireMagicColors( void* p );
2310N/A static void _colorDefChanged(void* data);
2310N/A
2310N/A void _linkTint( ColorItem& other, int percent );
2310N/A void _linkTone( ColorItem& other, int percent, int grayLevel );
2310N/A
2310N/A Gtk::Tooltips tips;
2310N/A std::vector<Gtk::Widget*> _previews;
2310N/A
2310N/A bool _isRemove;
2310N/A bool _isLive;
2310N/A bool _linkIsTone;
2310N/A int _linkPercent;
2310N/A int _linkGray;
2310N/A ColorItem* _linkSrc;
2310N/A std::vector<ColorItem*> _listeners;
2310N/A};
2310N/A
2310N/Aclass RemoveColorItem;
2310N/A
2310N/A/**
2310N/A * A panel that displays color swatches.
2310N/A */
2310N/Aclass SwatchesPanel : public Inkscape::UI::Widget::Panel
2310N/A{
2310N/Apublic:
2310N/A SwatchesPanel(gchar const* prefsPath = "/dialogs/swatches");
2310N/A virtual ~SwatchesPanel();
2310N/A
2310N/A static SwatchesPanel& getInstance();
2310N/A virtual void setOrientation( Gtk::AnchorType how );
2310N/A
2310N/Aprotected:
2310N/A virtual void _handleAction( int setId, int itemId );
2310N/A
2310N/Aprivate:
2310N/A SwatchesPanel(SwatchesPanel const &); // no copy
2310N/A SwatchesPanel &operator=(SwatchesPanel const &); // no assign
2310N/A
2310N/A static SwatchesPanel* instance;
PreviewHolder* _holder;
ColorItem* _remove;
};
} //namespace Dialogs
} //namespace UI
} //namespace Inkscape
#endif // SEEN_SWATCHES_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :