• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ IsFocus函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: bounds

void LiveTextView::Draw(BRect updateRect) {

	BTextView::Draw( updateRect );

	BRect bounds( Bounds() );

	SetHighColor( 184, 184, 184 );
	StrokeLine( bounds.RightTop(), bounds.LeftTop() );
	StrokeLine( bounds.LeftBottom() );

	SetHighColor( 255, 255, 255 );
	StrokeLine( bounds.RightBottom() );
	StrokeLine( bounds.RightTop() );

	bounds.InsetBy( 1.0, 1.0 );

	if (IsFocus()) SetHighColor( 0, 0, 229 );
	else SetHighColor( 96, 96, 96);
	
	StrokeLine( bounds.RightTop(), bounds.LeftTop() );
	StrokeLine( bounds.LeftBottom() );

	if (IsFocus()) SetHighColor( 0, 0, 229 );
	else SetHighColor( 216, 216, 216 );
	StrokeLine( bounds.RightBottom() );
	StrokeLine( bounds.RightTop() );
}
开发者ID:diversys,项目名称:PecoRename,代码行数:27,代码来源:LiveTextControl.cpp


示例2: Frame

void
ETextEditable::DrawCursor()
{
	if(!IsEnabled() || !IsEditable() || fPosition < 0 || fPosition > fCount || (fCount > 0 && fCharWidths == NULL)) return;
	if(Window() == NULL || Window()->IsActivate() == false) return;
	if(!(IsFocus() || IsFocusChanging())) return;

	ERect rect = Frame().OffsetToSelf(E_ORIGIN);
	rect.left += fMargins.left;
	rect.top += fMargins.top;
	rect.right -= fMargins.right;
	rect.bottom -= fMargins.bottom;

	if(!rect.IsValid()) return;

	EFont font;
	e_font_height fontHeight;
	GetFont(&font);
	font.GetHeight(&fontHeight);
	float sHeight = fontHeight.ascent + fontHeight.descent;

	EPoint pt1;
	if(!GetCharLocation(fPosition, &(pt1.x), NULL, &font)) return;
	pt1.x -= 1;
	pt1.y = rect.Center().y - sHeight / 2.f;

	EPoint pt2 = pt1;
	pt2.y += sHeight;

	e_rgb_color crColor = e_ui_color(E_DOCUMENT_CURSOR_COLOR);

	if(IsFocusChanging() && !IsFocus())
	{
		if(fPosition > fSelectStart && fPosition <= fSelectEnd && fSelectEnd > fSelectStart)
		{
			crColor = e_ui_color(E_DOCUMENT_HIGHLIGHT_COLOR);
		}
		else
		{
			crColor = e_ui_color(E_DOCUMENT_BACKGROUND_COLOR);
		}
	}

	PushState();

	SetDrawingMode(E_OP_COPY);
	SetPenSize(0);
	SetHighColor(crColor);
	StrokeLine(pt1, pt2, E_SOLID_HIGH);

	PopState();
}
开发者ID:D-os,项目名称:EasyToolkitAndExtension,代码行数:52,代码来源:TextEditable.cpp


示例3: WindowActivated

//------------------------------------------------------------------------------
void BControl::WindowActivated(bool active)
{
	BView::WindowActivated(active);

	if (IsFocus())
		Invalidate(Bounds());
}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:8,代码来源:Control.cpp


示例4: GetFontHeight

void
BRadioButton::MouseDown(BPoint where)
{
	if (!IsEnabled() || !QueryCurrentMouse(true, B_PRIMARY_MOUSE_BUTTON)) return;

#if 0
	font_height fontHeight;
	GetFontHeight(&fontHeight);
	float sHeight = fontHeight.ascent + fontHeight.descent;

	BRect rect = Frame().OffsetToSelf(B_ORIGIN);
	rect.InsetBy(5, (rect.Height() - sHeight) / 2);
	if (rect.IsValid() == false) return;
	rect.right = rect.left + rect.Height();
	if (rect.Contains(where) == false) return;
#endif

	if ((Flags() &B_NAVIGABLE) && !IsFocus()) MakeFocus();

//	SetValue((Value() == B_CONTROL_ON) ?B_CONTROL_OFF :B_CONTROL_ON);

	if (Value() == B_CONTROL_ON) return;
	SetValue(B_CONTROL_ON);

	Invoke();
}
开发者ID:D-os,项目名称:BeFree,代码行数:26,代码来源:RadioButton.cpp


示例5: Title

/*!	\brief Actually draws the title

	The main tasks for this function are to ensure that the decorator draws
	the title only in its own area and drawing the title itself.
	Using B_OP_COPY for drawing the title is recommended because of the marked
	performance hit of the other drawing modes, but it is not a requirement.

	\param tab The \a tab to update.
	\param rect area of the title to update.
*/
void
WinDecorator::_DrawTitle(Decorator::Tab* tab, BRect rect)
{
	const BRect& tabRect = tab->tabRect;
	const BRect& minimizeRect = tab->minimizeRect;
	const BRect& zoomRect = tab->zoomRect;
	const BRect& closeRect = tab->closeRect;

	fDrawingEngine->SetHighColor(fTextColor);
	fDrawingEngine->SetLowColor(IsFocus(tab)
		? fFocusTabColor : fNonFocusTabColor);

	tab->truncatedTitle = Title(tab);
	fDrawState.Font().TruncateString(&tab->truncatedTitle, B_TRUNCATE_END,
		((minimizeRect.IsValid() ? minimizeRect.left :
			zoomRect.IsValid() ? zoomRect.left :
			closeRect.IsValid() ? closeRect.left : tabRect.right) - 5)
		- (tabRect.left + 5));
	tab->truncatedTitleLength = tab->truncatedTitle.Length();
	fDrawingEngine->SetFont(fDrawState.Font());

	font_height fontHeight;
	fDrawState.Font().GetHeight(fontHeight);

	BPoint titlePos;
	titlePos.x = tabRect.left + 5;
	titlePos.y = floorf(((tabRect.top + 2.0) + tabRect.bottom
			+ fontHeight.ascent + fontHeight.descent) / 2.0
			- fontHeight.descent + 0.5);

	fDrawingEngine->DrawString(tab->truncatedTitle, tab->truncatedTitleLength,
		titlePos);
}
开发者ID:Paradoxianer,项目名称:haiku,代码行数:43,代码来源:WinDecorator.cpp


示例6: ControlBounds

void ArpIntControl::DrawOn(BRect updateRect, BView* view)
{
	BRect		cb = ControlBounds();
	float		textY = cb.top + Prefs().GetInt32(ARP_FULLFONT_Y);
	if (mDivider > 0) {
		view->SetHighColor(mViewColor);
		view->FillRect( BRect(0, cb.top, cb.left, cb.bottom) );
		if (mLabel.Length() > 0) {
			if ( IsFocus() ) view->SetHighColor( Prefs().GetColor(ARP_INT_FGF_C));
			else if ( !IsEnabled() ) view->SetHighColor( tint_color(Prefs().GetColor(ARP_INT_FG_C), B_LIGHTEN_1_TINT) );
			else view->SetHighColor( Prefs().GetColor(ARP_INT_FG_C) );
			view->SetLowColor(mViewColor);
			view->DrawString( mLabel.String(), BPoint(0, textY) );
		}
	}
	DrawControlBackgroundOn(cb, view);

	BPoint			drawPt(cb.left + 3, textY);
	if (IsEnabled() == false) {
		drawPt.x++;
		drawPt.y++;
	}
	BString16		str;
	GetValueLabel(Value(), str);
	SetValueColor(view);
	view->DrawString( str.String(), drawPt );
}
开发者ID:tgkokk,项目名称:Sequitur,代码行数:27,代码来源:ArpIntControl.cpp


示例7:

void
TextDocumentView::MakeFocus(bool focus)
{
	if (focus != IsFocus())
		Invalidate();
	BView::MakeFocus(focus);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:7,代码来源:TextDocumentView.cpp


示例8: GetTextHeight

int UITouchButton::GetTextHeight()
{
    if (m_strText.Length() > 0)
    {
        m_ifontAttr.m_iFace=FONT_DEFAULT;
        
        ITpFont* pFont = NULL;

        if (IsFocus())
        {
            pFont = FontManager::GetInstance()->GetFont(m_ifontAttr, m_iFocusedFontColor);
        }
        else
        {
            pFont = FontManager::GetInstance()->GetFont(m_ifontAttr, GetFontColor());
        }

        if(NULL == pFont)
        {
	        DebugPrintf(DLC_CHENM, "UITouchButton::Draw()  End: pFont = NULL");
            return E_FAIL;
        }

        int _iStringHeight = pFont->GetHeight();

        return _iStringHeight;
    }

    return -1;
}
开发者ID:chenhbzl,项目名称:OriginApp,代码行数:30,代码来源:UITouchButton.cpp


示例9: Frame

void
_BTextInput_::MakeFocus(bool state)
{
	if (state == IsFocus())
		return;

	BTextView::MakeFocus(state);

	if (state) {
		SetInitialText();
		SelectAll();
	} else {
		if (strcmp(Text(), fPreviousText) != 0)
			TextControl()->Invoke();

		free(fPreviousText);
		fPreviousText = NULL;
	}

	if (Window() != NULL) {
		// Invalidate parent to draw or remove the focus mark
		if (BTextControl* parent = dynamic_cast<BTextControl*>(Parent())) {
			BRect frame = Frame();
			frame.InsetBy(-1.0, -1.0);
			parent->Invalidate(frame);
		}
	}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:28,代码来源:TextInput.cpp


示例10:

void
BChannelSlider::MakeFocus(bool focusState)
{
	if (focusState && !IsFocus())
		fFocusChannel = -1;
	BChannelControl::MakeFocus(focusState);
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:7,代码来源:ChannelSlider.cpp


示例11: DrawPicture

void
BPictureButton::Draw(BRect updateRect)
{
	if (IsEnabled()) {
		if (Value() == B_CONTROL_ON)
			DrawPicture(fEnabledOn);
		else
			DrawPicture(fEnabledOff);
	} else {

		if (fDisabledOff == NULL
			|| (fDisabledOn == NULL && fBehavior == B_TWO_STATE_BUTTON))
			debugger("Need to set the 'disabled' pictures for this BPictureButton ");

		if (Value() == B_CONTROL_ON)
			DrawPicture(fDisabledOn);
		else
			DrawPicture(fDisabledOff);
	}

	if (IsFocus()) {
		SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR));
		StrokeRect(Bounds(), B_SOLID_HIGH);
	}
}
开发者ID:naveedasmat,项目名称:haiku,代码行数:25,代码来源:PictureButton.cpp


示例12: WindowActivated

//------------------------------------------------------------------------------
void BMenuField::WindowActivated(bool state)
{
	BView::WindowActivated(state);

	if (IsFocus())
		Draw(Bounds());
}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:8,代码来源:MenuField.cpp


示例13: renderText

void EditWidget::renderText()
{
	bool cv = cursor_visible;
	if (!IsFocus()) {
		cv = false;
	} else {
		uint32 now = SDL_GetTicks();
		if (now > cursor_changed + 750) {
			cv = !cursor_visible;
			cursor_changed = now;
		}
	}

	if (cv != cursor_visible) {
		FORGET_OBJECT(cached_text);
		cursor_visible = cv;
	}

	if (!cached_text) {
		Pentagram::Font *font = getFont();

		int max_width = multiline ? dims.w : 0;
		int max_height = dims.h;
		if (gamefont && font->isHighRes()) {
			int x = 0, y = 0;
			GumpRectToScreenSpace(x, y, max_width, max_height, ROUND_INSIDE);
		}

		unsigned int remaining;
		cached_text = font->renderText(text, remaining,
									   max_width, max_height,
									   Pentagram::Font::TEXT_LEFT,
									   false, cv ? cursor : std::string::npos);
	}
}
开发者ID:amichaelt,项目名称:pentagram,代码行数:35,代码来源:EditWidget.cpp


示例14: b

// Draw
void
BoolValueView::Draw(BRect updateRect)
{
	BRect b(Bounds());
	// focus indication
	if (IsFocus()) {
		SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR));
		StrokeRect(b);
		b.InsetBy(1.0, 1.0);
	}
	// background
	FillRect(b, B_SOLID_LOW);

	// checkmark box
	rgb_color crossOutline = kBlack;
	rgb_color crossColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);

	if (!fEnabled) {
		crossOutline = tint_color(crossOutline, B_LIGHTEN_2_TINT);
		crossColor = tint_color(crossColor, B_LIGHTEN_2_TINT);
	}

	SetHighColor(crossOutline);
	b = fCheckBoxRect;
	StrokeRect(b);

	// checkmark
	if (fProperty && fProperty->Value()) {
		SetHighColor(crossColor);
		b.InsetBy(3.0, 3.0);
		SetPenSize(2.0);
		StrokeLine(b.LeftTop(), b.RightBottom());
		StrokeLine(b.LeftBottom(), b.RightTop());
	}
}
开发者ID:mmanley,项目名称:Antares,代码行数:36,代码来源:BoolValueView.cpp


示例15:

void
MemoryView::MouseDown(BPoint point)
{
	if (!IsFocus())
		MakeFocus(true);

	if (fTargetBlock == NULL)
		return;

	int32 buttons;
	if (Looper()->CurrentMessage()->FindInt32("buttons", &buttons) != B_OK)
		buttons = B_PRIMARY_MOUSE_BUTTON;

	if (buttons == B_SECONDARY_MOUSE_BUTTON) {
		_HandleContextMenu(point);
		return;
	}

	int32 offset = _GetOffsetAt(point);
	if (offset < fSelectionStart || offset > fSelectionEnd) {
		BRegion oldSelectionRegion;
		_GetSelectionRegion(oldSelectionRegion);
		fSelectionBase = offset;
		fSelectionStart = fSelectionBase;
		fSelectionEnd = fSelectionBase;
		Invalidate(oldSelectionRegion.Frame());
	}

	SetMouseEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
	fTrackingMouse = true;
}
开发者ID:dnivra,项目名称:haiku,代码行数:31,代码来源:MemoryView.cpp


示例16: ResizeTo

void
_BMCMenuBar_::Draw(BRect updateRect)
{
	if (fFixedSize) {
		// Set the width of the menu bar because the menu bar bounds may have
		// been expanded by the selected menu item.
		ResizeTo(fMenuField->_MenuBarWidth(), Bounds().Height());
	} else {
		// For compatability with BeOS R5:
		//  - Set to the minimum of the menu bar width set by the menu frame
		//    and the selected menu item width.
		//  - Set the height to the preferred height ignoring the height of the
		//    menu field.
		float height;
		BMenuBar::GetPreferredSize(NULL, &height);
		ResizeTo(std::min(Bounds().Width(), fMenuField->_MenuBarWidth()),
			height);
	}

	BRect rect(Bounds());
	rgb_color base = ui_color(B_MENU_BACKGROUND_COLOR);
	uint32 flags = 0;
	if (!IsEnabled())
		flags |= BControlLook::B_DISABLED;
	if (IsFocus())
		flags |= BControlLook::B_FOCUSED;

	be_control_look->DrawMenuFieldBackground(this, rect,
		updateRect, base, fShowPopUpMarker, flags);

	_DrawItems(updateRect);
}
开发者ID:mylegacy,项目名称:haiku,代码行数:32,代码来源:BMCPrivate.cpp


示例17:

void
MemoryView::MouseDown(BPoint point)
{
	if (!IsFocus())
		MakeFocus(true);

	BView::MouseDown(point);
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:8,代码来源:MemoryView.cpp


示例18:

void
_BMCMenuBar_::MakeFocus(bool focused)
{
	if (IsFocus() == focused)
		return;

	BMenuBar::MakeFocus(focused);
}
开发者ID:mylegacy,项目名称:haiku,代码行数:8,代码来源:BMCPrivate.cpp


示例19:

void
BMenuField::WindowActivated(bool state)
{
	BView::WindowActivated(state);

	if (IsFocus())
		Invalidate();
}
开发者ID:michael-manley,项目名称:haiku,代码行数:8,代码来源:MenuField.cpp


示例20:

// MakeFocus
void
AlphaSlider::MakeFocus(bool focus)
{
	if (focus != IsFocus()) {
		BControl::MakeFocus(focus);
		Invalidate();
	}
}
开发者ID:DonCN,项目名称:haiku,代码行数:9,代码来源:AlphaSlider.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IsFocused函数代码示例发布时间:2022-05-30
下一篇:
C++ IsFloodDone函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap