コード例 #1
0
ファイル: theme.cpp プロジェクト: ifzz/BuyTicket
//Changed by PEK
void CTheme::Init()
{
	m_hModThemes = LoadLibrary(_T("UXTHEME.DLL"));

	if(m_hModThemes)
	{
		zOpenThemeData = (PFNOPENTHEMEDATA)GetProcAddress(m_hModThemes, _T("OpenThemeData"));
		zDrawThemeBackground = (PFNDRAWTHEMEBACKGROUND)GetProcAddress(m_hModThemes, _T("DrawThemeBackground"));
		zCloseThemeData = (PFNCLOSETHEMEDATA)GetProcAddress(m_hModThemes, _T("CloseThemeData"));
		zDrawThemeText = (PFNDRAWTHEMETEXT)GetProcAddress(m_hModThemes, _T("DrawThemeText"));
		zGetThemeBackgroundContentRect = (PFNGETTHEMEBACKGROUNDCONTENTRECT)GetProcAddress(m_hModThemes, _T("GetThemeBackgroundContentRect"));
		zDrawThemeEdge = (PFNDRAWTHEMEEDGE)GetProcAddress(m_hModThemes, _T("DrawThemeEdge"));
		zDrawThemeIcon = (PFNDRAWTHEMEICON)GetProcAddress(m_hModThemes, _T("DrawThemeIcon"));

		//Changed by PEK
		zIsAppThemed = (PFNISTHEMEACTIVE)GetProcAddress(m_hModThemes, _T("IsAppThemed"));
		
		if(zOpenThemeData && zDrawThemeBackground && zCloseThemeData 
									&& zDrawThemeText && zGetThemeBackgroundContentRect 
									&& zDrawThemeEdge && zDrawThemeIcon && zIsAppThemed)
			{
			m_bLibLoaded = TRUE;			
			}
		else
			{
			::FreeLibrary(m_hModThemes);
			m_hModThemes = NULL;
			}
	}

	m_bXPTheme = GetAppearance();
	
}
コード例 #2
0
CXTPChartColor CXTPChartTitle::GetActualTextColor() const
{
	if (!m_clrTextColor.IsEmpty())
		return m_clrTextColor;

	return GetAppearance()->GetContentAppearance()->GetTitleAppearance()->TextColor;
}
コード例 #3
0
ファイル: Appearance.C プロジェクト: ahota/visit_intel
void
SetAppearance(QApplication *app, AppearanceAttributes *aa)
{
    const char *mName = "SetAppearance: ";

    // Get the current appearance attributes.
    AppearanceAttributes currentAtts;
    GetAppearance(app, &currentAtts);

    //
    // Set the style
    //
    std::string newStyle(aa->GetStyle());
    if(aa->GetUseSystemDefault())
        newStyle = aa->GetDefaultStyle();
    bool changeStyle = newStyle != currentAtts.GetDefaultStyle();
    if(changeStyle)
    {
        debug1 << mName << "Setting style to: " << newStyle << endl;
        // Set the style via the style name.
        app->setStyle(newStyle.c_str());
    }
     
    //
    // Set the font.
    //
    std::string newFont(aa->GetFontName());
    if(aa->GetUseSystemDefault())
        newFont = aa->GetDefaultFontName();
    bool changeFont = (newFont != currentAtts.GetDefaultFontName()) || changeStyle;
    if(changeFont)
    {
        QFont font;
        bool okay = true;

        if(newFont.size() > 0 &&
           newFont[0] == '-')
        {
            // It's probably an XLFD
            font = QFont(newFont.c_str());
            debug1 << mName << "The font looks like XLFD: "
                   << newFont << endl;
        }
        else
            okay = font.fromString(newFont.c_str());
        
        if(okay)
        {
            
            debug1 << mName << "Font okay. name=" << font.toString().toStdString() << endl;
            app->setFont(font);

            // Force the font change on all top level widgets.
            // for each top level widget...
            foreach(QWidget *w, QApplication::topLevelWidgets())
                w->setFont(font);
        }
        else
            debug1 << mName << "Font NOT okay. name=" << font.toString().toStdString() << endl;
    }

    //
    // Set the application colors
    //
    std::string newBG(aa->GetBackground());
    std::string newFG(aa->GetForeground());
    if(aa->GetUseSystemDefault())
    {
        newBG = aa->GetDefaultBackground();
        newFG = aa->GetDefaultForeground();
    }
    bool changeColors = newBG != currentAtts.GetDefaultBackground() ||
                        newFG != currentAtts.GetDefaultForeground();
    bool colorStyle = newStyle != "macintosh";
    if(changeColors && colorStyle)
    {       
        QColor bg(newBG.c_str());
        QColor fg(newFG.c_str());
        QColor btn(bg);

        // Put the converted RGB format color into the appearance attributes
        // in case the colors were given as color names.
        if(!aa->GetUseSystemDefault())
        {
            char tmp[20];
            sprintf(tmp, "#%02x%02x%02x", bg.red(), bg.green(), bg.blue());
            aa->SetBackground(tmp);
            sprintf(tmp, "#%02x%02x%02x", fg.red(), fg.green(), fg.blue());
            aa->SetForeground(tmp);
        }

        debug1 <<mName << "Setting BG color to: " << newBG << endl;
        debug1 <<mName << "Setting FG color to: " << newFG << endl;

        int h,s,v;
        fg.getHsv(&h,&s,&v);
        QColor base = Qt::white;
        bool bright_mode = false;
        if(v >= 255 - 50)
        {
            base = btn.dark(150);
            bright_mode = true;
        }

        QPalette pal(fg, btn, btn.light(),
                     btn.dark(), btn.dark(150), fg, Qt::white, base, bg);
//        pal.setCurrentColorGroup(QPalette::Normal);
        
        if (bright_mode)
        {
//            pal.setColor(QPalette::Text, fg);
//            pal.setColor(QPalette::WindowText, fg);
            pal.setColor(QPalette::Normal, QPalette::HighlightedText, base );
            pal.setColor(QPalette::Normal, QPalette::Highlight, Qt::white );
        }
        else
        {
//            pal.setColor(QPalette::Text, fg);
//            pal.setColor(QPalette::WindowText, fg);
            pal.setColor(QPalette::Normal, QPalette::HighlightedText, Qt::white );
            pal.setColor(QPalette::Normal, QPalette::Highlight, Qt::darkBlue );
        }
        
        // Set inactive colors
//        pal.setCurrentColorGroup(QPalette::Inactive);
        if (bright_mode)
        {
//            pal.setColor(QPalette::Inactive, QPalette::Text, fg);
//            pal.setColor(QPalette::Inactive, QPalette::WindowText, fg);
            pal.setColor(QPalette::Inactive, QPalette::HighlightedText, base );
            pal.setColor(QPalette::Inactive, QPalette::Highlight, Qt::white );
        }
        else
        {
//            pal.setColor(QPalette::Inactive, QPalette::Text, fg);
//            pal.setColor(QPalette::Inactive, QPalette::WindowText, fg);
            pal.setColor(QPalette::Inactive, QPalette::HighlightedText, Qt::white );
            pal.setColor(QPalette::Inactive, QPalette::Highlight, Qt::darkBlue );
        }

        // Set disabled colors
        QColor disabled((fg.red()+btn.red())/2,
                        (fg.green()+btn.green())/2,
                        (fg.blue()+btn.blue())/2);
        
//        pal.setCurrentColorGroup(QPalette::Disabled);
        pal.setColor(QPalette::Disabled, QPalette::WindowText, disabled);
        pal.setColor(QPalette::Disabled, QPalette::Light, btn.light( 125 ));
        pal.setColor(QPalette::Disabled, QPalette::Text, disabled);
        pal.setColor(QPalette::Disabled, QPalette::Base, Qt::white);
        if (bright_mode)
        {
            pal.setColor(QPalette::Disabled, QPalette::HighlightedText, base);
            pal.setColor(QPalette::Disabled, QPalette::Highlight, Qt::white);
        }
        else
        {
            pal.setColor(QPalette::Disabled, QPalette::HighlightedText, Qt::white);
            pal.setColor(QPalette::Disabled, QPalette::Highlight, Qt::darkBlue);
        }

        app->setPalette(pal);
    }
}
コード例 #4
0
ファイル: aa.cpp プロジェクト: af4t/Server
void Client::ActivateAlternateAdvancementAbility(int rank_id, int target_id) {
	AA::Rank *rank = zone->GetAlternateAdvancementRank(rank_id);
	if(!rank) {
		return;
	}

	AA::Ability *ability = rank->base_ability;
	if(!ability) {
		return;
	}

	if(!IsValidSpell(rank->spell)) {
		return;
	}

	if(!CanUseAlternateAdvancementRank(rank)) {
		return;
	}

	//make sure it is not a passive
	if(!rank->effects.empty()) {
		return;
	}

	uint32 charges = 0;
	// We don't have the AA
	if (!GetAA(rank_id, &charges))
		return;

	//if expendable make sure we have charges
	if(ability->charges > 0 && charges < 1)
		return;

	//check cooldown
	if(!p_timers.Expired(&database, rank->spell_type + pTimerAAStart, false)) {
		uint32 aaremain = p_timers.GetRemainingTime(rank->spell_type + pTimerAAStart);
		uint32 aaremain_hr = aaremain / (60 * 60);
		uint32 aaremain_min = (aaremain / 60) % 60;
		uint32 aaremain_sec = aaremain % 60;

		if(aaremain_hr >= 1) {
			Message(13, "You can use this ability again in %u hour(s) %u minute(s) %u seconds",
			aaremain_hr, aaremain_min, aaremain_sec);
		}
		else {
			Message(13, "You can use this ability again in %u minute(s) %u seconds",
			aaremain_min, aaremain_sec);
		}

		return;
	}

	//calculate cooldown
	int cooldown = rank->recast_time - GetAlternateAdvancementCooldownReduction(rank);
	if(cooldown < 0) {
		cooldown = 0;
	}

	if (!IsCastWhileInvis(rank->spell))
		CommonBreakInvisible();

	if (spells[rank->spell].sneak && (!hidden || (hidden && (Timer::GetCurrentTime() - tmHidden) < 4000))) {
		Message_StringID(MT_SpellFailure, SNEAK_RESTRICT);
		return;
	}
	//
	// Modern clients don't require pet targeted for AA casts that are ST_Pet
	if (spells[rank->spell].targettype == ST_Pet || spells[rank->spell].targettype == ST_SummonedPet)
		target_id = GetPetID();

	// extra handling for cast_not_standing spells
	if (!spells[rank->spell].cast_not_standing) {
		if (GetAppearance() == eaSitting) // we need to stand!
			SetAppearance(eaStanding, false);

		if (GetAppearance() != eaStanding) {
			Message_StringID(MT_SpellFailure, STAND_TO_CAST);
			return;
		}
	}

	// Bards can cast instant cast AAs while they are casting another song
	if(spells[rank->spell].cast_time == 0 && GetClass() == BARD && IsBardSong(casting_spell_id)) {
		if(!SpellFinished(rank->spell, entity_list.GetMob(target_id), EQEmu::spells::CastingSlot::AltAbility, spells[rank->spell].mana, -1, spells[rank->spell].ResistDiff, false)) {
			return;
		}
		ExpendAlternateAdvancementCharge(ability->id);
	} else {
		if(!CastSpell(rank->spell, target_id, EQEmu::spells::CastingSlot::AltAbility, -1, -1, 0, -1, rank->spell_type + pTimerAAStart, cooldown, nullptr, rank->id)) {
			return;
		}
	}

	CastToClient()->GetPTimers().Start(rank->spell_type + pTimerAAStart, cooldown);
	SendAlternateAdvancementTimer(rank->spell_type, 0, 0);
}