这篇教程C++ IsFocus函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中IsFocus函数的典型用法代码示例。如果您正苦于以下问题:C++ IsFocus函数的具体用法?C++ IsFocus怎么用?C++ IsFocus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了IsFocus函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: boundsvoid 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,
示例2: FramevoidETextEditable::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,
示例3: WindowActivated//------------------------------------------------------------------------------void BControl::WindowActivated(bool active){ BView::WindowActivated(active); if (IsFocus()) Invalidate(Bounds());}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:8,
示例4: GetFontHeightvoidBRadioButton::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,
示例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.*/voidWinDecorator::_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,
示例6: ControlBoundsvoid 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,
示例7: voidTextDocumentView::MakeFocus(bool focus){ if (focus != IsFocus()) Invalidate(); BView::MakeFocus(focus);}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:7,
示例8: GetTextHeightint 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,
示例9: Framevoid_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,
示例10: voidBChannelSlider::MakeFocus(bool focusState){ if (focusState && !IsFocus()) fFocusChannel = -1; BChannelControl::MakeFocus(focusState);}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:7,
示例11: DrawPicturevoidBPictureButton::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,
示例12: WindowActivated//------------------------------------------------------------------------------void BMenuField::WindowActivated(bool state){ BView::WindowActivated(state); if (IsFocus()) Draw(Bounds());}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:8,
示例13: renderTextvoid 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,
示例14: b// DrawvoidBoolValueView::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,
示例15: voidMemoryView::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,
示例16: ResizeTovoid_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,
示例17: voidMemoryView::MouseDown(BPoint point){ if (!IsFocus()) MakeFocus(true); BView::MouseDown(point);}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:8,
示例18: void_BMCMenuBar_::MakeFocus(bool focused){ if (IsFocus() == focused) return; BMenuBar::MakeFocus(focused);}
开发者ID:mylegacy,项目名称:haiku,代码行数:8,
示例19: voidBMenuField::WindowActivated(bool state){ BView::WindowActivated(state); if (IsFocus()) Invalidate();}
开发者ID:michael-manley,项目名称:haiku,代码行数:8,
示例20: // MakeFocusvoidAlphaSlider::MakeFocus(bool focus){ if (focus != IsFocus()) { BControl::MakeFocus(focus); Invalidate(); }}
开发者ID:DonCN,项目名称:haiku,代码行数:9,
示例21: MakeFocus void MakeFocus(bool focusState=true) { if( Window() && Parent() && IsFocus() != focusState ) { BMessage msg(focusState ? INLINE_STARTFOCUS_MSG:INLINE_ENDFOCUS_MSG); mOwner.SendMessage(&msg); } inherited::MakeFocus(focusState); }
开发者ID:dtbinh,项目名称:Sequitur,代码行数:9,
示例22: // MakeFocusvoidPropertyListView::MakeFocus(bool focus){ if (focus == IsFocus()) return; BView::MakeFocus(focus); if (::ScrollView* scrollView = dynamic_cast< ::ScrollView*>(Parent())) scrollView->ChildFocusChanged(focus);}
开发者ID:mariuz,项目名称:haiku,代码行数:11,
示例23: MakeFocus//------------------------------------------------------------------------------void BMenuField::MakeFocus(bool state){ if (IsFocus() == state) return; BView::MakeFocus(state); if(Window()) Draw(Bounds()); // TODO: use fStringWidth}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:11,
示例24: UpdateSelfvoid cgUILineEdit::UpdateSelf( float fTime ){ if (IsFocus() && fTime - m_fLastUpdateTime > 0.5f) { m_fLastUpdateTime = fTime; m_bCursorVisible = !m_bCursorVisible; ReportDirty(); }}
开发者ID:cgcoolgame,项目名称:cg,代码行数:10,
示例25: IsFocusvoidURLInputGroup::URLTextView::MouseDown(BPoint where){ bool wasFocus = IsFocus(); if (!wasFocus) MakeFocus(true); int32 buttons; if (Window()->CurrentMessage()->FindInt32("buttons", &buttons) != B_OK) buttons = B_PRIMARY_MOUSE_BUTTON; if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0) { // Display context menu int32 selectionStart; int32 selectionEnd; GetSelection(&selectionStart, &selectionEnd); bool canCutOrCopy = selectionEnd > selectionStart; bool canPaste = false; if (be_clipboard->Lock()) { if (BMessage* data = be_clipboard->Data()) canPaste = data->HasData("text/plain", B_MIME_TYPE); be_clipboard->Unlock(); } BMenuItem* cutItem = new BMenuItem(B_TRANSLATE("Cut"), new BMessage(B_CUT)); BMenuItem* copyItem = new BMenuItem(B_TRANSLATE("Copy"), new BMessage(B_COPY)); BMenuItem* pasteItem = new BMenuItem(B_TRANSLATE("Paste"), new BMessage(B_PASTE)); BMenuItem* clearItem = new BMenuItem(B_TRANSLATE("Clear"), new BMessage(MSG_CLEAR)); cutItem->SetEnabled(canCutOrCopy); copyItem->SetEnabled(canCutOrCopy); pasteItem->SetEnabled(canPaste); clearItem->SetEnabled(strlen(Text()) > 0); BPopUpMenu* menu = new BPopUpMenu("url context"); menu->AddItem(cutItem); menu->AddItem(copyItem); menu->AddItem(pasteItem); menu->AddItem(clearItem); menu->SetTargetForItems(this); menu->Go(ConvertToScreen(where), true, true, true); return; } // Only pass through to base class if we already have focus. if (!wasFocus) return; BTextView::MouseDown(where);}
开发者ID:MaddTheSane,项目名称:haiku,代码行数:55,
示例26: voidBListView::MakeFocus(bool focused){ if (IsFocus() == focused) return; BView::MakeFocus(focused); if (fScrollView) fScrollView->SetBorderHighlighted(focused);}
开发者ID:RAZVOR,项目名称:haiku,代码行数:11,
示例27: SetText// SetValuevoidStringTextView::SetValue(const char* string){ SetText(string); // update cache Value(); if (IsFocus()) SelectAll();}
开发者ID:stippi,项目名称:Clockwerk,代码行数:12,
示例28: voidInputTextView::MakeFocus(bool focus){ if (focus != IsFocus()) { if (BView* view = Parent()) view->Invalidate(); BTextView::MakeFocus(focus); if (focus) SelectAll(); }}
开发者ID:mmanley,项目名称:Antares,代码行数:11,
注:本文中的IsFocus函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ IsFocused函数代码示例 C++ IsFloodDone函数代码示例 |