Logo Search packages:      
Sourcecode: agave version File versions  Download package

gcs::Widgets::ColorSwatch::ColorSwatch ( ColorPtr  bg  ) 

Constructor with background and foreground colors specified in RGB format

Definition at line 50 of file gcs-colorswatch.cc.

References alloc_bg(), m_black, m_colormap, and m_white.

                                            :
            m_background(bg), m_minSize(12),
            m_borderWidth(1),
            m_swatchPadding(6)
        {
            // if this is the first ColorSwatch, create a tooltip object and
            // increment the reference value.  The Tooltip object will be
            // deleted when the reference count reaches 0`
            if (!tooltip_refs++)
            {
                pTooltips = new Gtk::Tooltips();
            }
            // get_window() would return 0 because the Gdk::Window has not yet been
            // realized So we can only allocate the colors here - the rest will
            // happen in on_realize().
            m_colormap = get_default_colormap();
            m_colormap->alloc_color(m_black->gdk());
            m_colormap->alloc_color(m_white->gdk());
            alloc_bg();

            // Targets for drag and drop:
            std::list<Gtk::TargetEntry> listTargets;
            listTargets.push_back(Gtk::TargetEntry("application/x-color"));
            listTargets.push_back(Gtk::TargetEntry("UTF8_STRING"));
            listTargets.push_back(Gtk::TargetEntry("text/plain"));

            // set the swatch as a drag source
            drag_source_set(listTargets);
            signal_drag_data_get().connect(sigc::mem_fun(*this, &ColorSwatch::on_drag_data_get));
            signal_drag_begin().connect(sigc::mem_fun(*this, &ColorSwatch::set_color_icon));

        }


Generated by  Doxygen 1.6.0   Back to index