// Called from window. Notifies that button has been clicked.
void CClickWindowController::NotifyButtonClick (CClickWindowController::EButton button)
{
	if (m_enabled)
	{
		if (button== CClickWindowController::NO_CLICK)
			// Disable click
			m_enabled= false;
		else
		{
			if (m_fastMode || (m_currentButton!= m_lockedButton && button== m_currentButton))				
				m_lockedButton= button;
			m_currentButton= button;
		}

		m_pWindow->UpdateButtons(GetEnabled(),GetCurrentButton(), GetLockedButton());
	}
	else
	{
		// Disabled state. Only handle NO_CLICK button
		if (button== CClickWindowController::NO_CLICK)
		{
			m_enabled= true;

			m_pWindow->UpdateButtons(GetEnabled(),GetCurrentButton(), GetLockedButton());
		}
	}
}
void Fire::Update()
{
	if (GetEnabled() && (millis() - GetLastUpdate()) > 1000 / GetSpeed())
	{
		if (GetLastUpdate() != 0)
			GetCanvas()->InvalidateRect(GetX(), GetY());

		SetY(GetY() + GetVDir());
		
		if ((GetY() + GetHeight() - 1) > GetCanvas()->GetScreenHeight() - 1)
		{
			SetEnabled(false);
			SetLastUpdate(0);
		}
		else if (GetY() < 0)
		{
			SetEnabled(false);
			SetLastUpdate(0);
		}

		if (GetEnabled())
		{
			/*
			Serial.print(GetX());
			Serial.print(",");
			Serial.print(GetY());
			*/
			GetCanvas()->Paint(GetX(), GetY());
			SetLastUpdate(millis());
		}
	}

}
Example #3
0
void pgaStep::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (!expandedKids)
	{
		expandedKids = true;
	}

	if (properties)
	{
		CreateListColumns(properties);

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("ID"), GetRecId());
		properties->AppendYesNoItem(_("Enabled"), GetEnabled());
		properties->AppendItem(_("Kind"), GetKind());
		if (GetConnStr().IsEmpty())
			properties->AppendItem(_("Database"), GetDbname());
		else
			properties->AppendItem(_("Connection String"), GetConnStr());
		properties->AppendItem(_("Code"), GetCode());
		properties->AppendItem(_("On error"), GetOnError());

		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
Example #4
0
void wxGISCatalogMainCmd::OnDropDownCommand(int nID)
{
    wxCHECK_RET(m_pGxApp, wxT("Application pointer is null"));

    wxGxSelection* pSel = m_pGxApp->GetGxSelection();
    wxGxCatalogBase* pCat = GetGxCatalog();

    if(pSel && pCat && GetEnabled())
    {
        int nPos = pSel->GetDoPos();
        int nNewPos = nID - ID_MENUCMD;
        long nSelId = wxNOT_FOUND; 
        if(nNewPos > nPos)
        {
            if(pSel->CanRedo())
            {
                nSelId = pSel->Redo(nNewPos);
            }
        }
        else
        {
            if(pSel->CanUndo())
            {
                nSelId = pSel->Undo(nNewPos);
            }
        }

        if(pCat->GetRegisterObject(nSelId))
		{
			pSel->Select(nSelId, false, wxGxSelection::INIT_ALL);
		}
    }
}
Example #5
0
void pgaSchedule::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
    if (!expandedKids)
    {
        expandedKids = true;
    }

    if (properties)
    {
        CreateListColumns(properties);

        properties->AppendItem(_("Name"), GetName());
        properties->AppendItem(_("ID"), GetRecId());
        properties->AppendYesNoItem(_("Enabled"), GetEnabled());

        properties->AppendItem(_("Start date"), GetStart());
        properties->AppendItem(_("End date"), GetEnd());
        properties->AppendItem(_("Minutes"), GetMinutesString());
        properties->AppendItem(_("Hours"), GetHoursString());
        properties->AppendItem(_("Weekdays"), GetWeekdaysString());
        properties->AppendItem(_("Monthdays"), GetMonthdaysString());
        properties->AppendItem(_("Months"), GetMonthsString());
        properties->AppendItem(_("Exceptions"), GetExceptionsString());

        properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
    }
}
Example #6
0
void CGUITextBox::Draw(CGraphicsHandler *g){
	if(GetVisible()){
		UpdateBB();
		if(m_pSprites){
			if(m_bButtonDown && m_bMouseOver && m_pSprites->Button->MouseDown && m_bEnabled)
				g->DrawSpriteTL(m_pSprites->Button->MouseDown, 0, m_pos);
			else if((m_bMouseOver || m_bButtonDown) && m_pSprites->Button->MouseOver && m_bEnabled)
				g->DrawSpriteTL(m_pSprites->Button->MouseOver, 0, m_pos);
			else if(m_pSprites->Button->Default)
				g->DrawSpriteTL(m_pSprites->Button->Default, 0, m_pos);
		}else if(m_pColors)
			g->DrawRectTL(m_pos, m_width, m_height, m_pColors->BG, m_border, m_pColors->Border);

		if((m_Caretx!=m_SelStartx || m_Carety!=m_SelStarty) && GetFocus()){
			if(m_SelStarty==m_Carety && !(m_SelStarty<m_Scrolly) && !(m_SelStarty>=m_Scrolly+((int)(m_height/13))))
				g->DrawRectTL(Vector2(m_pos.x+m_border+2+(m_SelStartx-m_Scrollx)*8, m_pos.y+m_border+2+(m_SelStarty-m_Scrolly)*13), (m_Caretx-m_SelStartx)*8, 13, ColorARGB(255, 0,0,255));
			else{
				if(m_Carety>m_SelStarty){
					if(!(m_SelStarty<m_Scrolly) && !(m_SelStarty>=m_Scrolly+((int)(m_height/13))))
						g->DrawRectTL(Vector2(m_pos.x+m_border+2+(m_SelStartx-m_Scrollx)*8, m_pos.y+m_border+2+(m_SelStarty-m_Scrolly)*13), m_Text[m_SelStarty].substr(m_SelStartx).length()*8, 13, ColorARGB(255, 0,0,255));
					
					for(UINT a=m_SelStarty+1; a<m_Carety; a++)
						if(!(a<m_Scrolly) && !(a>=m_Scrolly+((int)(m_height/13))))
							g->DrawRectTL(Vector2(m_pos.x+m_border+2+(-(int)m_Scrollx)*8, m_pos.y+m_border+2+(a-m_Scrolly)*13), m_Text[a].length()*8, 13, ColorARGB(255, 0,0,255));
					if(!(m_Carety<m_Scrolly) && !(m_Carety>=m_Scrolly+((int)(m_height/13))))
						g->DrawRectTL(Vector2(m_pos.x+m_border+2+(-(int)m_Scrollx)*8, m_pos.y+m_border+2+(m_Carety-m_Scrolly)*13), m_Text[m_Carety].substr(0, m_Caretx).length()*8, 13, ColorARGB(255, 0,0,255));
				}else{
					if(!(m_SelStarty<m_Scrolly) && !(m_SelStarty>=m_Scrolly+((int)(m_height/13))))
						g->DrawRectTL(Vector2(m_pos.x+m_border+2+(m_SelStartx-(int)m_Scrollx)*8, m_pos.y+m_border+2+(m_SelStarty-(int)m_Scrolly)*13), -(int)m_Text[m_SelStarty].substr(0, m_SelStartx).length()*8, 13, ColorARGB(255, 0,0,255));
					
					for(UINT a=m_SelStarty-1; a>m_Carety; a--)
						if(!(a<m_Scrolly) && !(a>=m_Scrolly+((int)(m_height/13))))
							g->DrawRectTL(Vector2(m_pos.x+m_border+2+(-(int)m_Scrollx)*8, m_pos.y+m_border+2+(a-m_Scrolly)*13), m_Text[a].length()*8, 13, ColorARGB(255, 0,0,255));
					if(!(m_Carety<m_Scrolly) && !(m_Carety>=m_Scrolly+((int)(m_height/13))))
						g->DrawRectTL(Vector2(m_pos.x+m_border+2+(m_Text[m_Carety].length())*8, m_pos.y+m_border+2+(m_Carety-(int)m_Scrolly)*13), -(int)m_Text[m_Carety].substr(m_Caretx).length()*8, 13, ColorARGB(255, 0,0,255));
				}
			}
		}
		
		if(m_TextDraw!=L"" && m_pColors){
			//if(m_Carety==m_SelStarty)
				g->DrawTextTL(m_TextDraw, Vector2(m_pos.x+m_border+2, m_pos.y+m_border+3), m_pColors->Text);
			//else{
				//g->DrawTextTL(m_TextDraw, Vector2(m_pos.x+m_border+2, m_pos.y+m_border+3), ColorARGB(255, 255, 0,0));
			//}
		}
		if(m_bCaretOn && GetFocus() && m_bSelectable && !(m_Carety<m_Scrolly) && !(m_Carety>=m_Scrolly+((int)(m_height/13))))
			g->DrawRectTL(Vector2(m_pos.x+m_border+2+(m_Caretx-m_Scrollx)*8, m_pos.y+m_border+2+(m_Carety-m_Scrolly)*13), 1, 13, ColorARGB(255, 0,0,0));

		if(m_pVSB!=NULL)
			m_pVSB->Draw(g);
		if(m_pHSB!=NULL)
			m_pHSB->Draw(g);

		if(!GetEnabled())
			g->DrawRectTL(m_pos, m_width, m_height, ColorARGB(128, 128, 128, 128));
		else if(m_bMouseOver && m_pSprites && m_pSprites->Cursor)
			g->DrawSpriteTL(m_pSprites->Cursor, 0, m_pos);
	}
}
void CXTPControlCustom::OnEnabledChanged()
{
	if (m_hwndControl)
	{
		::EnableWindow(m_hwndControl, GetEnabled());
	}
}
Example #8
0
// Process mouse events and perform arrow selection returning the
// ID of the selected arrow if it has been clicked.
uint32 FullscreenUI::Mouse(const int32 button, const int32 state,
                           const int32 previousState,
                           const b2Vec2 &mousePosition)
{
    if (GetEnabled() && button == GLUT_LEFT_BUTTON)
    {
        // If the mouse button is being pressed, update the current
        // arrow selection.
        if (state == GLUT_DOWN && previousState != GLUT_DOWN)
        {
            for (uint32 i = 0; i < k_numArrows &&
                    m_selection == e_SelectionNone; ++i)
            {
                m_selection = s_arrows[i].Hit(mousePosition,
                                              e_SelectionNone);
            }
        }
        // If the mouse button has been released, return the current
        // arrow selection.
        if (state == GLUT_UP)
        {
            const uint32 selectedArrow = m_selection;
            m_selection = e_SelectionNone;
            return selectedArrow;
        }
    }
    return e_SelectionNone;
}
Example #9
0
void CColorButtonCtrl::DrawControl(CDC& dc, CRect& rc)
{
    // paint the button rect
    CBrush br(m_BackColor), *pbrOld;
    CRect rcClip;

    dc.GetClipBox(&rcClip);
    pbrOld = dc.SelectObject(&br);

    dc.PatBlt(rcClip.left, rcClip.top, (rcClip.right - rcClip.left),
              (rcClip.bottom - rcClip.top), PATCOPY);

    dc.SelectObject(pbrOld);

    // draw bevel
    DrawBevelRaised(&dc, rc);

    // draw caption
    DrawCaption(&dc, rc, GetEnabled()? m_ForeColor : ::GetSysColor(COLOR_GRAYTEXT));

    // draw the frame
    if (this == GetFocus() ) {
        CBrush br(::GetSysColor(COLOR_3DDKSHADOW));
        FrameButton(br);
    }
}
Example #10
0
int pgRule::GetIconId()
{
	if (GetEnabled())
		return ruleFactory.GetIconId();
	else
		return ruleFactory.GetClosedIconId();
}
Example #11
0
wxMenu* wxGISCatalogViewsCmd::GetDropDownMenu(void)
{
	switch(m_subtype)
	{
		case 0:
        {
			if(GetEnabled())
			{
                wxMenu* pMenu = new wxMenu();
                pMenu->AppendCheckItem(ID_MENUCMD + (int)enumGISCVList, wxString(_("List")));
                pMenu->AppendCheckItem(ID_MENUCMD + (int)enumGISCVLarge, wxString(_("Icons")));
                pMenu->AppendCheckItem(ID_MENUCMD + (int)enumGISCVSmall, wxString(_("Smal Icons")));
                pMenu->AppendCheckItem(ID_MENUCMD + (int)enumGISCVReport, wxString(_("Details")));
                for(size_t i = 0; i < m_anContentsWinIDs.GetCount(); ++i)
                {
                    wxWindow* pWnd = wxWindow::FindWindowById(m_anContentsWinIDs[i]);
                    if(pWnd && pWnd->IsShown())
                    {
                        IGxContentsView* pGxContentsView = dynamic_cast<IGxContentsView*>(pWnd);
                        if(pGxContentsView)
                        {
                            wxGISEnumContentsViewStyle nStyle = pGxContentsView->GetStyle();
                            pMenu->Check(ID_MENUCMD + (int)nStyle, true);
                        }
                    }
                }
                return pMenu;
            }
            return NULL;
        }
		default:
			return NULL;
	}
}
Example #12
0
void LayerDlg::OnUpdateVisible(wxUpdateUIEvent& event)
{
	if (!IsShown())
		return;

	if (g_App.m_state == AS_Terrain)
	{
		vtStructureLayer *slay = GetStructureLayerFromItem(m_item);
		osg::Node *pThing = GetNodeFromItem(m_item);
		if (pThing && slay != NULL)
		{
			event.Check(GetEnabled(pThing));
			return;
		}
		vtLayer *lay = GetLayerFromItem(m_item);
		if (lay)
		{
			event.Check(lay->GetVisible());
		}
		event.Enable(pThing != NULL || lay != NULL);
	}
	else if (g_App.m_state == AS_Orbit)
	{
		LayerItemData *data = GetLayerDataFromItem(m_item);
		if (data && data->m_glay)
			event.Check(data->m_glay->GetEnabled());
		event.Enable(data && data->m_glay);
	}
}
Example #13
0
int pgTrigger::GetIconId()
{
	if (GetEnabled())
		return triggerFactory.GetIconId();
	else
		return triggerFactory.GetClosedIconId();
}
Example #14
0
bool GeometryButton::OnAction(HWND hwnd,GraphicsWindow *gw,IPoint2 hitLoc,IViewportButton::Action action)
{
	bool val = false;
	if(GetEnabled()==true)
	{
		IViewportButtonManager *vpm = static_cast<IViewportButtonManager*>(GetCOREInterface(IVIEWPORTBUTTONMANAGER_INTERFACE ));
		if(vpm)
			val =  vpm->HitTest(hwnd,gw,mLocation,hitLoc,mLabel);
	}
	if(val==true&&(action == IViewportButton::eRightClick||action == IViewportButton::eLeftClick))
	{
		IGeometryCheckerManager *man = GetIGeometryCheckerManager();
		if(man)
			man->PopupMenuSelect();
	}
	//now make sure we set the color correclty, but only set it when it changes
	Color textColor;
	if(val==true) //okay we hit it so change the color
	{
		 textColor = GetUIColor(COLOR_VP_LABEL_HIGHLIGHT);
	}
	else
	{
		COLORREF cr = ColorMan()->GetColor(GEOMETRY_TEXT_COLOR);
		textColor = Color(cr);
	}
	if(textColor!=mColor)
		SetColor(textColor);
	return val;
}
Example #15
0
//---------------------------------------------------------------------------
void TActionLog::ReflectSettings()
{
  TGuard Guard(FCriticalSection);

  bool ALogging =
    !FClosed && FConfiguration->GetLogActions() && GetEnabled();

  if (ALogging && !FLogging)
  {
    FLogging = true;
    Add(L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    Add(FORMAT(L"<session xmlns=\"http://winscp.net/schema/session/1.0\" name=\"%s\" start=\"%s\">",
      XmlAttributeEscape(FSessionData->GetSessionName()).c_str(), StandardTimestamp().c_str()));
  }
  else if (!ALogging && FLogging)
  {
    if (FInGroup)
    {
      EndGroup();
    }
    // do not try to close the file, if it has not been opened, to avoid recursion
    if (FFile != nullptr)
    {
      Add(L"</session>");
    }
    CloseLogFile();
    FLogging = false;
  }

}
Example #16
0
/**
 * Throw the dog a bone.
 * 
 * When everything is going well, you feed your dog when you get home.
 * Let's hope you don't drive your car off a bridge on the way home...
 * Your dog won't get fed and he will starve to death.
 * 
 * By the way, it's not cool to ask the neighbor (some random task) to
 * feed your dog for you.  He's your responsibility!
 * 
 * @returns Returns the previous state of the watchdog before feeding it.
 */
bool Watchdog::Feed()
{
	bool previous = GetEnabled();
	m_fpgaWatchDog->strobeFeed(&status);
	wpi_assertCleanStatus(status);
	return previous;
}
nsresult nsMsgSearchValidityTable::ValidateTerms(nsIArray *searchTerms) {
  nsresult rv = NS_OK;
  uint32_t count;

  NS_ENSURE_ARG_POINTER(searchTerms);

  searchTerms->GetLength(&count);
  for (uint32_t i = 0; i < count; i++) {
    nsCOMPtr<nsIMsgSearchTerm> pTerm = do_QueryElementAt(searchTerms, i);

    nsIMsgSearchTerm *iTerm = pTerm;
    nsMsgSearchTerm *term = static_cast<nsMsgSearchTerm *>(iTerm);
    //    XP_ASSERT(term->IsValid());
    bool enabled;
    bool available;
    rv = GetEnabled(term->m_attribute, term->m_operator, &enabled);
    NS_ENSURE_SUCCESS(rv, rv);
    rv = GetAvailable(term->m_attribute, term->m_operator, &available);
    NS_ENSURE_SUCCESS(rv, rv);
    if (!enabled || !available) {
      bool validNotShown;
      rv = GetValidButNotShown(term->m_attribute, term->m_operator,
                               &validNotShown);
      NS_ENSURE_SUCCESS(rv, rv);
      if (!validNotShown) return NS_MSG_ERROR_INVALID_SEARCH_SCOPE;
    }
  }

  return rv;
}
Example #18
0
int pgaJob::GetIconId()
{
	if (GetEnabled())
		return jobFactory.GetIconId();
	else
		return jobFactory.GetDisabledId();
}
Example #19
0
void pgRule::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (properties)
	{
		CreateListColumns(properties);
		wxString def = GetFormattedDefinition();
		if (!def.IsEmpty())
		{
			int doPos = def.Find(wxT(" DO INSTEAD "));
			if (doPos > 0)
				def = def.Mid(doPos + 12).Strip(wxString::both);
			else
			{
				doPos = def.Find(wxT(" DO "));
				if (doPos > 0)
					def = def.Mid(doPos + 4).Strip(wxString::both);
			}
		}

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("OID"), GetOid());
		properties->AppendItem(_("Event"), GetEvent());
		properties->AppendItem(_("Condition"), GetCondition());
		properties->AppendYesNoItem(_("Do instead?"), GetDoInstead());
		properties->AppendItem(_("Definition"), firstLineOnly(def));
		if (this->GetDatabase()->connection()->BackendMinimumVersion(8, 3))
			properties->AppendYesNoItem(_("Enabled?"), GetEnabled());
		properties->AppendYesNoItem(_("System rule?"), GetSystemObject());
		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
void CFireModePlugin_AutoAim::AlterFiringDirection( const Vec3& firingPos, Vec3& rFiringDir ) const
{
#if ALLOW_PROJECTILEHELPER_DEBUGGING
	m_lastShotAutoAimedStatus.clear();
	m_lastTargetRejectionReason.clear(); 
#endif //#if ALLOW_PROJECTILEHELPER_DEBUGGING

	if( GetEnabled() )
	{
		if(CWeapon* pWeapon = m_pOwnerFiremode->GetWeapon())
		{
			if(EntityId ownerId = pWeapon->GetOwnerId())
			{
				AdjustFiringDirection(firingPos, rFiringDir, pWeapon->IsZoomed()||pWeapon->IsZoomingIn(), ownerId);
			}
		}
	}

#if ALLOW_PROJECTILEHELPER_DEBUGGING
	if(m_lastShotAutoAimedStatus.empty())
	{
		m_lastShotAutoAimedStatus.append("FALSE");
	}
#endif //#if ALLOW_PROJECTILEHELPER_DEBUGGING
}
Example #21
0
bool ActorEquipmentOverrider::UnregisterHandler(OverrideHandlerIdentifierT ID)
{
	bool Result = false;
	if (GetEnabled())
	{
		if (OverrideInProgress == false)
		{
			if (ID != ActorEquipmentOverrider::InvalidID && HandlerTable.count(ID))
			{
				HandlerTable.erase(ID);
				Result = true;
			}
			else
			{
				_MESSAGE("Couldn't unregister equipment override handler - Invalid ID %d", ID);
			}
		}
		else
		{
			_MESSAGE("Attempting to unregister an equipment override handler while an override operation is in progress");
		}
	}


	return Result;
}
Example #22
0
void GeometryButton::ResetLocation(ViewExp *vpt)
{
	if ( ! vpt || ! vpt->IsAlive() )
	{	
		// why are we here?
		DbgAssert(!_T("Doing ResetLocation() on invalid viewport!"));
		return;
	}

	if(GetEnabled()==true&&mLabel.Length()>0)
	{
		SIZE sp;
		GraphicsWindow *gw = vpt->getGW();
		gw->getTextExtents(mLabel.data(),&sp);
		RECT rect;
		HWND hWnd = vpt->GetHWnd();
		GetWindowRect (hWnd, &rect);
		int width = rect.right - rect.left;
		mLocation.x = width/2 - sp.cx/2;

		//need to reset the y here also...
		IGeometryCheckerManager *man = GetIGeometryCheckerManager();
		if(man->GetDisplayTextUpTop()==false)
		{
			int mult = 1; // at least for top
			if(man->DoesGeometryCheckerHavePropDlg(man->GetActivatedGeometryCheckerIndex()))
				++mult;
			if(man->GetAutoUpdate()==false)
				++mult;
			mLocation.y = (rect.bottom-rect.top) - mult*(4+OFFSET) + OFFSET;
		}
	}
}
nsresult
nsMsgSearchValidityTable::ValidateTerms (nsISupportsArray *searchTerms)
{
  nsresult err = NS_OK;
  PRUint32 count;

  NS_ENSURE_ARG(searchTerms);

  searchTerms->Count(&count);
  for (PRUint32 i = 0; i < count; i++)
  {
    nsCOMPtr<nsIMsgSearchTerm> pTerm;
    searchTerms->QueryElementAt(i, NS_GET_IID(nsIMsgSearchTerm),
                             (void **)getter_AddRefs(pTerm));

    nsIMsgSearchTerm *iTerm = pTerm;
    nsMsgSearchTerm *term = static_cast<nsMsgSearchTerm *>(iTerm);
//    XP_ASSERT(term->IsValid());
        bool enabled;
        bool available;
        GetEnabled(term->m_attribute, term->m_operator, &enabled);
        GetAvailable(term->m_attribute, term->m_operator, &available);
    if (!enabled || !available)
    {
            bool validNotShown;
            GetValidButNotShown(term->m_attribute, term->m_operator,
                                &validNotShown);
            if (!validNotShown)
        err = NS_MSG_ERROR_INVALID_SEARCH_SCOPE;
    }
  }

  return err;
}
Example #24
0
//
/// Paint the text gadget by painting gadget borders, & then painting text in
/// the InnerRect. Empty or 0 text blanks the gadget.
//
/// Calls TGadget::PaintBorder to paint the border. Calls TGadget::GetInnerRect to
/// calculate the area of the text gadget's rectangle. If the text is left-aligned,
/// Paint calls dc.GetTextExtent to compute the width and height of a line of the
/// text. To set the background color, Paint calls dc.GetSysColor and sets the
/// default background color to face shading (COLOR_BTNFACE). To set the button text
/// color, Paint calls dc.SetTextColor and sets the default button text color to
/// COLOR_BTNTEXT. To draw the text, Paint calls dc.ExtTextOut and passes the
/// parameters ETO_CLIPPED (so the text is clipped to fit the rectangle) and
/// ETO_OPAQUE (so the rectangle is filled with the current background color).
//
void
TTextGadget::Paint(TDC& dc)
{
  PaintBorder(dc);

  TRect  innerRect;
  GetInnerRect(innerRect);

  if (!Font)
    dc.SelectObject(GetGadgetWindow()->GetFont());
  else
    dc.SelectObject(*Font);

  TColor textColor = GetEnabledColor();
  if(!GetEnabled())
    textColor = TColor::Sys3dHilight;

  bool transparent = GetGadgetWindow()->GetFlatStyle() & TGadgetWindow::FlatXPTheme;
  if(!Text){
    if (!transparent)
    {
    TColor color = dc.SetBkColor(TColor::Sys3dFace);
    dc.ExtTextOut(0,0, ETO_OPAQUE, &innerRect, _T(""), 0);
    dc.SetBkColor(color);
  }
  }
  else
  {
    // Create a UI Face object for this button & let it paint the button face
    //
    uint align[] = {DT_LEFT, DT_CENTER, DT_RIGHT};
    uint format =  DT_SINGLELINE | DT_VCENTER | align[Align];
            TUIFace face(innerRect, Text, BkgndColor, format);

     TPoint  dstPt(innerRect.TopLeft());

      dc.SetBkColor(BkgndColor);

     TColor oldTxColor  = dc.SetTextColor(textColor);
    if (!GetEnabled())
      face.Paint(dc, dstPt, TUIFace::Disabled, false, !transparent);
    else
      face.Paint(dc, dstPt, TUIFace::Normal, false, !transparent);
    dc.SetTextColor(oldTxColor);
  }
  dc.RestoreFont();
}
Example #25
0
/**
 * Throw the dog a bone.
 * 
 * When everything is going well, you feed your dog when you get home.
 * Let's hope you don't drive your car off a bridge on the way home...
 * Your dog won't get fed and he will starve to death.
 * 
 * By the way, it's not cool to ask the neighbor (some random task) to
 * feed your dog for you.  He's your responsibility!
 * 
 * @returns Returns the previous state of the watchdog before feeding it.
 */
bool Watchdog::Feed()
{
	bool previous = GetEnabled();
	tRioStatusCode localStatus = NiFpga_Status_Success;
	m_fpgaWatchDog->strobeFeed(&localStatus);
	wpi_setError(localStatus);
	return previous;
}
Example #26
0
//---------------------------------------------------------------------------
void TActionLog::SetEnabled(bool Value)
{
  if (GetEnabled() != Value)
  {
    FEnabled = Value;
    ReflectSettings();
  }
}
bool CollisionSystem::ReproduceEntities(std::shared_ptr<Entity> entity1,
    std::shared_ptr<Entity> entity2)
{
    auto reproductionComponent1 = std::static_pointer_cast<ReproductionComponent>(
        Engine::GetInstance().GetSingleComponentOfClass(entity1,
            "ReproductionComponent"));

    auto reproductionComponent2 = std::static_pointer_cast<ReproductionComponent>(
        Engine::GetInstance().GetSingleComponentOfClass(entity2,
            "ReproductionComponent"));

    auto particleComponent1 = std::static_pointer_cast<ParticleComponent>(
        Engine::GetInstance().GetSingleComponentOfClass(entity1,
            "ParticleComponent"));
    auto particleComponent2 = std::static_pointer_cast<ParticleComponent>(
        Engine::GetInstance().GetSingleComponentOfClass(entity2,
            "ParticleComponent"));

    auto position1 = particleComponent1->GetPosition();
    auto position2 = particleComponent2->GetPosition();

    if (position1.CalculateDistance(position2) >= CFG_GETF("REPRODUCTION_DISTANCE_MAX"))
        return true;

    auto enabled1 = reproductionComponent1->GetEnabled();
    auto enabled2 = reproductionComponent2->GetEnabled();

    auto reproduced1 = reproductionComponent1->GetReproduced();
    auto reproduced2 = reproductionComponent2->GetReproduced();

    auto type1 = reproductionComponent1->GetType();
    auto type2 = reproductionComponent2->GetType();

    if (enabled1 && enabled2 && !reproduced1 && !reproduced2 && type1 == type2)
    {
        LOG_D("[CollisionSystem] Reproducing entities " << entity1->GetId()
            << " and " << entity2->GetId());
        EntityFactory::CreateCell(particleComponent1->GetPosition() + Vector(50, 50));
        reproductionComponent1->SetReproduced(true);
        reproductionComponent2->SetReproduced(true);
        return true;
    }

    return false;
}
// Called from window. Notifies that button has been entered
void CClickWindowController::NotifyButtonEnter (CClickWindowController::EButton button)
{
	if (m_enabled && m_fastMode)
	{
		if (button!= CClickWindowController::NO_CLICK && button!= m_currentButton)
		{
			m_currentButton= button;
			m_pWindow->UpdateButtons(GetEnabled(),GetCurrentButton(), GetLockedButton());
		}
	}	
}
Example #29
0
void CTimeCtrl::OnIntervalChanged()
{
	// Restart timer if it's enabled
	if (GetEnabled() && AmbientUserMode())
	{
		StopTimer();
		StartTimer();
	}

	SetModifiedFlag(TRUE);
}
Example #30
0
int CTimeCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (COleControl::OnCreate(lpCreateStruct) == -1)
		return -1;

	// Start timer if in user mode and if enabled
	if (AmbientUserMode() && GetEnabled())
		StartTimer();

	return 0;
}