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

void gcs::Widgets::TextSwatch::redraw ( void   )  [protected, virtual]

Allocates the background color that will be displayed in the ColorSwatch

Reimplemented from gcs::Widgets::ColorSwatch.

Definition at line 144 of file gcs-textswatch.cc.

References gcs::Widgets::TextSwatch::SwatchText::get_height(), gcs::Widgets::TextSwatch::SwatchText::get_layout(), gcs::Widgets::TextSwatch::SwatchText::get_width(), gcs::Widgets::ColorSwatch::m_borderWidth, gcs::Widgets::ColorSwatch::m_swatchPadding, m_textGC, and gcs::Widgets::ColorSwatch::redraw().

        {
            ColorSwatch::redraw();
            Glib::RefPtr<Gdk::Window> win = get_window();
            int winWidth, winHeight;
            int textX, textY;
            win->get_size(winWidth, winHeight);

            SwatchText *pText;
            if (winWidth > m_pMaxText->get_width() + 2 * m_borderWidth + 2 * m_swatchPadding &&
                    winHeight > m_pMaxText->get_height()+ 2 * m_borderWidth + 2 * m_swatchPadding)
            {
                pText = m_pMaxText.get();
            }
            else if (winWidth > m_pMinText->get_width() + 2 * m_borderWidth + 2 * m_swatchPadding &&
                    winHeight > m_pMinText->get_height()+ 2 * m_borderWidth + 2 * m_swatchPadding)
            {
                pText = m_pMinText.get();
            }
            else    // swatch is too small -- don't display any text
            {
                pText = 0;
            }

            if (pText != NULL)
            {
                textX = (winWidth - pText->get_width()) / 2;
                textY = (winHeight - pText->get_height()) / 2;

                win->draw_layout(m_textGC, textX, textY, pText->get_layout());
            }
        }


Generated by  Doxygen 1.6.0   Back to index