本文整理汇总了C++中IsEnabled函数的典型用法代码示例。如果您正苦于以下问题:C++ IsEnabled函数的具体用法?C++ IsEnabled怎么用?C++ IsEnabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsEnabled函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitStalker
bool BattlefieldWG::SetupBattlefield()
{
InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]);
m_TypeId = BATTLEFIELD_WG; // See enum BattlefieldTypes
m_BattleId = BATTLEFIELD_BATTLEID_WG;
m_ZoneId = BATTLEFIELD_WG_ZONEID;
m_MapId = BATTLEFIELD_WG_MAPID;
m_Map = sMapMgr->FindMap(m_MapId, 0);
m_Guid = MAKE_NEW_GUID((m_BattleId ^ 0x20000), 0, HIGHGUID_BATTLEGROUND);
m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MAX);
m_IsEnabled = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE);
m_MinPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN);
m_MinLevel = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN_LVL);
m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE * IN_MILLISECONDS;
//m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_NOBATTLETIME) * MINUTE * IN_MILLISECONDS;
m_NoWarBattleTime = 10 * MINUTE * IN_MILLISECONDS;
m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE * IN_MILLISECONDS;
m_TimeForAcceptInvite = 20;
m_StartGroupingTimer = 5 * MINUTE * IN_MILLISECONDS; //original was 15
m_StartGrouping = false;
m_tenacityStack = 0;
KickPosition.Relocate(5728.117f, 2714.346f, 697.733f, 0);
KickPosition.m_mapId = m_MapId;
RegisterZone(m_ZoneId);
m_Data32.resize(BATTLEFIELD_WG_DATA_MAX);
m_saveTimer = 60000;
// Init GraveYards
SetGraveyardNumber(BATTLEFIELD_WG_GRAVEYARD_MAX);
// Load from db
if ((sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) == 0) && (sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) == 0)
&& (sWorld->getWorldState(ClockWorldState[0]) == 0))
{
sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, uint64(false));
sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, uint64(urand(0, 1)));
sWorld->setWorldState(ClockWorldState[0], uint64(m_NoWarBattleTime));
}
m_isActive = bool(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE));
m_DefenderTeam = TeamId(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER));
m_Timer = sWorld->getWorldState(ClockWorldState[0]);
if (m_isActive)
{
m_isActive = false;
m_Timer = m_RestartAfterCrash;
}
for (uint8 i = 0; i < BATTLEFIELD_WG_GRAVEYARD_MAX; i++)
{
BfGraveyardWG* graveyard = new BfGraveyardWG(this);
// When between games, the graveyard is controlled by the defending team
if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL)
graveyard->Initialize(m_DefenderTeam, WGGraveYard[i].gyid);
else
graveyard->Initialize(WGGraveYard[i].startcontrol, WGGraveYard[i].gyid);
graveyard->SetTextId(WGGraveYard[i].textid);
m_GraveyardList[i] = graveyard;
}
// Spawn workshocreatures and gameobjects
for (uint8 i = 0; i < WG_MAX_WORKSHOP; i++)
{
WGWorkshop* workshop = new WGWorkshop(this, i);
if (i < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
workshop->GiveControlTo(GetAttackerTeam(), true);
else
workshop->GiveControlTo(GetDefenderTeam(), true);
// Note: Capture point is added once the gameobject is created.
WorkshopsList.insert(workshop);
}
// Spawn NPCs in the defender's keep, both Horde and Alliance
for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++)
{
// Horde npc
if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryHorde, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE))
KeepCreature[TEAM_HORDE].insert(creature->GetGUID());
// Alliance npc
if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryAlliance, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE))
KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
}
// Hide NPCs from the Attacker's team in the keep
for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
if (Creature* creature = GetCreature(*itr))
HideNpc(creature);
//.........这里部分代码省略.........
示例2: GetThumbRect
void CHorizontalLayoutUI::DoEvent(TEventUI& event)
{
if( m_iSepWidth != 0 ) {
if( event.Type == UIEVENT_BUTTONDOWN && IsEnabled() )
{
RECT rcSeparator = GetThumbRect(false);
if( ::PtInRect(&rcSeparator, event.ptMouse) ) {
m_uButtonState |= UISTATE_CAPTURED;
ptLastMouse = event.ptMouse;
m_rcNewPos = m_rcItem;
if( !m_bImmMode && m_pManager ) m_pManager->AddPostPaint(this);
return;
}
}
if( event.Type == UIEVENT_BUTTONUP )
{
if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
m_uButtonState &= ~UISTATE_CAPTURED;
m_rcItem = m_rcNewPos;
if( !m_bImmMode && m_pManager ) m_pManager->RemovePostPaint(this);
NeedParentUpdate();
return;
}
}
if( event.Type == UIEVENT_MOUSEMOVE )
{
if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
LONG cx = event.ptMouse.x - ptLastMouse.x;
ptLastMouse = event.ptMouse;
RECT rc = m_rcNewPos;
if( m_iSepWidth >= 0 ) {
if( cx > 0 && event.ptMouse.x < m_rcNewPos.right - m_iSepWidth ) return;
if( cx < 0 && event.ptMouse.x > m_rcNewPos.right ) return;
rc.right += cx;
if( rc.right - rc.left <= GetMinWidth() ) {
if( m_rcNewPos.right - m_rcNewPos.left <= GetMinWidth() ) return;
rc.right = rc.left + GetMinWidth();
}
if( rc.right - rc.left >= GetMaxWidth() ) {
if( m_rcNewPos.right - m_rcNewPos.left >= GetMaxWidth() ) return;
rc.right = rc.left + GetMaxWidth();
}
}
else {
if( cx > 0 && event.ptMouse.x < m_rcNewPos.left ) return;
if( cx < 0 && event.ptMouse.x > m_rcNewPos.left - m_iSepWidth ) return;
rc.left += cx;
if( rc.right - rc.left <= GetMinWidth() ) {
if( m_rcNewPos.right - m_rcNewPos.left <= GetMinWidth() ) return;
rc.left = rc.right - GetMinWidth();
}
if( rc.right - rc.left >= GetMaxWidth() ) {
if( m_rcNewPos.right - m_rcNewPos.left >= GetMaxWidth() ) return;
rc.left = rc.right - GetMaxWidth();
}
}
CDuiRect rcInvalidate = GetThumbRect(true);
m_rcNewPos = rc;
m_cxyFixed.cx = m_rcNewPos.right - m_rcNewPos.left;
if( m_bImmMode ) {
m_rcItem = m_rcNewPos;
NeedParentUpdate();
}
else {
rcInvalidate.Join(GetThumbRect(true));
rcInvalidate.Join(GetThumbRect(false));
if( m_pManager ) m_pManager->Invalidate(rcInvalidate);
}
return;
}
}
if( event.Type == UIEVENT_SETCURSOR )
{
RECT rcSeparator = GetThumbRect(false);
if( IsEnabled() && ::PtInRect(&rcSeparator, event.ptMouse) ) {
::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZEWE)));
return;
}
}
}
CContainerUI::DoEvent(event);
}
示例3: rect1
void CalendarControl::Draw(BRect r)
{
#ifdef __UNIVERSAL_INTERFACE
if(interface==CC_ZETA_INTERFACE)
{
#endif
#ifdef __ZETA_INTERFACE
BRect rect1(Bounds());
rect1.bottom--;
rect1.right=pb->Frame().left-2;
BRect rect2(rect1);
BPoint p1, p2;
rgb_color color;
if(IsEnabled())
{
if(dtvc->IsFocus() && wc) // window is active and control is focused
// (control is enabled)
{
SetHighColor(170,50,184,0);
StrokeRect(rect1);
rect1.left++;
rect1.top++;
rect1.right--;
rect1.bottom--;
StrokeRect(rect1);
SetHighColor(255,255,255,0);
rect1.left++;
rect1.top++;
rect1.right--;
rect1.bottom--;
StrokeLine(rect1.LeftBottom(),rect1.RightBottom());
StrokeLine(rect1.RightTop(),rect1.RightBottom());
SetHighColor(218,218,218,0);
StrokeLine(rect1.LeftTop(),rect1.LeftBottom());
StrokeLine(rect1.LeftTop(),rect1.RightTop());
SetHighColor(114,114,114,0);
StrokeLine(rect1.LeftTop(),rect1.LeftTop());
StrokeLine(rect1.LeftBottom(),rect1.LeftBottom());
StrokeLine(rect1.RightTop(),rect1.RightTop());
StrokeLine(rect1.RightBottom(),rect1.RightBottom());
// outward borders
color.red=170+(uint8)((229-170)*(view_color.red-170)/(255-170));
color.green=50+(uint8)((194-50)*(view_color.green-50)/(255-50));
color.blue=184+(uint8)((233-184)*(view_color.blue-184)/(255-184));
color.alpha=255;
SetHighColor(color);
p1.Set(rect2.left,rect2.top+1);
p2.Set(rect2.left+1,rect2.top);
StrokeLine(p1,p2);
p1.Set(rect2.right,rect2.top+1);
p2.Set(rect2.right-1,rect2.top);
StrokeLine(p1,p2);
p1.Set(rect2.right,rect2.bottom-1);
p2.Set(rect2.right-1,rect2.bottom);
StrokeLine(p1,p2);
p1.Set(rect2.left,rect2.bottom-1);
p2.Set(rect2.left+1,rect2.bottom);
StrokeLine(p1,p2);
SetHighColor(view_color);
StrokeLine(rect2.LeftTop(),rect2.LeftTop());
StrokeLine(rect2.LeftBottom(),rect2.LeftBottom());
StrokeLine(rect2.RightTop(),rect2.RightTop());
StrokeLine(rect2.RightBottom(),rect2.RightBottom());
}
else // window is not active or control is unfocused (control is enabled)
{
SetHighColor(255,255,255,0);
rect1.left++;
rect1.top++;
rect1.right--;
rect1.bottom--;
StrokeRect(rect1);
rect1.left++;
rect1.top++;
rect1.right--;
rect1.bottom--;
StrokeRect(rect1);
rect1=rect2;
SetHighColor(0,0,0,0);
StrokeRect(rect1);
rect1.left++;
rect1.top++;
rect1.right--;
rect1.bottom--;
StrokeLine(rect1.LeftTop(),rect1.LeftTop());
StrokeLine(rect1.LeftBottom(),rect1.LeftBottom());
StrokeLine(rect1.RightTop(),rect1.RightTop());
StrokeLine(rect1.RightBottom(),rect1.RightBottom());
SetHighColor(180,180,180,0);
p1.Set(rect2.left+2,rect2.top+1);
p2.Set(rect2.right-2,rect2.top+1);
StrokeLine(p1,p2);
p1.Set(rect2.left+1,rect2.top+2);
p2.Set(rect2.left+1,rect2.bottom-2);
//.........这里部分代码省略.........
示例4: GetControlFlags
UINT CSliderUI::GetControlFlags() const
{
if( IsEnabled() ) return UIFLAG_SETCURSOR;
else return 0;
}
示例5: GetControlFlags
UINT CTextUI::GetControlFlags() const
{
if( IsEnabled() && m_nLinks > 0 ) return UIFLAG_SETCURSOR;
else return 0;
}
示例6: ccp_ReportStatus
int
ccp_ReportStatus(struct cmdargs const *arg)
{
struct ccp_opt **o;
struct link *l;
struct ccp *ccp;
int f;
l = command_ChooseLink(arg);
ccp = &l->ccp;
prompt_Printf(arg->prompt, "%s: %s [%s]\n", l->name, ccp->fsm.name,
State2Nam(ccp->fsm.state));
if (ccp->fsm.state == ST_OPENED) {
prompt_Printf(arg->prompt, " My protocol = %s, His protocol = %s\n",
protoname(ccp->my_proto), protoname(ccp->his_proto));
prompt_Printf(arg->prompt, " Output: %ld --> %ld, Input: %ld --> %ld\n",
ccp->uncompout, ccp->compout,
ccp->compin, ccp->uncompin);
}
if (ccp->in.algorithm != -1)
prompt_Printf(arg->prompt, "\n Input Options: %s\n",
(*algorithm[ccp->in.algorithm]->Disp)(&ccp->in.opt));
if (ccp->out.algorithm != -1) {
o = &ccp->out.opt;
for (f = 0; f < ccp->out.algorithm; f++)
if (IsEnabled(ccp->cfg.neg[algorithm[f]->Neg]))
o = &(*o)->next;
prompt_Printf(arg->prompt, " Output Options: %s\n",
(*algorithm[ccp->out.algorithm]->Disp)(&(*o)->val));
}
prompt_Printf(arg->prompt, "\n Defaults: ");
prompt_Printf(arg->prompt, "FSM retry = %us, max %u Config"
" REQ%s, %u Term REQ%s\n", ccp->cfg.fsm.timeout,
ccp->cfg.fsm.maxreq, ccp->cfg.fsm.maxreq == 1 ? "" : "s",
ccp->cfg.fsm.maxtrm, ccp->cfg.fsm.maxtrm == 1 ? "" : "s");
prompt_Printf(arg->prompt, " deflate windows: ");
prompt_Printf(arg->prompt, "incoming = %d, ", ccp->cfg.deflate.in.winsize);
prompt_Printf(arg->prompt, "outgoing = %d\n", ccp->cfg.deflate.out.winsize);
#ifndef NODES
prompt_Printf(arg->prompt, " MPPE: ");
if (ccp->cfg.mppe.keybits)
prompt_Printf(arg->prompt, "%d bits, ", ccp->cfg.mppe.keybits);
else
prompt_Printf(arg->prompt, "any bits, ");
switch (ccp->cfg.mppe.state) {
case MPPE_STATEFUL:
prompt_Printf(arg->prompt, "stateful");
break;
case MPPE_STATELESS:
prompt_Printf(arg->prompt, "stateless");
break;
case MPPE_ANYSTATE:
prompt_Printf(arg->prompt, "any state");
break;
}
prompt_Printf(arg->prompt, "%s\n",
ccp->cfg.mppe.required ? ", required" : "");
#endif
prompt_Printf(arg->prompt, "\n DEFLATE: %s\n",
command_ShowNegval(ccp->cfg.neg[CCP_NEG_DEFLATE]));
prompt_Printf(arg->prompt, " PREDICTOR1: %s\n",
command_ShowNegval(ccp->cfg.neg[CCP_NEG_PRED1]));
prompt_Printf(arg->prompt, " DEFLATE24: %s\n",
command_ShowNegval(ccp->cfg.neg[CCP_NEG_DEFLATE24]));
#ifndef NODES
prompt_Printf(arg->prompt, " MPPE: %s\n",
command_ShowNegval(ccp->cfg.neg[CCP_NEG_MPPE]));
#endif
return 0;
}
示例7: PDMFactory
/* static */
bool
MP4Decoder::CanHandleMediaType(const nsACString& aMIMETypeExcludingCodecs,
const nsAString& aCodecs)
{
if (!IsEnabled()) {
return false;
}
// Whitelist MP4 types, so they explicitly match what we encounter on
// the web, as opposed to what we use internally (i.e. what our demuxers
// etc output).
const bool isMP4Audio = aMIMETypeExcludingCodecs.EqualsASCII("audio/mp4") ||
aMIMETypeExcludingCodecs.EqualsASCII("audio/x-m4a");
const bool isMP4Video =
// On B2G, treat 3GPP as MP4 when Gonk PDM is available.
#ifdef MOZ_GONK_MEDIACODEC
aMIMETypeExcludingCodecs.EqualsASCII(VIDEO_3GPP) ||
#endif
aMIMETypeExcludingCodecs.EqualsASCII("video/mp4") ||
aMIMETypeExcludingCodecs.EqualsASCII("video/x-m4v");
if (!isMP4Audio && !isMP4Video) {
return false;
}
nsTArray<nsCString> codecMimes;
if (aCodecs.IsEmpty()) {
// No codecs specified. Assume AAC/H.264
if (isMP4Audio) {
codecMimes.AppendElement(NS_LITERAL_CSTRING("audio/mp4a-latm"));
} else {
MOZ_ASSERT(isMP4Video);
codecMimes.AppendElement(NS_LITERAL_CSTRING("video/avc"));
}
} else {
// Verify that all the codecs specified are ones that we expect that
// we can play.
nsTArray<nsString> codecs;
if (!ParseCodecsString(aCodecs, codecs)) {
return false;
}
for (const nsString& codec : codecs) {
if (IsAACCodecString(codec)) {
codecMimes.AppendElement(NS_LITERAL_CSTRING("audio/mp4a-latm"));
continue;
}
if (codec.EqualsLiteral("mp3")) {
codecMimes.AppendElement(NS_LITERAL_CSTRING("audio/mpeg"));
continue;
}
// Note: Only accept H.264 in a video content type, not in an audio
// content type.
if (IsWhitelistedH264Codec(codec) && isMP4Video) {
codecMimes.AppendElement(NS_LITERAL_CSTRING("video/avc"));
continue;
}
// Some unsupported codec.
return false;
}
}
// Verify that we have a PDM that supports the whitelisted types.
PDMFactory::Init();
RefPtr<PDMFactory> platform = new PDMFactory();
for (const nsCString& codecMime : codecMimes) {
if (!platform->SupportsMimeType(codecMime)) {
return false;
}
}
return true;
}
示例8: MAKEINTRESOURCE
void CDateTimeUI::DoEvent(TEventUI& event)
{
if (!IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND) {
if (m_pParent != NULL) m_pParent->DoEvent(event);
else CLabelUI::DoEvent(event);
return;
}
if (event.Type == UIEVENT_SETCURSOR && IsEnabled()) {
::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_IBEAM)));
return;
}
if (event.Type == UIEVENT_WINDOWSIZE) {
if (m_pWindow != NULL) m_pManager->SetFocusNeeded(this);
}
if (event.Type == UIEVENT_SCROLLWHEEL) {
if (m_pWindow != NULL) return;
}
if (event.Type == UIEVENT_SETFOCUS && IsEnabled()) {
if (m_pWindow) return;
m_pWindow = new CDateTimeWnd();
ASSERT(m_pWindow);
m_pWindow->Init(this);
m_pWindow->ShowWindow();
}
if (event.Type == UIEVENT_KILLFOCUS && IsEnabled()) {
Invalidate();
}
if (event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK || event.Type == UIEVENT_RBUTTONDOWN) {
if (IsEnabled()) {
GetManager()->ReleaseCapture();
if (IsFocused() && m_pWindow == NULL) {
m_pWindow = new CDateTimeWnd();
ASSERT(m_pWindow);
}
if (m_pWindow != NULL) {
m_pWindow->Init(this);
m_pWindow->ShowWindow();
}
}
return;
}
if (event.Type == UIEVENT_MOUSEMOVE) {
return;
}
if (event.Type == UIEVENT_BUTTONUP) {
return;
}
if (event.Type == UIEVENT_CONTEXTMENU) {
return;
}
if (event.Type == UIEVENT_MOUSEENTER) {
return;
}
if (event.Type == UIEVENT_MOUSELEAVE) {
return;
}
CLabelUI::DoEvent(event);
}
示例9: GetSize
void Slider::Layout()
{
const auto &size = GetSize();
double w = size.x;
const auto &s = display.styles;
background->SetSize(size);
double scale = w / (max - min);
double offset, len;
if (min > 0) {
len = (value - min) * scale;
offset = 0;
}
else if (max < 0) {
len = -(value - max) * scale;
offset = w - len;
}
else {
double zeroPoint = -min * scale;
zeroLine->SetLength(size.y);
zeroLine->SetPos(zeroPoint, 0);
if (value < 0) {
len = -value * scale;
offset = zeroPoint - len;
}
else if (value > 0) {
len = value * scale;
offset = zeroPoint;
}
else {
len = 0;
offset = zeroPoint;
}
}
indicator->SetPos(offset, 0);
indicator->SetSize(len, size.y);
if (!IsEnabled()) {
background->SetColor(s.buttonDisabledBg);
indicator->SetColor(s.buttonDisabledBg);
}
else if (IsPressed()) {
background->SetColor(s.buttonPressedBg);
indicator->SetColor(s.buttonPressedBg);
}
else {
background->SetColor(s.buttonBg);
indicator->SetColor(s.buttonBg);
}
if (IsFocused()) {
background->SetBorder(4);
background->SetBorderColor(s.buttonFocusedBg);
}
else {
background->SetBorder(0);
}
}
示例10: GetThumbRect
void CUIVerticalLayout::DoEvent(TEventUI& event)
{
if( m_iSepHeight != 0 ) {
if( event.Type == UIEVENT_BUTTONDOWN && IsEnabled() ){
CUIRect rcSeparator = GetThumbRect(false);
if(rcSeparator.IsPtIn(event.ptMouse)) {
m_uButtonState |= UISTATE_CAPTURED;
ptLastMouse = event.ptMouse;
m_rcNewPos = m_rcItem;
if(!m_bImmMode /*&& m_pManager*/)
/*m_pManager->AddPostPaint(this);*/
return;
}
}
if( event.Type == UIEVENT_BUTTONUP ){
if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
m_uButtonState &= ~UISTATE_CAPTURED;
m_rcItem = m_rcNewPos;
if( !m_bImmMode /*&& m_pManager*/ )
/*m_pManager->RemovePostPaint(this);*/
NeedParentUpdate();
return;
}
}
if( event.Type == UIEVENT_MOUSEMOVE ){
if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
LONG cy = event.ptMouse.y - ptLastMouse.y;
ptLastMouse = event.ptMouse;
RECT rc = m_rcNewPos;
if( m_iSepHeight >= 0 ) {
if( cy > 0 && event.ptMouse.y < m_rcNewPos.bottom + m_iSepHeight )
return;
if( cy < 0 && event.ptMouse.y > m_rcNewPos.bottom )
return;
rc.bottom += cy;
if( rc.bottom - rc.top <= GetMinHeight() ) {
if( m_rcNewPos.bottom - m_rcNewPos.top <= GetMinHeight() )
return;
rc.bottom = rc.top + GetMinHeight();
}
if( rc.bottom - rc.top >= GetMaxHeight() ) {
if( m_rcNewPos.bottom - m_rcNewPos.top >= GetMaxHeight() )
return;
rc.bottom = rc.top + GetMaxHeight();
}
}else{
if( cy > 0 && event.ptMouse.y < m_rcNewPos.top )
return;
if( cy < 0 && event.ptMouse.y > m_rcNewPos.top + m_iSepHeight )
return;
rc.top += cy;
if( rc.bottom - rc.top <= GetMinHeight() ) {
if( m_rcNewPos.bottom - m_rcNewPos.top <= GetMinHeight() )
return;
rc.top = rc.bottom - GetMinHeight();
}
if( rc.bottom - rc.top >= GetMaxHeight() ) {
if( m_rcNewPos.bottom - m_rcNewPos.top >= GetMaxHeight() )
return;
rc.top = rc.bottom - GetMaxHeight();
}
}
CUIRect rcInvalidate = GetThumbRect(true);
m_rcNewPos = rc;
m_cxyFixed.cy = m_rcNewPos.bottom - m_rcNewPos.top;
if( m_bImmMode ) {
m_rcItem = m_rcNewPos;
NeedParentUpdate();
}else{
rcInvalidate.Join(GetThumbRect(true));
rcInvalidate.Join(GetThumbRect(false));
if(m_Window)
m_Window->Invalidate(rcInvalidate);
}
return;
}
}
if( event.Type == UIEVENT_SETCURSOR )
{
CUIRect rcSeparator = GetThumbRect(false);
if( IsEnabled() && rcSeparator.IsPtIn(event.ptMouse)) {
//
// TODO: SetCursor
//
//::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENS)));
return;
}
}
}
CUIContainer::DoEvent(event);
}
示例11: dc
void SToolBarButton::onPaint(wxPaintEvent& e)
{
wxPaintDC dc(this);
// Get system colours needed
wxColour col_background = Drawing::getMenuBarBGColour();
wxColour col_hilight = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
// Draw background
dc.SetBackground(wxBrush(col_background));
dc.Clear();
// Create graphics context
wxGraphicsContext* gc = wxGraphicsContext::Create(dc);
if (!gc)
return;
// Draw toggled border/background
if (action->isToggled())
{
// Use greyscale version of hilight colour
uint8_t r = col_hilight.Red();
uint8_t g = col_hilight.Green();
uint8_t b = col_hilight.Blue();
wxColour::MakeGrey(&r, &g, &b);
wxColour col_toggle(r, g, b, 255);
wxColour col_trans(r, g, b, 150);
if (toolbar_button_flat)
{
// Draw border
col_trans.Set(col_trans.Red(), col_trans.Green(), col_trans.Blue(), 80);
gc->SetBrush(col_trans);
gc->SetPen(wxPen(Drawing::darkColour(col_toggle, 5.0f)));
gc->DrawRectangle(1, 1, 20, 20);
}
else
{
// Draw border
gc->SetBrush(col_trans);
gc->SetPen(wxPen(Drawing::lightColour(col_toggle, 5.0f), 1));
gc->DrawRoundedRectangle(2, 2, 18, 18, 2);
// Draw outer border
gc->SetBrush(wxBrush(col_toggle, wxBRUSHSTYLE_TRANSPARENT));
gc->SetPen(wxPen(Drawing::darkColour(col_toggle, 5.0f)));
gc->DrawRoundedRectangle(1, 1, 20, 20, 2);
}
}
// Draw border on mouseover
if (state == STATE_MOUSEOVER || state == STATE_MOUSEDOWN)
{
// Determine transparency level
int trans = 160;
if (state == STATE_MOUSEDOWN)
trans = 200;
// Create semitransparent hilight colour
wxColour col_trans(col_hilight.Red(), col_hilight.Green(), col_hilight.Blue(), trans);
if (toolbar_button_flat)
{
// Draw border
col_trans.Set(col_trans.Red(), col_trans.Green(), col_trans.Blue(), 80);
gc->SetBrush(col_trans);
gc->SetPen(wxPen(col_hilight));
gc->DrawRectangle(1, 1, 20, 20);
}
else
{
// Draw border
gc->SetBrush(col_trans);
gc->SetPen(wxPen(Drawing::lightColour(col_hilight, 5.0f), 1));
gc->DrawRoundedRectangle(2, 2, 18, 18, 2);
// Draw outer border
gc->SetBrush(wxBrush(col_hilight, wxBRUSHSTYLE_TRANSPARENT));
gc->SetPen(wxPen(Drawing::darkColour(col_hilight, 5.0f)));
gc->DrawRoundedRectangle(1, 1, 20, 20, 2);
}
}
// Draw disabled icon if disabled
if (!IsEnabled())
{
// Determine toolbar background brightness
uint8_t r,g,b;
r = col_background.Red();
g = col_background.Green();
b = col_background.Blue();
wxColor::MakeGrey(&r, &g, &b);
// Draw disabled icon
gc->DrawBitmap(icon.ConvertToDisabled(r), 3, 3, 16, 16);
}
// Otherwise draw normal icon
else
gc->DrawBitmap(icon, 3, 3, 16, 16);
//.........这里部分代码省略.........
示例12: Activate
bool CControlUI::Activate()
{
if( !IsVisible() ) return false;
if( !IsEnabled() ) return false;
return true;
}
示例13: PaintText
void CLabelUI::PaintText(HDC hDC)
{
if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor();
if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();
RECT rc = m_rcItem;
rc.left += m_rcTextPadding.left;
rc.right -= m_rcTextPadding.right;
rc.top += m_rcTextPadding.top;
rc.bottom -= m_rcTextPadding.bottom;
if(!GetEnabledEffect())
{
if( m_sText.IsEmpty() ) return;
int nLinks = 0;
if( IsEnabled() ) {
if( m_bShowHtml )
CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, m_sText, m_dwTextColor, \
NULL, NULL, nLinks, m_uTextStyle);
else
CRenderEngine::DrawText(hDC, m_pManager, rc, m_sText, m_dwTextColor, \
m_iFont, m_uTextStyle);
}
else {
if( m_bShowHtml )
CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, m_sText, m_dwDisabledTextColor, \
NULL, NULL, nLinks, DT_SINGLELINE | m_uTextStyle);
else
CRenderEngine::DrawText(hDC, m_pManager, rc, m_sText, m_dwDisabledTextColor, \
m_iFont, DT_SINGLELINE | m_uTextStyle);
}
}
else
{
Font nFont(hDC,m_pManager->GetFont(GetFont()));
Graphics nGraphics(hDC);
nGraphics.SetTextRenderingHint(TextRenderingHintAntiAlias);
StringFormat format;
StringAlignment sa = StringAlignment::StringAlignmentNear;
if ((m_uTextStyle & DT_VCENTER) != 0) sa = StringAlignment::StringAlignmentCenter;
else if( (m_uTextStyle & DT_BOTTOM) != 0) sa = StringAlignment::StringAlignmentFar;
format.SetAlignment((StringAlignment)sa);
sa = StringAlignment::StringAlignmentNear;
if ((m_uTextStyle & DT_CENTER) != 0) sa = StringAlignment::StringAlignmentCenter;
else if( (m_uTextStyle & DT_RIGHT) != 0) sa = StringAlignment::StringAlignmentFar;
format.SetLineAlignment((StringAlignment)sa);
RectF nRc((float)rc.left,(float)rc.top,(float)rc.right-rc.left,(float)rc.bottom-rc.top);
RectF nShadowRc = nRc;
nShadowRc.X += m_ShadowOffset.X;
nShadowRc.Y += m_ShadowOffset.Y;
int nGradientLength = GetGradientLength();
if(nGradientLength == 0)
nGradientLength = (rc.bottom-rc.top);
LinearGradientBrush nLineGrBrushA(Point(GetGradientAngle(), 0),Point(0,nGradientLength),ARGB2Color(GetTextShadowColorA()),ARGB2Color(GetTextShadowColorB() == -1?GetTextShadowColorA():GetTextShadowColorB()));
LinearGradientBrush nLineGrBrushB(Point(GetGradientAngle(), 0),Point(0,nGradientLength),ARGB2Color(GetTextColor()),ARGB2Color(GetTextColor1() == -1?GetTextColor():GetTextColor1()));
if (GetEnabledLuminous())
{
// from http://bbs.csdn.net/topics/390346428
int iFuzzyWidth = (int)(nRc.Width/GetLuminousFuzzy());
if (iFuzzyWidth < 1) iFuzzyWidth = 1;
int iFuzzyHeight = (int)(nRc.Height/GetLuminousFuzzy());
if (iFuzzyHeight < 1) iFuzzyHeight = 1;
RectF nTextRc(0.0f, 0.0f, nRc.Width, nRc.Height);
Bitmap Bit1((INT)nRc.Width, (INT)nRc.Height);
Graphics g1(&Bit1);
g1.SetSmoothingMode(SmoothingModeAntiAlias);
g1.SetTextRenderingHint(TextRenderingHintAntiAlias);
g1.SetCompositingQuality(CompositingQualityAssumeLinear);
Bitmap Bit2(iFuzzyWidth, iFuzzyHeight);
Graphics g2(&Bit2);
g2.SetInterpolationMode(InterpolationModeHighQualityBicubic);
g2.SetPixelOffsetMode(PixelOffsetModeNone);
FontFamily ftFamily;
nFont.GetFamily(&ftFamily);
int iLen = wcslen(m_pWideText);
g1.DrawString(m_pWideText,iLen,&nFont,nRc,&format,&nLineGrBrushB);
g2.DrawImage(&Bit1, 0, 0, (int)iFuzzyWidth, (int)iFuzzyHeight);
g1.Clear(Color(0));
g1.DrawImage(&Bit2, (int)m_ShadowOffset.X, (int)m_ShadowOffset.Y, (int)nRc.Width, (int)nRc.Height);
g1.SetTextRenderingHint(TextRenderingHintAntiAlias);
nGraphics.DrawImage(&Bit1, nRc.X, nRc.Y);
}
if(GetEnabledStroke() && GetStrokeColor() > 0)
{
LinearGradientBrush nLineGrBrushStroke(Point(GetGradientAngle(),0),Point(0,rc.bottom-rc.top+2),ARGB2Color(GetStrokeColor()),ARGB2Color(GetStrokeColor()));
#ifdef _UNICODE
nRc.Offset(-1,0);
nGraphics.DrawString(m_sText,m_sText.GetLength(),&nFont,nRc,&format,&nLineGrBrushStroke);
nRc.Offset(2,0);
//.........这里部分代码省略.........
示例14: IsEnabled
bool CZClip::Enable(bool bOnOff)
{
m_bEnabled = !m_bEnabled;
return IsEnabled();
}
示例15: SetEnabled
void CLEDEntity::SetEnabled(bool b_enabled) {
CEntity::SetEnabled(b_enabled);
if(IsEnabled()) {
m_cColor = m_cInitColor;
}
}