您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ HasFocus函数代码示例

51自学网 2021-06-01 21:25:34
  C++
这篇教程C++ HasFocus函数代码示例写得很实用,希望能帮到您。

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

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

示例1: Tag

void View::PersistData(PersistStatus status, std::string anonId, PersistMap &storage) {	// Remember if this view was a focused view.	std::string tag = Tag();	if (tag.empty()) {		tag = anonId;	}	const std::string focusedKey = "ViewFocused::" + tag;	switch (status) {	case UI::PERSIST_SAVE:		if (HasFocus()) {			storage[focusedKey].resize(1);		}		break;	case UI::PERSIST_RESTORE:		if (storage.find(focusedKey) != storage.end()) {			SetFocus();		}		break;	}}
开发者ID:kg,项目名称:ppsspp,代码行数:21,


示例2: OnMouseButtonPressed

void DragManipulator::OnMouseButtonPressed(const Mouse::Button& pButton){    if(pButton != Mouse::Button_Left || !HasFocus())        return;    Renderer* renderer = GraphicSubsystem::Instance()->GetRenderer();    GD_ASSERT(renderer);    // Get the position of the mouse in the screen and widget.    Int32 x, y;    InputSubsystem::GetMouse().GetPos(x, y);    mScreenClickPos = Vector2f(x, y);    QPoint widgetPos = mEditor->GetMainView()->mapFromGlobal(QPoint(x, y));    mClickPos = Vector2f(widgetPos.x(), widgetPos.y());    // Calculate the center position of the manipulated objects.    mWorldPosition = GetCenterPosition();    UpdateOriginPositions();}
开发者ID:SebastienLussier,项目名称:Gamedesk,代码行数:21,


示例3: PaintMainMenuBorder

inline voidTabMenuDisplay::PaintMainMenuItems(Canvas &canvas) const{  PaintMainMenuBorder(canvas);  const bool is_focused = !HasCursorKeys() || HasFocus();  unsigned main_menu_index = 0;  for (auto i = main_menu_buttons.begin(),         end = main_menu_buttons.end(); i != end;       ++i, ++main_menu_index) {    const bool isDown = main_menu_index == down_index.main_index &&      !down_index.IsSub() && !drag_off_button;    const bool is_selected = isDown ||      main_menu_index == GetPageMainIndex(cursor);    main_menu_buttons[main_menu_index].Draw(canvas, look,                                            is_focused, isDown, is_selected);  }}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:21,


示例4: Pos

    void ActiveWidget::AcceptInputReset( const InputReset &request)    {        Widget *sender = request.Sender();        _cursor = Pos(-1,-1);        int i;        for (i=0; i!=NUM_BUTTONS; ++i)        {            if ( _was_touched[i] )             {                 if (_was_over) OnMoveOut[i].Schedule_1( _cursor );                OnRelease[i].Schedule_1( _cursor );             }            _was_touched[i] = false;            _is_dragging[i] = false;            _mb_down[i] = false;        }        for (i=0; i!=_pressed_keys.Size(); ++i)        {            bool likes_this_key = false;            likes_this_key |= _on_path_key_mask.GetBit( _pressed_keys[i] );            likes_this_key |= HasFocus() && _key_mask.GetBit( _pressed_keys[i] );            if ( likes_this_key )            {                OnKeyRelease.Schedule_1( _pressed_keys[i]);            }        }        _pressed_keys.Clear();        if (_was_over || _unsent_outside)        {            OnMoveOutside.Schedule_1( _cursor ); HideHint();        }        _was_over = false;        _unsent_outside = false;        _result = false;        Widget::Accept( InputReset(this) );    }
开发者ID:BackupTheBerlios,项目名称:utgs-svn,代码行数:40,


示例5: Draw

void Choice::Draw(UIContext &dc) {	if (!IsSticky()) {		ClickableItem::Draw(dc);	} else {		Style style =	dc.theme->itemStyle;		if (highlighted_) {			style = dc.theme->itemHighlightedStyle;		}		if (down_) {			style = dc.theme->itemDownStyle;		}		if (HasFocus()) {			style = dc.theme->itemFocusedStyle;		}		dc.FillRect(style.background, bounds_);	}	Style style = dc.theme->itemStyle;	if (!IsEnabled())		style = dc.theme->itemDisabledStyle;	if (atlasImage_ != -1) {		dc.Draw()->DrawImage(atlasImage_, bounds_.centerX(), bounds_.centerY(), 1.0f, style.fgColor, ALIGN_CENTER);	} else {		int paddingX = 12;		dc.SetFontStyle(dc.theme->uiFont);		if (centered_) {			dc.DrawText(text_.c_str(), bounds_.centerX(), bounds_.centerY(), style.fgColor, ALIGN_CENTER);		} else {			if (iconImage_ != -1) {				dc.Draw()->DrawImage(iconImage_, bounds_.x2() - 32 - paddingX, bounds_.centerY(), 0.5f, style.fgColor, ALIGN_CENTER);			}			dc.DrawText(text_.c_str(), bounds_.x + paddingX, bounds_.centerY(), style.fgColor, ALIGN_VCENTER);		}	}	if (selected_) {		dc.Draw()->DrawImage(dc.theme->checkOn, bounds_.x2() - 40, bounds_.centerY(), 1.0f, style.fgColor, ALIGN_CENTER);	}}
开发者ID:metalex10,项目名称:PPSSPP-X360,代码行数:40,


示例6: GetMainMenuButton

inline voidTabMenuDisplay::PaintSubMenuItems(Canvas &canvas,                                  const unsigned CaptionStyle) const{  const MainMenuButton &main_button =    GetMainMenuButton(GetPageMainIndex(cursor));  PaintSubMenuBorder(canvas, main_button);  assert(main_button.first_page_index < buttons.size());  assert(main_button.last_page_index < buttons.size());  const bool is_focused = !HasCursorKeys() || HasFocus();  for (unsigned first_page_index = main_button.first_page_index,         last_page_index = main_button.last_page_index,         page_index = first_page_index;       page_index <= last_page_index; ++page_index) {    const unsigned sub_index = page_index - first_page_index;    const bool is_pressed = sub_index == down_index.sub_index &&      !drag_off_button;    const bool is_cursor = page_index == cursor;    const bool is_selected = is_pressed || is_cursor;    canvas.SetTextColor(look.list.GetTextColor(is_selected, is_focused,                                               is_pressed));    canvas.SetBackgroundColor(look.list.GetBackgroundColor(is_selected,                                                           is_focused,                                                           is_pressed));    const PixelRect &rc = GetSubMenuButtonSize(page_index);    TabDisplay::PaintButton(canvas, CaptionStyle,                            gettext(pages[page_index].menu_caption),                            rc,                            nullptr, is_cursor,                            false);  }}
开发者ID:ppara,项目名称:XCSoar,代码行数:40,


示例7: dc

void AudioDisplay::OnPaint(wxPaintEvent&){	if (!audio_renderer_provider) return;	wxAutoBufferedPaintDC dc(this);	wxRect audio_bounds(0, audio_top, GetClientSize().GetWidth(), audio_height);	bool redraw_scrollbar = false;	bool redraw_timeline = false;	for (wxRegionIterator region(GetUpdateRegion()); region; ++region)	{		wxRect updrect = region.GetRect();		redraw_scrollbar |= scrollbar->GetBounds().Intersects(updrect);		redraw_timeline |= timeline->GetBounds().Intersects(updrect);		if (audio_bounds.Intersects(updrect))		{			TimeRange updtime(				std::max(0, TimeFromRelativeX(updrect.x - foot_size)),				std::max(0, TimeFromRelativeX(updrect.x + updrect.width + foot_size)));			PaintAudio(dc, updtime, updrect);			PaintMarkers(dc, updtime);			PaintLabels(dc, updtime);		}	}	if (track_cursor_pos >= 0)	{		PaintTrackCursor(dc);	}	if (redraw_scrollbar)		scrollbar->Paint(dc, HasFocus());	if (redraw_timeline)		timeline->Paint(dc);}
开发者ID:Gpower2,项目名称:Aegisub,代码行数:39,


示例8: OnAction

bool CGUIControl::OnAction(const CAction &action){  if (HasFocus())  {    switch (action.GetID())    {    case ACTION_MOVE_DOWN:      OnDown();      return true;    case ACTION_MOVE_UP:      OnUp();      return true;    case ACTION_MOVE_LEFT:      OnLeft();      return true;    case ACTION_MOVE_RIGHT:      OnRight();      return true;    case ACTION_SHOW_INFO:      return OnInfo();    case ACTION_NAV_BACK:      return OnBack();    case ACTION_NEXT_CONTROL:      OnNextControl();      return true;    case ACTION_PREV_CONTROL:      OnPrevControl();      return true;    }  }  return false;}
开发者ID:0xheart0,项目名称:xbmc,代码行数:39,


示例9: Painter

void CNavigationBar::Draw(void) const {	CWindow::Draw();	if (m_pSDLSurface)	{		CPainter Painter(m_pSDLSurface, CPainter::PAINT_REPLACE);        		Painter.Draw3DLoweredRect(m_WindowRect.SizeRect(), DEFAULT_BACKGROUND_COLOR);        SDL_Rect PictureSourceRect = CRect(CPoint(0, 0), 30, 30).SDLRect();		for (unsigned int i = 0; i < m_Items.size(); ++i)		{			CRect ItemRect(CPoint(m_ClientRect.Left() + i*m_iItemWidth, m_ClientRect.Top()),				m_iItemWidth , m_iItemHeight);			if (ItemRect.Overlaps(m_ClientRect))			{				ItemRect.ClipTo(m_ClientRect);				ItemRect.SetBottom(ItemRect.Bottom() - 1);				ItemRect.SetRight(ItemRect.Right() - 1);				if (i == m_iSelectedItem)				{					Painter.DrawRect(ItemRect, true, CApplication::Instance()->GetDefaultSelectionColor(), CApplication::Instance()->GetDefaultSelectionColor());				}				if (i == m_iFocusedItem && HasFocus())				{					ItemRect.Grow(1);					Painter.DrawRect(ItemRect, false, CApplication::Instance()->GetDefaultSelectionColor() * 0.7);					ItemRect.Grow(-1);				}				ItemRect.Grow(-1);        // '- CPoint(0,1)' is to move the reference point one pixel up (otherwise the lowest pixels of p,g,q,y         // etc. are not fully visible.				m_RenderedStrings.at(i).Draw(m_pSDLSurface, ItemRect, ItemRect.BottomLeft() - CPoint(0, 1) + CPoint(ItemRect.Width()/2, 0), m_Items[i].ItemColor);        // Draw the picture (if available):        if (m_Bitmaps.at(i) != nullptr) {          SDL_Rect DestRect = ItemRect.Move(9, 1).SDLRect();          SDL_BlitSurface(m_Bitmaps.at(i)->Bitmap(), &PictureSourceRect, m_pSDLSurface, &DestRect);        }			}		}	}}
开发者ID:ColinPitrat,项目名称:caprice32,代码行数:39,


示例10: GetClientRect

voidWndCustomButton::OnPaint(Canvas &canvas){#ifdef HAVE_CLIPPING  /* background and selector */  canvas.Clear(look.background_brush);#endif  PixelRect rc = GetClientRect();  // Draw focus rectangle  if (HasFocus()) {    canvas.DrawFilledRectangle(rc, look.focused.background_color);    canvas.SetTextColor(IsEnabled()                        ? look.focused.text_color : look.button.disabled.color);  } else {    canvas.DrawFilledRectangle(rc, look.background_color);    canvas.SetTextColor(IsEnabled() ? look.text_color : look.button.disabled.color);  }  // If button has text on it  tstring caption = get_text();  if (caption.empty())    return;  // If button is pressed, offset the text for 3D effect  if (is_down())    OffsetRect(&rc, 1, 1);  canvas.SelectNullPen();  canvas.SetBackgroundTransparent();#ifndef USE_GDI  canvas.formatted_text(&rc, caption.c_str(), GetTextStyle());#else  unsigned s = DT_CENTER | DT_NOCLIP | DT_WORDBREAK;  canvas.Select(*(look.button.font));  canvas.formatted_text(&rc, caption.c_str(), s);#endif}
开发者ID:damianob,项目名称:xcsoar,代码行数:39,


示例11: Key

void Clickable::Key(const KeyInput &key) {	if (!HasFocus() && key.deviceId != DEVICE_ID_MOUSE) {		down_ = false;		return;	}	// TODO: Replace most of Update with this.	if (key.flags & KEY_DOWN) {		if (IsAcceptKeyCode(key.keyCode)) {			down_ = true;		}	}	if (key.flags & KEY_UP) {		if (IsAcceptKeyCode(key.keyCode)) {			if (down_) {				Click();				down_ = false;			}		} else if (IsEscapeKeyCode(key.keyCode)) {			down_ = false;		}	}}
开发者ID:m45t3r,项目名称:native,代码行数:22,


示例12: wxCHECK_RET

void wxBitmapButton::OnSetBitmap(){    wxCHECK_RET( m_widget != NULL, wxT("invalid bitmap button") );    InvalidateBestSize();    wxBitmap the_one;    if (!IsThisEnabled())        the_one = GetBitmapDisabled();   else if (m_isSelected)     the_one = GetBitmapPressed();   else if (HasFocus())     the_one = GetBitmapFocus();   if (!the_one.IsOk())     {         the_one = GetBitmapLabel();         if (!the_one.IsOk())             return;     }    GdkBitmap *mask = NULL;    if (the_one.GetMask()) mask = the_one.GetMask()->GetBitmap();    GtkWidget *child = BUTTON_CHILD(m_widget);    if (child == NULL)    {        // initial bitmap        GtkWidget *pixmap;        pixmap = gtk_pixmap_new(the_one.GetPixmap(), mask);        gtk_widget_show(pixmap);        gtk_container_add(GTK_CONTAINER(m_widget), pixmap);    }    else    {   // subsequent bitmaps        GtkPixmap *pixmap = GTK_PIXMAP(child);        gtk_pixmap_set(pixmap, the_one.GetPixmap(), mask);    }}
开发者ID:chromylei,项目名称:third_party,代码行数:39,


示例13: Process

void CGUIMoverControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions){  if (m_bInvalidated)  {    m_imgFocus.SetWidth(m_width);    m_imgFocus.SetHeight(m_height);    m_imgNoFocus.SetWidth(m_width);    m_imgNoFocus.SetHeight(m_height);  }  if (HasFocus())  {    unsigned int alphaCounter = m_frameCounter + 2;    unsigned int alphaChannel;    if ((alphaCounter % 128) >= 64)      alphaChannel = alphaCounter % 64;    else      alphaChannel = 63 - (alphaCounter % 64);    alphaChannel += 192;    if (SetAlpha( (unsigned char)alphaChannel ))      MarkDirtyRegion();    m_imgFocus.SetVisible(true);    m_imgNoFocus.SetVisible(false);    m_frameCounter++;  }  else  {    if (SetAlpha(0xff))      MarkDirtyRegion();    m_imgFocus.SetVisible(false);    m_imgNoFocus.SetVisible(true);  }  m_imgFocus.Process(currentTime);  m_imgNoFocus.Process(currentTime);  CGUIControl::Process(currentTime, dirtyregions);}
开发者ID:7orlum,项目名称:xbmc,代码行数:38,


示例14: GetSize

void ColorPusher::Paint(Draw& w){	Size sz = GetSize();	w.DrawRect(sz, push ? SColorHighlight : SColorPaper);	int ty = (sz.cy - StdFont().Info().GetHeight()) / 2;	if(withtext) {		w.DrawRect(2, 2, sz.cy - 4, sz.cy - 4, color);		DrawFrame(w, 1, 1, sz.cy - 2, sz.cy - 2, SColorText);		w.DrawText(sz.cy + 2, ty, FormatColor(color), StdFont(), SColorText());	}	else {		if(!IsNull(color)) {			w.DrawRect(2, 2, sz.cx - 4, sz.cy - 4, color);			DrawFrame(w, 1, 1, sz.cx - 2, sz.cy - 2, SColorText);		}		else		if(!withtext)			w.DrawText(max(2, (sz.cx - GetTextSize(nulltext, StdFont()).cx) / 2), ty,			           nulltext, StdFont(), SColorText());	}	if(HasFocus())		DrawFocus(w, GetSize());}
开发者ID:pedia,项目名称:raidget,代码行数:23,


示例15: PerformLayout

	virtual void PerformLayout()	{		TextImage *textImage = GetTextImage();		if (m_bSelected)		{			VPANEL focus = input()->GetFocus();			// if one of the children of the SectionedListPanel has focus, then 'we have focus' if we're selected			if (HasFocus() || (focus && ipanel()->HasParent(focus, GetVParent())))			{				textImage->SetColor(m_ArmedFgColor2);			}			else			{				textImage->SetColor(m_FgColor2);			}		}		else		{			textImage->SetColor(GetFgColor());							}		BaseClass::PerformLayout();		Repaint();	}
开发者ID:chrizonix,项目名称:RCBot2,代码行数:23,


示例16: KillTimeCallback

void ScatterCtrl::Paint(Draw& w){    GuiLock __;    if (IsNull(highlight_0) && highlighting) {        highlighting = false;        KillTimeCallback();    }    if (!IsNull(highlight_0) && !highlighting) {        highlighting = true;        SetTimeCallback(-200, THISBACK(TimerCallback));    }    TimeStop t;    lastRefresh0_ms = GetTickCount();    if (IsEnabled()) {        if (mode == MD_DRAW) {            ScatterCtrl::SetDrawing(w, GetSize(), 1);            PlotTexts(w, GetSize(), 1);        } else {            ImageBuffer ib(GetSize());            BufferPainter bp(ib, mode);            ScatterCtrl::SetDrawing(bp, GetSize(), 1);            w.DrawImage(0, 0, ib);            PlotTexts(w, GetSize(), 1);        }        if (HasFocus()) {            w.DrawLine(0, 0, GetSize().cx, 0, 2, LtGray());            w.DrawLine(0, 0, 0, GetSize().cy, 2, LtGray());            int delta = -2;#ifdef PLATFORM_WIN32            delta = 0;#endif            w.DrawLine(GetSize().cx+delta, 0, GetSize().cx+delta, GetSize().cy, 2, LtGray());            w.DrawLine(0, GetSize().cy+delta, GetSize().cx, GetSize().cy+delta, 2, LtGray());        }    }    lastRefresh_ms = t.Elapsed();}
开发者ID:andreincx,项目名称:upp-mirror,代码行数:37,


示例17: PaintBackground

	virtual void PaintBackground()		{		int wide, tall;		GetSize(wide, tall);		if ( m_bSelected )		{            VPANEL focus = input()->GetFocus();            // if one of the children of the SectionedListPanel has focus, then 'we have focus' if we're selected            if (HasFocus() || (focus && ipanel()->HasParent(focus, GetVParent())))            {			    surface()->DrawSetColor(m_ArmedBgColor);            }            else            {			    surface()->DrawSetColor(m_SelectionBG2Color);            }		}		else		{			surface()->DrawSetColor(GetBgColor());		}		surface()->DrawFilledRect(0, 0, wide, tall);	}
开发者ID:chrizonix,项目名称:RCBot2,代码行数:24,


示例18: OnDrawItem

void BrowseTileListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const{	ItemsMap::const_iterator item_iterator = items.find(int(n));	Item* item = item_iterator->second;	Sprite* sprite = g_gui.gfx.getSprite(item->getClientID());	if(sprite)		sprite->DrawTo(&dc, SPRITE_SIZE_32x32, rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight());	if(IsSelected(n)) {		item->select();		if(HasFocus())			dc.SetTextForeground(wxColor(0xFF, 0xFF, 0xFF));		else			dc.SetTextForeground(wxColor(0x00, 0x00, 0xFF));	} else {		item->deselect();		dc.SetTextForeground(wxColor(0x00, 0x00, 0x00));	}	wxString label;	label << item->getID() << " - " << item->getName();	dc.DrawText(label, rect.GetX() + 40, rect.GetY() + 6);}
开发者ID:TheSumm,项目名称:rme,代码行数:24,


示例19: Render

void CGUIResizeControl::Render(){  if (m_bInvalidated)  {    m_imgFocus.SetWidth(m_width);    m_imgFocus.SetHeight(m_height);    m_imgNoFocus.SetWidth(m_width);    m_imgNoFocus.SetHeight(m_height);  }  if (HasFocus())  {    DWORD dwAlphaCounter = m_dwFrameCounter + 2;    DWORD dwAlphaChannel;    if ((dwAlphaCounter % 128) >= 64)      dwAlphaChannel = dwAlphaCounter % 64;    else      dwAlphaChannel = 63 - (dwAlphaCounter % 64);    dwAlphaChannel += 192;    SetAlpha( (unsigned char)dwAlphaChannel );    m_imgFocus.SetVisible(true);    m_imgNoFocus.SetVisible(false);    m_dwFrameCounter++;  }  else  {    SetAlpha(0xff);    m_imgFocus.SetVisible(false);    m_imgNoFocus.SetVisible(true);  }  // render both so the visibility settings cause the frame counter to resetcorrectly  m_imgFocus.Render();  m_imgNoFocus.Render();  CGUIControl::Render();}
开发者ID:Castlecard,项目名称:plex,代码行数:36,


示例20: MouseMotion

// This method is called every time the player moves the mousevoid CGame::MouseMotion(int x, int y){	if (!HasFocus())	{		// Swallow the input while the window isn't in focus so the player		// isn't facing off in a strange direction when they tab back in.		m_iLastMouseX = x;		m_iLastMouseY = y;		return;	}	if (m_iLastMouseX == -1 && m_iLastMouseY == -1)	{		m_iLastMouseX = x;		m_iLastMouseY = y;	}	int iMouseMovedX = x - m_iLastMouseX;	int iMouseMovedY = m_iLastMouseY - y; // The data comes in backwards. negative y means the mouse moved up.	if (!m_hPlayer)		return;	float flSensitivity = 0.3f;	EAngle angView = m_hPlayer->GetLocalView();	angView.p += iMouseMovedY*flSensitivity;	angView.y += iMouseMovedX*flSensitivity;	angView.Normalize();	m_hPlayer->SetLocalView(angView);	m_iLastMouseX = x;	m_iLastMouseY = y;}
开发者ID:Lynear24,项目名称:MathForGameDevelopers,代码行数:37,


示例21: draw

void XGPopControl::DoDrawView(XRect){#if OPT_MACOS	if (fControl) {		XGDraw draw(this,false);		if (fFont) {			fFont->Attach();			draw.SetFont(fFont);		}				if (IsEnabled() && IsActive()) {			/*			 *	Enabled			 */						::HiliteControl(fControl, 0);		} else {			::HiliteControl(fControl, 255);		}		::ShowControl(fControl);		::Draw1Control(fControl);		return;	}#endif#if OPT_WINOS	if (fControl) {		/*		 *	The invalidate here may seem a little wierd, but this		 *	causes the control to redraw itself separately, and after		 *	this draw view command is issued. The upshot of this is		 *	that the control is forced to be redrawn.		 */				::ShowWindow(fControl, SW_SHOW);		::InvalidateRect(fControl, NULL, false);	}	return;#endif#if OPT_XWIN || OPT_MACOS	/*	 *	(MacOS): if we get here, use simulated popup. Happens when we don't	 *	have the appearance manager.	 */		XRect r;	XRect s;	XRect t;	XGDraw draw(this);	fFont->Attach();	draw.SetFont(fFont);		r = GetContentRect();	s = r;	InsetRect(&s,1,1);	t = s;	s.left = s.right - (s.bottom - s.top);	t.right = s.left;		draw.Draw3DRect(r,KXGEBackground);	if (IsEnabled() && IsActive()) {		if (fPop) {			draw.Draw3DRect(r,KXGEFrame);			draw.Draw3DRect(s,KXGEInset);			draw.Draw3DRect(t,KXGEInset);		} else {			draw.Draw3DRect(r,KXGEFrame);			draw.Draw3DRect(s,KXGEOutset);			draw.Draw3DRect(t,KXGEOutset);		}	} else {		draw.Draw3DRect(r,KXGEGrayFrame);		draw.SetForeColor(KXGColorBtnShadow);	}	InsetRect(&s,5,5);		draw.MoveTo(s.left,(s.top*3+s.bottom)/4);	draw.LineTo(s.right,(s.top*3+s.bottom)/4);	draw.LineTo((s.left+s.right)/2,(s.top+3*s.bottom)/4);	draw.LineTo(s.left,(s.top*3+s.bottom)/4);		s = r;	s.right -= s.bottom - s.top;	InsetRect(&s,1,1);	draw.ClipRect(&s);	#if OPT_WINOS || OPT_XWIN	if (HasFocus() && IsEnabled() && IsActive()) {		InsetRect(&s,1,1);		draw.DrawFocusRect(s);		InsetRect(&s,-1,-1);	}#endif	draw.MoveTo(s.left + 3,				(s.top + s.bottom - draw.GetFontHeight())/2+draw.GetFontAscent());	if (fValue < Length()) {		char buffer[256];//.........这里部分代码省略.........
开发者ID:ElusiveMind,项目名称:ballistic,代码行数:101,


示例22: HasFocus

bool Widget::HasFocus() {	return HasFocus( shared_from_this() );}
开发者ID:Zykr,项目名称:SFGUI,代码行数:3,


示例23: shared_from_this

//.........这里部分代码省略.........					}					GetSignals().Emit( OnMouseMove );				}				else if( emit_leave ) {					GetSignals().Emit( OnMouseLeave );				}				break;			case sf::Event::MouseButtonPressed:				if( !IsMouseButtonDown() && IsMouseInWidget() ) {					SetMouseButtonDown( event.mouseButton.button );				}				HandleMouseButtonEvent( event.mouseButton.button, true, event.mouseButton.x, event.mouseButton.y );				if( IsMouseInWidget() ) {					if( event.mouseButton.button == sf::Mouse::Left ) {						GetSignals().Emit( OnMouseLeftPress );					}					else if( event.mouseButton.button == sf::Mouse::Right ) {						GetSignals().Emit( OnMouseRightPress );					}				}				break;			case sf::Event::MouseButtonReleased:				// Only process as a click when mouse button has been pressed inside the widget before.				if( IsMouseButtonDown( event.mouseButton.button ) ) {					SetMouseButtonDown();					// When released inside the widget, the event can be considered a click.					if( IsMouseInWidget() ) {						HandleMouseClick( event.mouseButton.button, event.mouseButton.x, event.mouseButton.y );						if( event.mouseButton.button == sf::Mouse::Left ) {							emit_left_click = true;						}						else if( event.mouseButton.button == sf::Mouse::Right ) {							emit_right_click = true;						}					}				}				HandleMouseButtonEvent( event.mouseButton.button, false, event.mouseButton.x, event.mouseButton.y );				if( emit_left_click ) {					GetSignals().Emit( OnLeftClick );				}				else if( emit_right_click ) {					GetSignals().Emit( OnRightClick );				}				if( IsMouseInWidget() ) {					if( event.mouseButton.button == sf::Mouse::Left ) {						GetSignals().Emit( OnMouseLeftRelease );					}					else if( event.mouseButton.button == sf::Mouse::Right ) {						GetSignals().Emit( OnMouseRightRelease );					}				}				break;			case sf::Event::KeyPressed:				if( HasFocus() ) {					// TODO: Delegate event too when widget's not active?					HandleKeyEvent( event.key.code, true );					GetSignals().Emit( OnKeyPress );				}				break;			case sf::Event::KeyReleased:				if( HasFocus() ) {					// TODO: Delegate event too when widget's not active?					HandleKeyEvent( event.key.code, false );					GetSignals().Emit( OnKeyRelease );				}				break;			case sf::Event::TextEntered:				if( HasFocus() ) {					// TODO: Delegate event too when widget's not active?					HandleTextEvent( event.text.unicode );					GetSignals().Emit( OnText );				}				break;			default:				break;		}	}	catch( ... ) {		SetState( State::NORMAL );		throw;	}}
开发者ID:Cruel,项目名称:SFGUI,代码行数:101,


示例24: UpdateHostLabel

// update guivoid NetPlayDialog::OnThread(wxThreadEvent& event){    if (m_is_hosting && m_host_label && g_TraversalClient)    {        UpdateHostLabel();    }    // player list    m_playerids.clear();    std::string tmps;    netplay_client->GetPlayerList(tmps, m_playerids);    wxString selection;    if (m_player_lbox->GetSelection() != wxNOT_FOUND)        selection = m_player_lbox->GetString(m_player_lbox->GetSelection());    m_player_lbox->Clear();    std::istringstream ss(tmps);    while (std::getline(ss, tmps))        m_player_lbox->Append(StrToWxStr(tmps));    // remove ping from selection string, in case it has changed    selection.erase(selection.rfind('|') + 1);    if (!selection.empty())    {        for (unsigned int i = 0; i < m_player_lbox->GetCount(); ++i)        {            if (selection == m_player_lbox->GetString(i).substr(0, selection.length()))            {                m_player_lbox->SetSelection(i);                break;            }        }    }    // flash window in taskbar when someone joins if window isn't active    static u8 numPlayers = 1;    if (netplay_server != nullptr && numPlayers < m_playerids.size() && !HasFocus())    {        RequestUserAttention();    }    numPlayers = m_playerids.size();    switch (event.GetId())    {    case NP_GUI_EVT_CHANGE_GAME:        // update selected game :/    {        m_selected_game = WxStrToStr(event.GetString());        wxString button_label = event.GetString();        m_game_btn->SetLabel(button_label.Prepend(_(" Game : ")));    }    break;    case NP_GUI_EVT_START_GAME:        // client start game :/    {        netplay_client->StartGame(FindGame());    }    break;    case NP_GUI_EVT_STOP_GAME:        // client stop game    {        netplay_client->StopGame();    }    break;    }    // chat messages    while (chat_msgs.Size())    {        std::string s;        chat_msgs.Pop(s);        // PanicAlert("message: %s", s.c_str());        m_chat_text->AppendText(StrToWxStr(s).Append('/n'));    }}
开发者ID:CarlKenner,项目名称:dolphin,代码行数:79,


示例25: GetSize

void MultiButton::Paint(Draw& w){	Size sz = GetSize();	int border, lx, rx;	bool frm = Metrics(border, lx, rx);	int mst = ChState(MAIN);	if(frm && !nobg)		ChPaint(w, sz, style->edge[style->activeedge ? mst : 0]);	bool left = false;	bool right = false;	for(int i = 0; i < button.GetCount(); i++) {		SubButton& b = button[i];		int st = ChState(i);		int x = 0, cx = 0;		GetPos(b, lx, rx, x, cx);		bool dopaint = true;		Value v = b.left ? left ? style->lmiddle[st] : style->left[st]		                 : right ? style->rmiddle[st] : style->right[st];		if(!nobg) {			if(ComplexFrame())				ChPaint(w, x, border, cx, sz.cy - 2 * border, style->simple[st]);			else			if(frm) {				if(IsTrivial() && style->usetrivial)					dopaint = false;				ChPaint(w, x, border, cx, sz.cy - 2 * border,				        dopaint ? v : style->trivial[st]);			}			else {				w.Clip(x, 0, cx, sz.cy);				ChPaint(w, sz, style->look[Frame() ? mst : st]);				if(IsNull(v) || !Frame()) {					if((!IsTrivial() || style->trivialsep) && IsEnabled()) {						if(b.left) {							if(left)								ChPaint(w, x, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep1);							ChPaint(w, x + cx - 1, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep2);						}						else {							ChPaint(w, x, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep1);							if(right)								ChPaint(w, x + cx - 1, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep2);						}					}				}				else					ChPaint(w, x, 0, cx, sz.cy, v);				w.End();			}		}		if(dopaint) {			Size tsz = GetTextSize(b.label, StdFont());			Image m = tsz.cx > 0 ? b.img : (Image)Nvl(b.img, CtrlsImg::DA());			Size isz = m.GetSize();			Point p = (st == CTRL_PRESSED) * style->pressoffset;			p.x += x + (cx - isz.cx - tsz.cx - (tsz.cx > 0 && isz.cx > 0 ? LB_IMAGE : 0)) / 2;			p.y += (sz.cy - isz.cy) / 2;			if(b.left) {				if(!left) p.x += style->loff;			}			else				if(!right) p.x += style->roff;			if(b.monoimg || IsNull(b.img))				w.DrawImage(p.x, p.y, m, frm ? style->fmonocolor[st] : style->monocolor[st]);			else				w.DrawImage(p.x, p.y, m);			if(tsz.cx > 0) {				if(isz.cx > 0)					p.x += isz.cx + LB_IMAGE;				w.DrawText(p.x, (sz.cy - tsz.cy) / 2, b.label);			}		}		(b.left ? left : right) = true;	}	Rect r, cr;	cr = GetSize();	cr.left = lx;	cr.right = rx;	Color text = SColorLabel();	Color paper = Null;	if(!nobg) {		if(ComplexFrame()) {			r = cr;			paper = HasFocus() ? SColorHighlight() : SColorPaper();			if(HasFocus())				text = SColorHighlightText();			w.DrawRect(r, paper);		}		else		if(frm) {			Rect m = GetMargin();			r = Rect(max(lx, m.left), m.top, min(rx, sz.cx - m.right), sz.cy - m.bottom);			Color paper;			if(mst == CTRL_HOT && !IsTrivial())				paper = Blend(SColorHighlight, SColorPaper, 235);			else			if(mst == CTRL_PRESSED && !IsTrivial())				paper = Blend(SColorHighlight, SColorFace, 235);			else//.........这里部分代码省略.........
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:101,


示例26:

 void    Widget::GiveFocusTo(Widget* widget) {     if (!HasFocus())         return;     Widget::mFocusedWidget = widget; }
开发者ID:MStr3am,项目名称:sfui,代码行数:6,


示例27: OnJumpLetter

bool CGUIBaseContainer::OnAction(const CAction &action){  if (action.GetID() >= KEY_ASCII)  {    OnJumpLetter((char)(action.GetID() & 0xff));    return true;  }  // stop the timer on any other action  m_matchTimer.Stop();  switch (action.GetID())  {  case ACTION_MOVE_LEFT:  case ACTION_MOVE_RIGHT:  case ACTION_MOVE_DOWN:  case ACTION_MOVE_UP:  case ACTION_NAV_BACK:  case ACTION_PREVIOUS_MENU:    {      if (!HasFocus()) return false;      if (action.GetHoldTime() > HOLD_TIME_START &&        ((m_orientation == VERTICAL && (action.GetID() == ACTION_MOVE_UP || action.GetID() == ACTION_MOVE_DOWN)) ||         (m_orientation == HORIZONTAL && (action.GetID() == ACTION_MOVE_LEFT || action.GetID() == ACTION_MOVE_RIGHT))))      { // action is held down - repeat a number of times        float speed = std::min(1.0f, (float)(action.GetHoldTime() - HOLD_TIME_START) / (HOLD_TIME_END - HOLD_TIME_START));        unsigned int frameDuration = std::min(CTimeUtils::GetFrameTime() - m_lastHoldTime, 50u); // max 20fps        // maximal scroll rate is at least 30 items per second, and at most (item_rows/7) items per second        //  i.e. timed to take 7 seconds to traverse the list at full speed.        // minimal scroll rate is at least 10 items per second        float maxSpeed = std::max(frameDuration * 0.001f * 30, frameDuration * 0.001f * GetRows() / 7);        float minSpeed = frameDuration * 0.001f * 10;        m_scrollItemsPerFrame += std::max(minSpeed, speed*maxSpeed); // accelerate to max speed        m_lastHoldTime = CTimeUtils::GetFrameTime();        if(m_scrollItemsPerFrame < 1.0f)//not enough hold time accumulated for one step          return true;        while (m_scrollItemsPerFrame >= 1)        {          if (action.GetID() == ACTION_MOVE_LEFT || action.GetID() == ACTION_MOVE_UP)            MoveUp(false);          else            MoveDown(false);          m_scrollItemsPerFrame--;        }        return true;      }      else      {        //if HOLD_TIME_START is reached we need        //a sane initial value for calculating m_scrollItemsPerPage        m_lastHoldTime = CTimeUtils::GetFrameTime();        m_scrollItemsPerFrame = 0.0f;        return CGUIControl::OnAction(action);      }    }  case ACTION_CONTEXT_MENU:    if (OnContextMenu())      return true;    break;  case ACTION_SHOW_INFO:    if (m_listProvider)    {      int selected = GetSelectedItem();      if (selected >= 0 && selected < static_cast<int>(m_items.size()))      {        m_listProvider->OnInfo(m_items[selected]);        return true;      }    }    else if (OnInfo())      return true;    else if (action.GetID())      return OnClick(action.GetID());    else      return false;  case ACTION_FIRST_PAGE:    SelectItem(0);    return true;  case ACTION_LAST_PAGE:    if (m_items.size())      SelectItem(m_items.size() - 1);    return true;  case ACTION_NEXT_LETTER:    OnNextLetter();    return true;  case ACTION_PREV_LETTER:    OnPrevLetter();    return true;  case ACTION_JUMP_SMS2:  case ACTION_JUMP_SMS3:  case ACTION_JUMP_SMS4:  case ACTION_JUMP_SMS5:  case ACTION_JUMP_SMS6:  case ACTION_JUMP_SMS7://.........这里部分代码省略.........
开发者ID:FernetMenta,项目名称:xbmc,代码行数:101,


示例28: MouseMove

void LineEdit::MouseMove(Point p, dword flags) {	if((flags & K_MOUSELEFT) && HasFocus() && HasCapture()) {		int c = GetMousePos(p);		PlaceCaret(c, mpos != c || HasCapture());	}}
开发者ID:pedia,项目名称:raidget,代码行数:6,



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


C++ HasFollowState函数代码示例
C++ HasEscortState函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。