1 /* === S Y N F I G ========================================================= */
2 /*! \file dialog_gradient.cpp
3 ** \brief Template File
5 ** $Id: dialog_color.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
10 ** This package is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU General Public License as
12 ** published by the Free Software Foundation; either version 2 of
13 ** the License, or (at your option) any later version.
15 ** This package is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** General Public License for more details.
21 /* ========================================================================= */
23 /* === H E A D E R S ======================================================= */
32 #include "dialog_color.h"
33 #include "widget_color.h"
34 #include <gtkmm/frame.h>
35 #include <gtkmm/table.h>
36 #include <gtkmm/label.h>
37 #include <synfig/general.h>
38 #include <synfigapp/canvasinterface.h>
39 #include <synfigapp/value_desc.h>
40 #include "widget_color.h"
41 #include <gtkmm/spinbutton.h>
42 #include <synfigapp/main.h>
43 #include <sigc++/retype_return.h>
44 #include <sigc++/retype.h>
45 #include <sigc++/hide.h>
50 /* === U S I N G =========================================================== */
54 using namespace synfig;
55 using namespace studio;
57 /* === M A C R O S ========================================================= */
59 /* === G L O B A L S ======================================================= */
61 /* === P R O C E D U R E S ================================================= */
63 /* === M E T H O D S ======================================================= */
65 Dialog_Color::Dialog_Color():
66 Dialog(_("Colors"),false,true),
67 dialog_settings(this,"color"),
69 // adjustment_pos(0,0.0,1.0,0.001,0.001,0.001)
71 set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY);
73 //Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))));
75 //add_action_widget(*ok_button,2);
76 //ok_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Color::on_ok_pressed));
78 //Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply"))));
79 //apply_button->show();
80 //add_action_widget(*apply_button,1);
81 //apply_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Color::on_apply_pressed));
83 Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close"))));
84 cancel_button->show();
85 add_action_widget(*cancel_button,0);
86 cancel_button->signal_clicked().connect(sigc::hide_return(sigc::mem_fun(*this, &Dialog_Color::on_close_pressed)));
87 signal_delete_event().connect(sigc::hide(sigc::mem_fun(*this, &Dialog_Color::on_close_pressed)));
89 Gtk::Table* table(manage(new Gtk::Table(2,2,false)));
90 get_vbox()->pack_start(*table);
92 widget_color=manage(new Widget_ColorEdit());
93 widget_color->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Color::on_color_changed));
94 //widget_color->signal_activate().connect(sigc::mem_fun(*this,&studio::Dialog_Color::on_color_changed));
95 table->attach(*widget_color, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
97 add_accel_group(App::ui_manager()->get_accel_group());
102 Dialog_Color::~Dialog_Color()
107 Dialog_Color::reset()
109 signal_edited_.clear();
113 Dialog_Color::on_close_pressed()
115 // signal_edited_(get_color());
124 Dialog_Color::on_apply_pressed()
127 signal_edited_(get_color());
132 Dialog_Color::on_color_changed()
135 signal_edited_(get_color());