当前位置: 首页>>代码示例>>C++>>正文


C++ IsSelected函数代码示例

本文整理汇总了C++中IsSelected函数的典型用法代码示例。如果您正苦于以下问题:C++ IsSelected函数的具体用法?C++ IsSelected怎么用?C++ IsSelected使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IsSelected函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetKeyState

void CHexEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	nFlags;	nRepCnt;

	BOOL bShift = GetKeyState(VK_SHIFT) & 0x80000000;
	BOOL bac = m_bNoAddressChange;
	m_bNoAddressChange = TRUE;
	switch(nChar)
	{
		case VK_DOWN:
			if(bShift)
			{
				if(!IsSelected())
				{
					m_selStart = m_currentAddress;
				}
				Move(0,1);
				m_selEnd   = m_currentAddress;
				if(m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW)
					m_selEnd++;
				RedrawWindow();
				break;
			}
			else
				SetSel(-1, -1);
			Move(0,1);
			break;
		case VK_UP:
			if(bShift)
			{
				if(!IsSelected())
				{
					m_selStart = m_currentAddress;
				}
				Move(0,-1);
				m_selEnd   = m_currentAddress;
				RedrawWindow();
				break;
			}
			else
				SetSel(-1, -1);
			Move(0,-1);
			break;
		case VK_LEFT:
			if(bShift)
			{
				if(!IsSelected())
				{
					m_selStart = m_currentAddress;
				}
				Move(-1,0);
				m_selEnd   = m_currentAddress;
				RedrawWindow();
				break;
			}
			else
				SetSel(-1, -1);
			Move(-1,0);
			break;
		case VK_RIGHT:
			if(bShift)
			{
				if(!IsSelected())
				{
					m_selStart = m_currentAddress;
				}
				Move(1,0);
				m_selEnd   = m_currentAddress;
				if(m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW)
					m_selEnd++;
				RedrawWindow();
				break;
			}
			else
				SetSel(-1, -1);
			Move(1,0);
			break;
		case VK_PRIOR:
			if(bShift)
			{
				if(!IsSelected())
				{
					m_selStart = m_currentAddress;
				}
				OnVScroll(SB_PAGEUP, 0, NULL);
				Move(0,0);
				m_selEnd   = m_currentAddress;
				RedrawWindow();
				break;
			}
			else
				SetSel(-1, -1);
			OnVScroll(SB_PAGEUP, 0, NULL);
			Move(0,0);
			break;
		case VK_NEXT:
			if(bShift)
			{
				if(!IsSelected())
				{
//.........这里部分代码省略.........
开发者ID:Garfield-Chen,项目名称:openlibs,代码行数:101,代码来源:HexEdit.cpp

示例2: wxCHECK_RET

void wxListBox::SetString(
  int                               N
, const wxString&                   rsString
)
{
    wxCHECK_RET( N >= 0 && N < m_nNumItems,
                 wxT("invalid index in wxListBox::SetString") );

    //
    // Remember the state of the item
    //
    bool                            bWasSelected = IsSelected(N);
    void*                           pOldData = NULL;
    wxClientData*                   pOldObjData = NULL;

    if (m_clientDataItemsType == wxClientData_Void)
        pOldData = GetClientData(N);
    else if (m_clientDataItemsType == wxClientData_Object)
        pOldObjData = GetClientObject(N);

    //
    // Delete and recreate it
    //
    ::WinSendMsg( GetHwnd()
                 ,LM_DELETEITEM
                 ,(MPARAM)N
                 ,(MPARAM)0
                );

    int                             nNewN = N;

    if (N == m_nNumItems - 1)
        nNewN = -1;

    ::WinSendMsg( GetHwnd()
                 ,LM_INSERTITEM
                 ,(MPARAM)nNewN
                 ,(MPARAM)rsString.c_str()
                );

    //
    // Restore the client data
    //
    if (pOldData)
        SetClientData( N
                      ,pOldData
                     );
    else if (pOldObjData)
        SetClientObject( N
                        ,pOldObjData
                       );

    //
    // We may have lost the selection
    //
    if (bWasSelected)
        Select(N);

#if wxUSE_OWNER_DRAWN
    if (m_windowStyle & wxLB_OWNERDRAW)
        //
        // Update item's text
        //
        m_aItems[N]->SetName(rsString);
#endif  //USE_OWNER_DRAWN
} // end of wxListBox::SetString
开发者ID:Duion,项目名称:Torsion,代码行数:66,代码来源:listbox.cpp

示例3: Draw

void CVisualNode::Draw(CVisualDrawContext & Ctx)
{
    RECT rect;
    size_t n;

    Ctx.SelectSmallFont();

    if(IsSelected())
    {
        Ctx.SelectPen(m_clrSelectedBorder, 2);
    }
    else
    {
        Ctx.SelectPen(m_clrLine, 1);
    }

    // select colors
    Ctx.SelectSolidBrush(m_clrFill);

    // draw rect
    Ctx.MapRect(m_Rect, rect);
    Rectangle(Ctx.DC(), rect.left, rect.top, rect.right, rect.bottom);

    if(!m_strLabel.IsEmpty()) 
    {
        COLORREF oldColor = SetTextColor(Ctx.DC(), m_clrLine);
        Ctx.SelectSolidBrush(RGB(0, 0, 0));
        SetBkColor(Ctx.DC(), m_clrFill);

        rect.left += 5;
        rect.right -= 5;
        rect.top +=5;
        
        DrawText(Ctx.DC(), m_strLabel, m_strLabel.GetLength(), &rect, DT_WORDBREAK);

        SetTextColor(Ctx.DC(), oldColor);
    }

    if(m_fTopoError)
    {
        COLORREF oldColor = SetTextColor(Ctx.DC(), m_clrErrorText);
        rect.top += 10;

        CAtlStringW errString = LoadAtlString(IDS_E_TOPO_RESOLUTION);
        DrawText(Ctx.DC(), errString, errString.GetLength(), &rect, DT_WORDBREAK);

        SetTextColor(Ctx.DC(), oldColor);
    }

    Ctx.PushState();

    Ctx.ShiftCoordinates(m_Rect.x(), m_Rect.y());
    
    // draw pins
    for(n = 0; n < m_InputPins.GetCount(); n++)
    {
        m_InputPins.GetAt(n)->Draw(Ctx);
    }

    for(n = 0; n < m_OutputPins.GetCount(); n++)
    {
        m_OutputPins.GetAt(n)->Draw(Ctx);
    }
    
    Ctx.PopState();

    Ctx.DeselectSmallFont();
}
开发者ID:AbdoSalem95,项目名称:WindowsSDK7-Samples,代码行数:68,代码来源:tedvis.cpp

示例4:

void
DriveItem::DrawItem(BView* owner, BRect frame, bool complete)
{
	owner->PushState();
	owner->SetDrawingMode(B_OP_ALPHA);
	if (IsSelected() || complete) {
		if (IsSelected()) {
			owner->SetHighColor(tint_color(owner->LowColor(), B_DARKEN_2_TINT));
			owner->SetLowColor(owner->HighColor());
		} else
			owner->SetHighColor(owner->LowColor());

		owner->FillRect(frame);
	}

	rgb_color black = {0, 0, 0, 255};

	if (!IsEnabled())
		owner->SetHighColor(tint_color(black, B_LIGHTEN_2_TINT));
	else
		owner->SetHighColor(black);

	// icon
	owner->MovePenTo(frame.left + 4, frame.top + 1);
	owner->DrawBitmap(fIcon);

	// device
	owner->MovePenTo(frame.left + 8 + fIcon->Bounds().Width(), frame.top + fSecondBaselineOffset);
	owner->DrawString(fPath.Path());

	// size
	owner->MovePenTo(frame.right - 4 - fSizeWidth, frame.top + fBaselineOffset);
	owner->DrawString(fSize.String());

	// name
	BFont boldFont;
	owner->GetFont(&boldFont);
	boldFont.SetFace(B_BOLD_FACE);
	owner->SetFont(&boldFont);

	owner->MovePenTo(frame.left + 8 + fIcon->Bounds().Width(), frame.top + fBaselineOffset);
	owner->DrawString(fName.String());

	if (fCanBeInstalled != B_OK) {
		owner->SetHighColor(140, 0, 0);
		owner->MovePenBy(fBaselineOffset, 0);
		const char* message;
		switch (fCanBeInstalled) {
			case B_PARTITION_TOO_SMALL:
				message = B_TRANSLATE_COMMENT("No space available!",
					"Cannot install");
				break;
			case B_ENTRY_NOT_FOUND:
				message = B_TRANSLATE_COMMENT("Incompatible format!",
					"Cannot install");
				break;
			default:
				message = B_TRANSLATE_COMMENT("Cannot access!",
					"Cannot install");
				break;
		}
		owner->DrawString(message);
	}

	owner->PopState();
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:66,代码来源:DrivesPage.cpp

示例5: ERROR2IF_PF

BOOL NodeSimpleShape::DoBecomeA(BecomeA* pBecomeA)
{
	// Check for a NULL entry param
	ERROR2IF_PF(pBecomeA == NULL,FALSE,("pBecomeA is NULL"));

	// This lump checks that the Reason is one that we understand
	// It also makes sure that we don't have a NULL UndoOp ptr
	BOOL ValidReason = (pBecomeA->GetReason() == BECOMEA_REPLACE || pBecomeA->GetReason() == BECOMEA_PASSBACK);
	ERROR2IF_PF(!ValidReason,FALSE,("Unkown BecomeA reason %d",pBecomeA->GetReason()));

	// pBecomeA->Reason is one that we understand.

	BOOL 		Success = TRUE;			// Our success flag (Important that this defaults to TRUE)
	NodePath* 	pNewNodePath = NULL;	// Ptr to a new NodePath, if we get to make one.

	if (pBecomeA->BAPath())
	{
		// We need to create a new NodePath, no matter what the reason.
		
		// Allocate a new NodePath node
		ALLOC_WITH_FAIL(pNewNodePath, (new NodePath), pBecomeA->GetUndoOp()); 
		Success = (pNewNodePath != NULL);

		// Initialise the path
		if (Success) CALL_WITH_FAIL(pNewNodePath->InkPath.Initialise(InkPath.GetNumCoords(),12), pBecomeA->GetUndoOp(), Success);
		if (Success) CALL_WITH_FAIL(pNewNodePath->InkPath.CopyPathDataFrom(&InkPath), pBecomeA->GetUndoOp(), Success);

		// If Success is TRUE, then we now have a new NodePath object that contains this shape's path

		if (Success)
		{
		 	switch (pBecomeA->GetReason())
			{
		 		case BECOMEA_REPLACE :
				{
					// It's a BECOMEA_REPLACE, so replace this node with the new NodePath in an undoable way

					// Can't do it in an undoable way without an Undo Op
					ERROR2IF_PF(pBecomeA->GetUndoOp() == NULL,FALSE,("GetUndoOp() returned NULL"));

					// Firstly, hide this node
					NodeHidden* pNodeHidden; 
					Success = pBecomeA->GetUndoOp()->DoHideNode(this, TRUE, &pNodeHidden);

					if (Success)
					{
						// Insert the new NodePath into the tree, next to the hidden node
						pNewNodePath->AttachNode(pNodeHidden,NEXT);

						// Copy the node's attributes
						CALL_WITH_FAIL(CopyChildrenTo(pNewNodePath), pBecomeA->GetUndoOp(), Success); 

						if (Success)
						{
							// Set the bounds  
							pNewNodePath->InvalidateBoundingRect();
							pNewNodePath->SetSelected(IsSelected());

							// Create a hide node action to hide the node when we undo 
							HideNodeAction* UndoHideNodeAction;     
							Success = (HideNodeAction::Init(pBecomeA->GetUndoOp(),
											  		 pBecomeA->GetUndoOp()->GetUndoActionList(),
									 				 pNewNodePath, 
									 				 TRUE, 		 // Include subtree size 
							  		 				 ( Action**)(&UndoHideNodeAction))
							  		  				 != AC_FAIL);
						}
					}

					if (Success)
						pBecomeA->PassBack(pNewNodePath, this);
				}
				break;

				case BECOMEA_PASSBACK :
					Success = pBecomeA->PassBack(pNewNodePath,this);
				break;

				default:
					break;
			}
		}
	}

	if (!Success)
	{
		if (pNewNodePath != NULL)
		{
			// Delete all the NodePath's children (if it has any) and unlink it from the tree (if it's linked)
			// This is all done by CascadeDelete()
			pNewNodePath->CascadeDelete(); 
			delete pNewNodePath;
			pNewNodePath = NULL;
		}
	}

	return Success;
}
开发者ID:Amadiro,项目名称:xara-cairo,代码行数:98,代码来源:nodeshap.cpp

示例6: IsSelected

	bool  CCheckBoxUI::GetCheck() const
	{
		return IsSelected();
	}
开发者ID:839687571,项目名称:nsduilib,代码行数:4,代码来源:UICheckBox.cpp

示例7: IsSelected

//-------------------------------------------------------------------------
void CTinyCadDoc::SaveXML(CXMLWriter &xml, drawingCollection &drawing, BOOL Details, BOOL SaveSelect, BOOL SaveResources )
{
  // Write the objects to the file
  try
  {  
	xml.addTag(GetXMLTag());

	// If necessary write the header stamp
	if (Details) 
	{
		xml.addTag(_T("NAME"));
		xml.addChildData( m_sheet_name );
		xml.closeTag();

		xml.addTag(_T("DETAILS"));
		m_oDetails.WriteXML( xml );
		m_snap.SaveXML( xml );
		xml.closeTag();
	}

	if (SaveResources)
	{
		// Find out which resources are in use
		
		for( drawingIterator i = drawing.begin(); i != drawing.end(); i++ )
		{
			(*i)->TagResources();
		}

		// Save the resource details details
		theOptions.SaveFontsXML(xml);
		theOptions.SaveStylesXML(xml);
		theOptions.SaveFillStylesXML(xml);
		theOptions.SaveMetaFilesXML(xml);
	}

	// Only save the symbols if we are not saving
	// to a library or the header...
	if (Details)
	{
		theOptions.SaveSymbolsXML(xml);
	}

	if (Details)
	{
		theOptions.WriteXML( xml) ;
	}

	for( drawingIterator i = drawing.begin(); i != drawing.end(); i++ )
	{
		CDrawingObject* obj = *i;

		if (obj->GetType() != xError
			&& 	(Details || !obj->IsConstruction()) 
			&&  (!SaveSelect || IsSelected( obj )) )
		{

			// Now save the actual object data
			obj->SaveXML(xml);
		}
	}

	xml.closeTag();

  }
  catch ( CException *e) 
  {
	// Could not save the file properly
    e->ReportError();
    e->Delete();
  }
}
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:73,代码来源:Io.cpp

示例8: switch

void ColorListItem::DrawItem(BView* owner, BRect itemRect, bool drawEverything)
{
	BRect textRect = itemRect;
	BRect colorRect = fColorFrame;

	colorRect.top = itemRect.top + 1;
	colorRect.bottom = itemRect.bottom - 1;
	textRect.right = textRect.right - (fColorFrame.Width());
	colorRect.left++;
	colorRect.OffsetBy(textRect.Width(), 0);

	switch (fColorFrameAlign) {
	case B_ALIGN_LEFT: {
		textRect.OffsetBy(fColorFrame.Width(), 0);
		colorRect.OffsetBy(-textRect.Width(), 0);
		break;
	}
	default:
		break;
	}

	// center color rect vertically
	// colorRect.OffsetTo(colorRect.left, (itemRect.Height()-colorRect.Height())/2);

	if (IsEnabled()) {
		if (IsSelected()) {
			owner->SetHighColor(EnabledSelectedBackgroundColor);
		} else {
			owner->SetHighColor(EnabledDeselectedBackgroundColor);
		}
	} else {
		if (IsSelected()) {
			owner->SetHighColor(DisabledSelectedBackgroundColor);
		} else {
			owner->SetHighColor(DisabledDeselectedBackgroundColor);
		}
	}

	owner->FillRect(itemRect);

	owner->SetHighColor(fFrameColor);
	owner->StrokeRect(colorRect);

	colorRect.InsetBy(1, 1);
	owner->SetHighColor(fColor);
	owner->FillRect(colorRect);

	if (IsEnabled()) {
		if (IsSelected()) {
			owner->SetHighColor(EnabledSelectedTextColor);
			owner->SetLowColor(EnabledSelectedBackgroundColor);
		} else {
			owner->SetHighColor(EnabledDeselectedTextColor);
			owner->SetLowColor(EnabledDeselectedBackgroundColor);
		}
	} else {
		if (IsSelected()) {
			owner->SetHighColor(DisabledSelectedTextColor);
			owner->SetLowColor(DisabledSelectedBackgroundColor);
		} else {
			owner->SetHighColor(DisabledDeselectedTextColor);
			owner->SetLowColor(DisabledDeselectedBackgroundColor);
		}
	}

	font_height fh;

	owner->GetFontHeight(&fh);
	owner->DrawString(Text(), BPoint(textRect.left + 3, textRect.bottom - fh.descent));
	// BStringItem::DrawItem(owner, itemRect, drawEverything);
}
开发者ID:HaikuArchives,项目名称:Helios,代码行数:71,代码来源:ColorListItem.cpp

示例9: Update

//------------------------------------------------------------------------
void CDebugGun::Update( SEntityUpdateContext& ctx, int update)
{ 
  if (!IsSelected())
    return;
  
  static float drawColor[4] = {1,1,1,1};
  static const int dx = 5; 
  static const int dy = 15;
  static const float font = 1.2f;
  static const float fontLarge = 1.4f;

  IRenderer* pRenderer = gEnv->pRenderer;
  IRenderAuxGeom* pAuxGeom = pRenderer->GetIRenderAuxGeom();
  pAuxGeom->SetRenderFlags(e_Def3DPublicRenderflags);

  pRenderer->Draw2dLabel(pRenderer->GetWidth()/5.f, pRenderer->GetHeight()-35, fontLarge, drawColor, false, "Firemode: %s (%.1f)", m_fireModes[m_fireMode].first.c_str(), m_fireModes[m_fireMode].second);      

  ray_hit rayhit;
  int hits = 0;
  
  unsigned int flags = rwi_stop_at_pierceable|rwi_colltype_any;
  if (m_fireModes[m_fireMode].first == "pierceability")
  { 
    flags = (unsigned int)m_fireModes[m_fireMode].second & rwi_pierceability_mask;
  }
  
  // use cam, no need for firing pos/dir
  CCamera& cam = GetISystem()->GetViewCamera();

  if (hits = gEnv->pPhysicalWorld->RayWorldIntersection(cam.GetPosition()+cam.GetViewdir(), cam.GetViewdir()*HIT_RANGE, ent_all, flags, &rayhit, 1))
  {
    IMaterialManager* pMatMan = gEnv->p3DEngine->GetMaterialManager();
    IActorSystem* pActorSystem = g_pGame->GetIGameFramework()->GetIActorSystem();
    IVehicleSystem* pVehicleSystem = g_pGame->GetIGameFramework()->GetIVehicleSystem();
    
    int x = (int)(pRenderer->GetWidth() *0.5f) + dx;
    int y = (int)(pRenderer->GetHeight()*0.5f) + dx - dy;

    // draw normal
    ColorB colNormal(200,0,0,128);
    Vec3 end = rayhit.pt + 0.75f*rayhit.n;
    pAuxGeom->DrawLine(rayhit.pt, colNormal, end, colNormal);
    pAuxGeom->DrawCone(end, rayhit.n, 0.1f, 0.2f, colNormal);

    IEntity * pEntity = (IEntity*)rayhit.pCollider->GetForeignData(PHYS_FOREIGN_ID_ENTITY);
    if(pEntity)
    {  
      pRenderer->Draw2dLabel(x, y+=dy, fontLarge, drawColor, false, pEntity->GetName());      
    }
    
    // material
    const char* matName = pMatMan->GetSurfaceType(rayhit.surface_idx)->GetName();

    if (matName[0])      
      pRenderer->Draw2dLabel(x, y+=dy, font, drawColor, false, "%s (%i)", matName, rayhit.surface_idx);

    pRenderer->Draw2dLabel(x, y+=dy, font, drawColor, false, "%.1f m", rayhit.dist);

    if (pEntity)
    {
      IScriptTable* pScriptTable = pEntity->GetScriptTable();

      // physics 
      if (IPhysicalEntity* pPhysEnt = pEntity->GetPhysics())
      {
        pe_status_dynamics status;
        if (pPhysEnt->GetStatus(&status))
        {        
          if (status.mass > 0.f)
            pRenderer->Draw2dLabel(x, y+=dy, font, drawColor, false, "%.1f kg", status.mass);

          pRenderer->Draw2dLabel(x, y+=dy, font, drawColor, false, "pe_type: %i", pPhysEnt->GetType());                

          if (status.submergedFraction > 0.f)
            pRenderer->Draw2dLabel(x, y+=dy, font, drawColor, false, "%.2f submerged", status.submergedFraction);

          if (status.v.len2() > 0.0001f)
            pRenderer->Draw2dLabel(x, y+=dy, font, drawColor, false, "%.2f m/s", status.v.len());
        }   
      }  

      if (pScriptTable)
      {
        HSCRIPTFUNCTION func = 0;
        if (pScriptTable->GetValue("GetFrozenAmount", func) && func)
        {
          float frozen = 0.f;
          Script::CallReturn(gEnv->pScriptSystem, func, pScriptTable, frozen);
					gEnv->pScriptSystem->ReleaseFunc(func);
          
          if (frozen > 0.f)
            pRenderer->Draw2dLabel(x, y+=dy, font, drawColor, false, "Frozen: %.2f", frozen); 
        }
      }
     
      // class-specific stuff
      if (IActor* pActor = pActorSystem->GetActor(pEntity->GetId()))
      {
        pRenderer->Draw2dLabel(x, y+=dy, font, drawColor, false, "%i health", pActor->GetHealth());
//.........这里部分代码省略.........
开发者ID:MrHankey,项目名称:destructionderby,代码行数:101,代码来源:DebugGun.cpp

示例10: stateIcon

void
InterfaceListItem::DrawItem(BView* owner, BRect /*bounds*/, bool complete)
{
	BListView* list = dynamic_cast<BListView*>(owner);

	if (!list)
		return;

	owner->PushState();

	BRect bounds = list->ItemFrame(list->IndexOf(this));

	rgb_color black = {0, 0, 0, 255};

	if (IsSelected() || complete) {
		if (IsSelected()) {
			list->SetHighColor(tint_color(list->ViewColor(),
				B_HIGHLIGHT_BACKGROUND_TINT));
		} else {
			list->SetHighColor(list->LowColor());
		}

		list->FillRect(bounds);
	}

	BString interfaceState;
	BBitmap* stateIcon(NULL);

	if (fSettings->IsDisabled()) {
		interfaceState << "disabled";
		stateIcon = fIconOffline;
	} else if (!fInterface.HasLink()) {
		interfaceState << "no link";
		stateIcon = fIconOffline;
	} else if ((fSettings->IPAddr(AF_INET).IsEmpty()
		&& fSettings->IPAddr(AF_INET6).IsEmpty())
		&& (fSettings->AutoConfigure(AF_INET)
		|| fSettings->AutoConfigure(AF_INET6))) {
		interfaceState << "connecting" B_UTF8_ELLIPSIS;
		stateIcon = fIconPending;
	} else {
		interfaceState << "connected";
		stateIcon = fIconOnline;
	}

	// Set the initial bounds of item contents
	BPoint iconPt = bounds.LeftTop();
	BPoint namePt = bounds.LeftTop();
	BPoint v4addrPt = bounds.LeftTop();
	BPoint v6addrPt = bounds.LeftTop();
	BPoint statePt = bounds.RightTop();

	iconPt += BPoint(4, 4);
	statePt += BPoint(0, fFirstlineOffset);
	namePt += BPoint(ICON_SIZE + 12, fFirstlineOffset);
	v4addrPt += BPoint(ICON_SIZE + 12, fSecondlineOffset);
	v6addrPt += BPoint(ICON_SIZE + 12, fThirdlineOffset);

	statePt
		-= BPoint(be_plain_font->StringWidth(interfaceState.String()), 0);

	if (fSettings->IsDisabled()) {
		list->SetDrawingMode(B_OP_ALPHA);
		list->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY);
		list->SetHighColor(0, 0, 0, 32);
	} else
		list->SetDrawingMode(B_OP_OVER);

	list->DrawBitmapAsync(fIcon, iconPt);
	list->DrawBitmapAsync(stateIcon, iconPt);

	if (fSettings->IsDisabled())
		list->SetHighColor(tint_color(black, B_LIGHTEN_1_TINT));
	else
		list->SetHighColor(black);

	list->SetFont(be_bold_font);
	list->DrawString(Name(), namePt);
	list->SetFont(be_plain_font);

	list->DrawString(interfaceState, statePt);

	if (!fSettings->IsDisabled()) {
		// Render IPv4 Address
		BString v4str("IPv4: ");

		if (fSettings->IPAddr(AF_INET).IsEmpty())
			v4str << "none";
		else {
			v4str << fSettings->IP(AF_INET);
		}

		if (fSettings->AutoConfigure(AF_INET))
			v4str << " (DHCP)";
		else
			v4str << " (static)";

		list->DrawString(v4str.String(), v4addrPt);

		// Render IPv6 Address (if present)
//.........这里部分代码省略.........
开发者ID:royalharsh,项目名称:haiku,代码行数:101,代码来源:InterfacesListView.cpp

示例11: SelectItem

void CMultiSelTreeCtrl::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// update shift and control flags
	m_CtrlDown= nFlags & MK_CONTROL ? TRUE : FALSE;
	m_ShiftDown= nFlags & MK_SHIFT  ? TRUE : FALSE;

    // find out what was hit
	TV_HITTESTINFO ht;
	ht.pt=point;
	m_LastLButtonDown=HitTest( &ht	);
	if(m_LastLButtonDown==NULL)
		return;
    
    BOOL success;
	m_PendingDeselect=FALSE;

	if(m_LastLButtonDown != TVI_ROOT && (ht.flags & TVHT_ONITEM ))
	{
		// Select nothing so there is no focus rect
		SelectItem(NULL);

		// Add the item to the selection set
		if(nFlags &	MK_CONTROL)
		{
			// Make sure its a valid selection
			if( !OKToAddSelection( m_LastLButtonDown ) )
				return;
			// If not in set, add it
			if(!IsSelected(m_LastLButtonDown))	
				success=SetSelectState(m_LastLButtonDown, TRUE);
			else
				// removing from set, or possibly re-clicking for drag
				success=m_PendingDeselect=TRUE;
		}
		else if(nFlags & MK_SHIFT)
		{
			success=RangeSelect(m_LastLButtonDown);
		}
		else
		{
			if(!IsSelected(m_LastLButtonDown))
			{
				UnselectAll();
				success=SetSelectState(m_LastLButtonDown, TRUE);
				ASSERT(GetSelectedCount());
			}
			else 
			{
				success= TRUE;
				m_PendingDeselect= TRUE;
			}
		}

		// wait at least 20 secs before autopolling for updates
		MainFrame()->WaitAWhileToPoll();

		if(!success)
			return;

		// Store the clicked item
		m_DragFromItem=m_LastLButtonDown;
		
		// Force the stinking item to repaint, because new select atts seem to
		// be lost in commctl32.dll occasionally
		SetAppearance(FALSE, TRUE, FALSE);
		GetItemRect(m_LastLButtonDown, &m_DragSourceRect, TRUE);
		RedrawWindow( m_DragSourceRect, NULL, RDW_UPDATENOW );

		// Then create a suitably small drag rect around the cursor 
		CPoint pt= point;
		ClientToScreen(&pt);
		m_DragSourceRect.SetRect(	max(0, pt.x - 2), max(0, pt.y - 2), 
									max(0, pt.x + 2), max(0, pt.y + 2) );

		// The drag drop attempt will clear m_PendingDeselect if a drag is attempted
		TryDragDrop( m_LastLButtonDown );
			
		if( m_PendingDeselect )
		{
			if( nFlags & MK_CONTROL )
				SetSelectState(m_LastLButtonDown, FALSE);
			else
			{
				UnselectAll();
				success=SetSelectState(m_LastLButtonDown, TRUE);
			}
		}
		
		// Make sure selection set is properly displayed
		SetAppearance(FALSE, TRUE, FALSE);
	}
	else
	{
		if(ht.flags & TVHT_ONITEM && (nFlags &	MK_CONTROL || nFlags & MK_SHIFT) )
			return;
		else 
		{
			if (ht.flags & TVHT_ONITEM && m_ViewIsActive )
			{
				// Select just the one item
//.........这里部分代码省略.........
开发者ID:danieljennings,项目名称:p4win,代码行数:101,代码来源:MSTreeCtrl.cpp

示例12: ASSERT

// User mouse-keyed a request to expand the current selection.  Note that
// the selection set can actually shrink if the already selected items are
// not contiguous - per Exploder convention
void CMultiSelTreeCtrl::ExpandSelection( int linesToExpand )
{
	ASSERT( m_SelectionSet.GetSize() > 0 );
	if( m_AnchorItem == NULL )
	{
		ASSERT(0);
		return;
	}

	MainFrame()->WaitAWhileToPoll();	// wait at least 20 secs before autopolling for updates

	HTREEITEM currentItem= m_AnchorItem;

	if( linesToExpand > 0 )
	{
		// Scrolling up
		for( int i=0; i < linesToExpand; i++ )
		{
			HTREEITEM lastGoodItem= currentItem;
			currentItem= GetPrevSiblingItem(currentItem);
			if( currentItem == NULL )
			{
				currentItem= lastGoodItem;
				break;
			}
			else
			{
				if( m_PendingKeyedDeselect )
					DoKeyedDeselect( FALSE );
				if( IsSelected( currentItem ) )
					SetSelectState( lastGoodItem, FALSE );  // Selection shrinking
				else if( OKToAddSelection( currentItem ) )
					SetSelectState( currentItem, TRUE );  // Selection growing
				else
					break;
			}
		}
	}
	else
	{
		// Scrolling down
		for( int i=0; i < (-linesToExpand); i++ )
		{
			HTREEITEM lastGoodItem= currentItem;
			currentItem= GetNextSiblingItem(currentItem);
			if( currentItem == NULL )
			{
				currentItem= lastGoodItem;
				break;
			}
			else
			{
				if( m_PendingKeyedDeselect )
					DoKeyedDeselect( TRUE );

				if( IsSelected( currentItem ) )
					SetSelectState( lastGoodItem, FALSE );  // Selection shrinking
				else if( OKToAddSelection( currentItem ) )
					SetSelectState( currentItem, TRUE );  // Selection growing
				else
					break;
			}

		}
	}

	m_AnchorItem= currentItem;
	EnsureVisible( m_AnchorItem );
}
开发者ID:danieljennings,项目名称:p4win,代码行数:72,代码来源:MSTreeCtrl.cpp

示例13: tint_color

/*****************************************************************************
 * PlaylistItem::DrawItem
 *****************************************************************************/
void
PlaylistItem::Draw( BView *owner, BRect frame, bool tintedLine,
                    uint32 mode, bool active, bool playing )
{
    rgb_color color = (rgb_color){ 255, 255, 255, 255 };
    if ( tintedLine )
        color = tint_color( color, 1.04 );
    // background
    if ( IsSelected() )
        color = tint_color( color, B_DARKEN_2_TINT );
    owner->SetLowColor( color );
    owner->FillRect( frame, B_SOLID_LOW );
    // label
    owner->SetHighColor( 0, 0, 0, 255 );
    font_height fh;
    owner->GetFontHeight( &fh );
    const char* text = Text();
    switch ( mode )
    {
        case DISPLAY_NAME:
            if ( fName.CountChars() > 0 )
                text = fName.String();
            break;
        case DISPLAY_PATH:
        default:
            break;
    }
    BString truncatedString( text );
    owner->TruncateString( &truncatedString, B_TRUNCATE_MIDDLE,
                           frame.Width() - TEXT_OFFSET - 4.0 );
    owner->DrawString( truncatedString.String(),
                       BPoint( frame.left + TEXT_OFFSET,
                               frame.top + fh.ascent + 1.0 ) );
    // playmark
    if ( active )
    {
        rgb_color black = (rgb_color){ 0, 0, 0, 255 };
        rgb_color green = (rgb_color){ 0, 255, 0, 255 };
        BRect r( 0.0, 0.0, 10.0, 10.0 );
        r.OffsetTo( frame.left + 4.0,
                    ceilf( ( frame.top + frame.bottom ) / 2.0 ) - 5.0 );
        if ( !playing )
            green = tint_color( color, B_DARKEN_1_TINT );
        rgb_color lightGreen = tint_color( green, B_LIGHTEN_2_TINT );
        rgb_color darkGreen = tint_color( green, B_DARKEN_2_TINT );
        BPoint arrow[3];
        arrow[0] = r.LeftTop();
        arrow[1] = r.LeftBottom();
        arrow[2].x = r.right;
        arrow[2].y = ( r.top + r.bottom ) / 2.0;
        owner->BeginLineArray( 6 );
            // black outline
            owner->AddLine( arrow[0], arrow[1], black );
            owner->AddLine( BPoint( arrow[1].x + 1.0, arrow[1].y - 1.0 ),
                            arrow[2], black );
            owner->AddLine( arrow[0], arrow[2], black );
            // inset arrow
            arrow[0].x += 1.0;
            arrow[0].y += 2.0;
            arrow[1].x += 1.0;
            arrow[1].y -= 2.0;
            arrow[2].x -= 2.0;
            // highlights and shadow
            owner->AddLine( arrow[1], arrow[2], darkGreen );
            owner->AddLine( arrow[0], arrow[2], lightGreen );
            owner->AddLine( arrow[0], arrow[1], lightGreen );
        owner->EndLineArray();
        // fill green
        arrow[0].x += 1.0;
        arrow[0].y += 1.0;
        arrow[1].x += 1.0;
        arrow[1].y -= 1.0;
        arrow[2].x -= 2.0;
        owner->SetHighColor( green );
        owner->FillPolygon( arrow, 3 );
    }
}
开发者ID:forthyen,项目名称:SDesk,代码行数:80,代码来源:ListViews.cpp

示例14: glPushMatrix

void    CSoundItem::GlDraw2D(CZ_ed2View* pV)
{
    int i;
	char ax = pV->_vt;
    SceItem::GlDraw2D(pV);

    glPushMatrix();
    Ta.Disable();
    glTranslatef(_t.x,_t.y,_t.z);
	int texIdx = GetHtex(GUtex);

    if(0==_specAngle)
	{
		switch(ax)
		{
			case 'x':
				glRotatef(-90,0,1,0);
				texIdx+=1;
				break;
			case 'y':
				glRotatef(-90,1,0,0);
				texIdx+=2;
				break;
			case 'z':
				texIdx+=3;
				break;
		}
	}
	
/*
    do{
		glColor4ubv(CLR_SELECT);
		glEnable(GL_COLOR_MATERIAL);
        Ta.BindTexture(texIdx);
        glBegin(GL_POLYGON);
        for(int i=0;i<4;++i)
        {
            glVertex3f(_Vtci[i]._xyz.x, _Vtci[i]._xyz.y, _Vtci[i]._xyz.z);
            glTexCoord2f(_Vtci[i]._uv[GUtex].u, _Vtci[i]._uv[GUtex].v);
        }

        glEnd();
    }while(0);
  */  

    

    if(_flags & BRSH_NEW)
        glColor4ubv(CLR_NEW_BRITEM);
    else
    {
        if(!IsSelected())
            glColor4ub(_colorD.r/3, _colorD.g/3, _colorD.b/3, 255);
        else
        {
            glColor4ub(_colorD.r, _colorD.g, _colorD.b, 255);
            glColor4ubv(CLR_SELECT);
        }
    }
    

    if(_specAngle == 0)
    {

        REAL step = 0;
        // draw a circle from 30 x 30 degreees on xoy xoz zoy
        V3  cirpctX[12];
        V3  cirpctY[12];
        V3  cirpctZ[12];

        for(i=0;i<12;i++)
        {
            cirpctX[i].z = _radius * sinf(step);
            cirpctX[i].y = _radius * cosf(step);

            cirpctY[i].x = _radius * sinf(step);
            cirpctY[i].z = _radius * cosf(step);

            cirpctZ[i].x = _radius * sinf(step);
            cirpctZ[i].y = _radius * cosf(step);

            step+=PIPE6;
        }

        glBegin(GL_LINE_LOOP);
        for(i=0;i<12;i++)
            glVertex3f(cirpctZ[i].x, cirpctZ[i].y, cirpctZ[i].z);
        glEnd();
    }
    else 
    {
        REAL deg = G2R(_specAngle);
        V3   endQuad[4];
        REAL dHV   = tanf(deg/2.0) * _radius;
        // piramide
        endQuad[0] = -VZ * _radius + VY * dHV - VX * dHV;
        endQuad[1] = -VZ * _radius + VY * dHV + VX * dHV;
        endQuad[2] = -VZ * _radius - VY * dHV + VX * dHV;
        endQuad[3] = -VZ * _radius - VY * dHV - VX * dHV;

//.........这里部分代码省略.........
开发者ID:comarius,项目名称:getic3d,代码行数:101,代码来源:SoundItem.cpp

示例15: switch

bool CListBox::HandleMessage(CMessage* pMessage)
{
	bool bHandled = false;

	if (pMessage)
	{
		switch(pMessage->MessageType())
		{
		case CMessage::KEYBOARD_KEYDOWN:
		{
			CKeyboardMessage* pKeyMsg = dynamic_cast<CKeyboardMessage*>(pMessage);
			if (pKeyMsg && pMessage->Destination() == this)
			{
				switch (pKeyMsg->Key)
				{
					case SDLK_DOWN:
					{
						if (m_iFocusedItem + 1 < Size())
						{
							m_iFocusedItem++;
							int diff = m_iFocusedItem - m_pVScrollbar->GetValue();
							if (m_iItemHeight * (m_pVScrollbar->GetValue() + diff + 1) > m_ClientRect.Height())
							{
								m_pVScrollbar->SetValue(m_pVScrollbar->GetValue() + 1);
							}

							Draw();
							bHandled = true;
						}
						break;
					}
					case SDLK_UP:
					{
						if ( m_iFocusedItem > 0 )
						{
							m_iFocusedItem--;
							if (m_iFocusedItem < m_pVScrollbar->GetValue())
							{
								m_pVScrollbar->SetValue(m_pVScrollbar->GetValue() - 1);
							}
							Draw();
							bHandled = true;
						}
						break;
					}
					case SDLK_PAGEDOWN:
					{
						unsigned int nSize = Size() - 1;
						unsigned int nItemsPerPage = m_ClientRect.Height() / m_iItemHeight;
						if (m_iFocusedItem + nItemsPerPage < nSize)
						{
							m_iFocusedItem += nItemsPerPage;
						}
						else
						{
							m_iFocusedItem = nSize;
						}
						m_pVScrollbar->SetValue(m_iFocusedItem);
						Draw();
						bHandled=true;
						break;
					}
					case SDLK_PAGEUP:
					{
						int nItemsPerPage = m_ClientRect.Height() / m_iItemHeight;
						if (m_iFocusedItem - nItemsPerPage > 0)
						{
							m_iFocusedItem -= nItemsPerPage;
						}
						else
						{
							m_iFocusedItem = 0;
						}
						m_pVScrollbar->SetValue(m_iFocusedItem);
						Draw();
						bHandled=true;
						break;
					}
					case SDLK_SPACE:
					{
						if (! m_Items.empty())
						{
							SetSelection(m_iFocusedItem, !IsSelected(m_iFocusedItem));
							Draw();
						}
						bHandled = true;
						break;
					}
					default:
					{
						bHandled=false;
						break;
					}
				}
			}
			break;
		}
		case CMessage::CTRL_VALUECHANGE:
		case CMessage::CTRL_VALUECHANGING:
		{
//.........这里部分代码省略.........
开发者ID:Mokona,项目名称:caprice32,代码行数:101,代码来源:wg_listbox.cpp


注:本文中的IsSelected函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。