Пример #1
0
void clAuiDockArt::DrawPaneButton(
    wxDC& dc, wxWindow* window, int button, int button_state, const wxRect& _rect, wxAuiPaneInfo& pane)
{
    int xx = _rect.GetTopLeft().x + ((_rect.GetWidth() - AUI_BUTTON_SIZE) / 2);
    int yy = _rect.GetTopLeft().y + ((_rect.GetHeight() - AUI_BUTTON_SIZE) / 2);
    switch(button) {
    case wxAUI_BUTTON_CLOSE:
        dc.DrawBitmap(m_dockCloseBmp, xx, yy);
        break;
    case wxAUI_BUTTON_MAXIMIZE_RESTORE:
        if(pane.IsMaximized()) {
            dc.DrawBitmap(m_dockMinimizeBmp, xx, yy);
        } else {
            dc.DrawBitmap(m_dockExpandeBmp, xx, yy);
        }
        break;
    case wxAUI_BUTTON_PIN:
        dc.DrawBitmap(m_dockMoreBmp, xx, yy);
        break;
    default:
        wxAuiDefaultDockArt::DrawPaneButton(dc, window, button, button_state, _rect, pane);
        break;
    }
}
Пример #2
0
void wxAuiDefaultDockArt::DrawPaneButton(wxDC& dc, wxWindow *WXUNUSED(window),
        int button,
        int button_state,
        const wxRect& _rect,
        wxAuiPaneInfo& pane)
{
    wxBitmap bmp;
    switch (button)
    {
    default:
    case wxAUI_BUTTON_CLOSE:
        if (pane.state & wxAuiPaneInfo::optionActive)
            bmp = m_activeCloseBitmap;
        else
            bmp = m_inactiveCloseBitmap;
        break;
    case wxAUI_BUTTON_PIN:
        if (pane.state & wxAuiPaneInfo::optionActive)
            bmp = m_activePinBitmap;
        else
            bmp = m_inactivePinBitmap;
        break;
    case wxAUI_BUTTON_MAXIMIZE_RESTORE:
        if (pane.IsMaximized())
        {
            if (pane.state & wxAuiPaneInfo::optionActive)
                bmp = m_activeRestoreBitmap;
            else
                bmp = m_inactiveRestoreBitmap;
        }
        else
        {
            if (pane.state & wxAuiPaneInfo::optionActive)
                bmp = m_activeMaximizeBitmap;
            else
                bmp = m_inactiveMaximizeBitmap;
        }
        break;
    }


    wxRect rect = _rect;

    int old_y = rect.y;
    rect.y = rect.y + (rect.height/2) - (bmp.GetHeight()/2);
    rect.height = old_y + rect.height - rect.y - 1;


    if (button_state == wxAUI_BUTTON_STATE_PRESSED)
    {
        rect.x++;
        rect.y++;
    }

    if (button_state == wxAUI_BUTTON_STATE_HOVER ||
            button_state == wxAUI_BUTTON_STATE_PRESSED)
    {
        if (pane.state & wxAuiPaneInfo::optionActive)
        {
            dc.SetBrush(wxBrush(m_activeCaptionColour.ChangeLightness(120)));
            dc.SetPen(wxPen(m_activeCaptionColour.ChangeLightness(70)));
        }
        else
        {
            dc.SetBrush(wxBrush(m_inactiveCaptionColour.ChangeLightness(120)));
            dc.SetPen(wxPen(m_inactiveCaptionColour.ChangeLightness(70)));
        }

        // draw the background behind the button
        dc.DrawRectangle(rect.x, rect.y, 15, 15);
    }


    // draw the button itself
    dc.DrawBitmap(bmp, rect.x, rect.y, true);
}