예제 #1
0
void clAuiGlossyTabArt::DoSetColours()
{
    // adjust some colours
    wxColour panelColour = DrawingUtils::GetPanelBgColour();
    if(DrawingUtils::IsDark(panelColour)) {
        SetDarkColours();
    } else {
        SetLightColours();
    }
    
    // And finally let the plugins override the colours
    clColourEvent tabColourEvent(wxEVT_COLOUR_TAB);
    if(EventNotifier::Get()->ProcessEvent(tabColourEvent)) {
        m_activeTabBgColour = tabColourEvent.GetBgColour();
        m_activeTabTextColour = tabColourEvent.GetFgColour();
        m_tabTextColour = tabColourEvent.GetFgColour();
        m_tabBgColour = m_activeTabBgColour.ChangeLightness(120);
    }

    clColourEvent tabPenColour(wxEVT_GET_TAB_BORDER_COLOUR);
    if(EventNotifier::Get()->ProcessEvent(tabPenColour)) {
        m_activeTabPenColour = tabPenColour.GetBorderColour();
        m_penColour = m_activeTabPenColour.ChangeLightness(120);
        m_innerPenColour = m_activeTabPenColour.ChangeLightness(150);
    }
}
void clAuiMainNotebookTabArt::DoSetColours()
{
    // Set the colours
    // based on the selected book theme
    if(!m_bgColour.IsOk()) {
        DoInitializeColoursFromTheme();
    }

    // If we have an active editor, update the colours, if not - keep the old ones
    IEditor* editor = m_manager->GetActiveEditor();
    SetLightColours();

    // We use the colour theme based on the active editor
    if(editor) {
        // Change lightness ranges between 0-200
        // 0 would be completely black, 200 completely white an ialpha of 100 returns the same colour.
        m_activeTabBgColour = editor->GetCtrl()->StyleGetBackground(0);
        if(DrawingUtils::IsDark(m_activeTabBgColour)) {
            SetDarkColours();
        }
    }
}