本文整理汇总了C++中Flags函数的典型用法代码示例。如果您正苦于以下问题:C++ Flags函数的具体用法?C++ Flags怎么用?C++ Flags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Flags函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: D_OPERATION
void
CTool::SetValue(
int32 value)
{
D_OPERATION(("CTool::SetValue(%ld)\n", value));
if (value != m_value)
{
if (Mode() == TRIGGER_MODE)
{
// trigger tools don't change their value
return;
}
if ((Mode() == RADIO_MODE) && (Flags() & FORCE_SELECTION)
&& (Value() == B_CONTROL_ON))
{
// radio mode with the force-selection flag set does not
// allow 'turning off' the tool directly
return;
}
m_value = value;
if ((Mode() == RADIO_MODE) && (Value() == B_CONTROL_ON))
{
// turn off other tools in radio group
CTool *tool;
tool = PreviousTool();
while (tool)
{
if (tool->m_value == B_CONTROL_ON)
{
tool->m_value = B_CONTROL_OFF;
tool->ValueChanged();
}
tool = tool->PreviousTool();
}
tool = NextTool();
while (tool)
{
if (tool->m_value == B_CONTROL_ON)
{
tool->m_value = B_CONTROL_OFF;
tool->ValueChanged();
}
tool = tool->NextTool();
}
}
ValueChanged();
}
}
示例2: size
void
BMenuField::DoLayout()
{
// Bail out, if we shan't do layout.
if (!(Flags() & B_SUPPORTS_LAYOUT))
return;
CALLED();
// If the user set a layout, we let the base class version call its
// hook.
if (GetLayout()) {
BView::DoLayout();
return;
}
_ValidateLayoutData();
// validate current size
BSize size(Bounds().Size());
if (size.width < fLayoutData->min.width)
size.width = fLayoutData->min.width;
if (size.height < fLayoutData->min.height)
size.height = fLayoutData->min.height;
// divider
float divider = 0;
if (fLayoutData->label_layout_item && fLayoutData->menu_bar_layout_item) {
// We have layout items. They define the divider location.
divider = fLayoutData->menu_bar_layout_item->Frame().left
- fLayoutData->label_layout_item->Frame().left;
} else {
if (fLayoutData->label_width > 0)
divider = fLayoutData->label_width + 5;
}
// menu bar
BRect dirty(fMenuBar->Frame());
BRect menuBarFrame(divider + kVMargin, kVMargin, size.width - kVMargin,
size.height - kVMargin);
// place the menu bar and set the divider
BLayoutUtils::AlignInFrame(fMenuBar, menuBarFrame);
fDivider = divider;
// invalidate dirty region
dirty = dirty | fMenuBar->Frame();
dirty.InsetBy(-kVMargin, -kVMargin);
Invalidate(dirty);
}
示例3: normalize
void
VirtualKey::VK_JIS_TEMPORARY::firekeytoinputdetail(const Params_KeyboardEventCallBack& params,
InputSourceDetail inputsourcedetail)
{
inputsourcedetail = normalize(inputsourcedetail);
currentinputsourcedetail_ = normalize(currentinputsourcedetail_);
// ------------------------------------------------------------
if (inputsourcedetail == currentinputsourcedetail_) return;
if (inputsourcedetail == InputSourceDetail::NONE) return;
currentinputsourcedetail_ = inputsourcedetail;
// ------------------------------------------------------------
if (inputsourcedetail == InputSourceDetail::ENGLISH) {
fireKeyInfo_.flags = Flags(0);
fireKeyInfo_.key = KeyCode::JIS_EISUU;
} else if (inputsourcedetail == InputSourceDetail::JAPANESE_HIRAGANA) {
fireKeyInfo_.flags = Flags(0);
fireKeyInfo_.key = KeyCode::JIS_KANA;
} else if (inputsourcedetail == InputSourceDetail::JAPANESE_KATAKANA) {
fireKeyInfo_.flags = ModifierFlag::SHIFT_L;
fireKeyInfo_.key = KeyCode::JIS_KANA;
} else if (inputsourcedetail == InputSourceDetail::AINU) {
fireKeyInfo_.flags = ModifierFlag::OPTION_L;
fireKeyInfo_.key = KeyCode::JIS_KANA;
} else {
return;
}
fireKeyInfo_.keyboardType = params.keyboardType;
fireKeyInfo_.active = true;
fire_timer_.setTimeoutMS(KEYEVENT_DELAY_MS);
}
示例4: BMenuBar
_BMCMenuBar_::_BMCMenuBar_(BMessage* data)
:
BMenuBar(data),
fMenuField(NULL),
fFixedSize(true),
fShowPopUpMarker(true)
{
SetFlags(Flags() | B_FRAME_EVENTS);
bool resizeToFit;
if (data->FindBool("_rsize_to_fit", &resizeToFit) == B_OK)
fFixedSize = !resizeToFit;
}
示例5: Window
void
BButton::MakeDefault(bool flag)
{
BButton* oldDefault = NULL;
BWindow* window = Window();
if (window != NULL)
oldDefault = window->DefaultButton();
if (flag) {
if (_Flag(FLAG_DEFAULT) && oldDefault == this)
return;
if (_SetFlag(FLAG_DEFAULT, true)) {
if ((Flags() & B_SUPPORTS_LAYOUT) != 0)
InvalidateLayout();
else {
ResizeBy(6.0f, 6.0f);
MoveBy(-3.0f, -3.0f);
}
}
if (window && oldDefault != this)
window->SetDefaultButton(this);
} else {
if (!_SetFlag(FLAG_DEFAULT, false))
return;
if ((Flags() & B_SUPPORTS_LAYOUT) != 0)
InvalidateLayout();
else {
ResizeBy(-6.0f, -6.0f);
MoveBy(3.0f, 3.0f);
}
if (window && oldDefault == this)
window->SetDefaultButton(NULL);
}
}
示例6: BView
WorkspacesView::WorkspacesView(BMessage* archive)
:
BView(archive),
fParentWhichDrawsOnChildren(NULL),
fCurrentFrame(Frame())
{
// Just in case we are instantiated from an older archive...
SetFlags(Flags() | B_FRAME_EVENTS);
// Make sure the auto-raise feature didn't leave any artifacts - this is
// not a good idea to keep enabled for a replicant.
if (EventMask() != 0)
SetEventMask(0);
}
示例7: frame
void
BBox::DoLayout()
{
// Bail out, if we shan't do layout.
if (!(Flags() & B_SUPPORTS_LAYOUT))
return;
bool layouted = GetLayout() ? true : false;
// If the user set a layout, let the base class version call its
// hook. In case when we have BView as a label, remove it from child list
// so it won't be layouted with the rest of views and add it again
// after that.
if (layouted) {
if (fLabelView)
RemoveChild(fLabelView);
BView::DoLayout();
if (fLabelView)
AddChild(fLabelView, ChildAt(0));
else
return;
}
_ValidateLayoutData();
// Even if the user set a layout, restore label view to it's
// desired position.
// layout the label view
if (fLabelView) {
fLabelView->MoveTo(fLayoutData->label_box.LeftTop());
fLabelView->ResizeTo(fLayoutData->label_box.Size());
}
// If we have layout return here and do not layout the child
if (layouted)
return;
// layout the child
if (BView* child = _Child()) {
BRect frame(Bounds());
frame.left += fLayoutData->insets.left;
frame.top += fLayoutData->insets.top;
frame.right -= fLayoutData->insets.right;
frame.bottom -= fLayoutData->insets.bottom;
BLayoutUtils::AlignInFrame(child, frame);
}
}
示例8: Frame
void
ShowImageWindow::_ToggleFullScreen()
{
BRect frame;
fFullScreen = !fFullScreen;
if (fFullScreen) {
BScreen screen;
fWindowFrame = Frame();
frame = screen.Frame();
frame.top -= fBar->Bounds().Height() + 1;
frame.right += B_V_SCROLL_BAR_WIDTH;
frame.bottom += B_H_SCROLL_BAR_HEIGHT;
SetFlags(Flags() | B_NOT_RESIZABLE | B_NOT_MOVABLE);
Activate();
// make the window frontmost
} else {
frame = fWindowFrame;
SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_MOVABLE));
}
fToolBar->SetActionVisible(MSG_FULL_SCREEN, fFullScreen);
_SetToolBarVisible(!fFullScreen && fShowToolBar);
_SetToolBarBorder(!fFullScreen);
MoveTo(frame.left, frame.top);
ResizeTo(frame.Width(), frame.Height());
fImageView->SetHideIdlingCursor(fFullScreen);
fImageView->SetShowCaption(fFullScreen && fShowCaption);
Layout(false);
// We need to manually relayout here, as the views are layouted
// asynchronously, and FitToBounds() would still have the wrong size
fImageView->FitToBounds();
}
示例9: print_flags
void print_flags(Flags flag, const char * (&names)[N], std::string& str)
{
if (flag == 0)
{
str += "None";
return;
}
for (int i = 0; i < N; ++i)
{
if ((flag & (Flags(1) << i)) && names[i] != NULL)
str.append(" ").append(names[i]);
}
}
示例10: BorderSize
void
BScrollView::SetBorder(border_style border)
{
if (fBorder == border)
return;
float offset = BorderSize(fBorder) - BorderSize(border);
float resize = 2 * offset;
float horizontalGap = 0, verticalGap = 0;
float change = 0;
if (border == B_NO_BORDER || fBorder == B_NO_BORDER) {
if (fHorizontalScrollBar != NULL)
verticalGap = border != B_NO_BORDER ? 1 : -1;
if (fVerticalScrollBar != NULL)
horizontalGap = border != B_NO_BORDER ? 1 : -1;
change = border != B_NO_BORDER ? -1 : 1;
if (fHorizontalScrollBar == NULL || fVerticalScrollBar == NULL)
change *= 2;
}
fBorder = border;
int32 savedResizingMode = 0;
if (fTarget != NULL) {
savedResizingMode = fTarget->ResizingMode();
fTarget->SetResizingMode(B_FOLLOW_NONE);
}
MoveBy(offset, offset);
ResizeBy(-resize - horizontalGap, -resize - verticalGap);
if (fTarget != NULL) {
fTarget->MoveBy(-offset, -offset);
fTarget->SetResizingMode(savedResizingMode);
}
if (fHorizontalScrollBar != NULL) {
fHorizontalScrollBar->MoveBy(-offset - verticalGap, offset + verticalGap);
fHorizontalScrollBar->ResizeBy(resize + horizontalGap - change, 0);
}
if (fVerticalScrollBar != NULL) {
fVerticalScrollBar->MoveBy(offset + horizontalGap, -offset - horizontalGap);
fVerticalScrollBar->ResizeBy(0, resize + verticalGap - change);
}
SetFlags(ModifyFlags(Flags(), border));
}
示例11: Bounds
void
BStatusBar::_InitObject()
{
fMax = 100.0;
fCurrent = 0.0;
fBarHeight = -1.0;
fTextDivider = Bounds().Width();
fBarColor = kDefaultBarColor;
fCustomBarHeight = false;
SetFlags(Flags() | B_FRAME_EVENTS);
}
示例12: Bounds
void
BStatusBar::_InitObject()
{
fMax = 100.0;
fCurrent = 0.0;
fBarHeight = -1.0;
fTextDivider = Bounds().Width();
fCustomBarHeight = false;
fInternalFlags = 0;
SetFlags(Flags() | B_FRAME_EVENTS);
}
示例13: Flags
void QgsVectorLayerLabelProvider::init()
{
mPlacement = mSettings.placement;
mLinePlacementFlags = mSettings.placementFlags;
mFlags = Flags();
if ( mSettings.drawLabels ) mFlags |= DrawLabels;
if ( mSettings.displayAll ) mFlags |= DrawAllLabels;
if ( mSettings.mergeLines ) mFlags |= MergeConnectedLines;
if ( mSettings.centroidInside ) mFlags |= CentroidMustBeInside;
if ( mSettings.fitInPolygonOnly ) mFlags |= FitInPolygonOnly;
if ( mSettings.labelPerPart ) mFlags |= LabelPerFeaturePart;
mPriority = 1 - mSettings.priority / 10.0; // convert 0..10 --> 1..0
mObstacleType = mSettings.obstacleType;
mUpsidedownLabels = mSettings.upsidedownLabels;
}
示例14: inherited
/*------------------------------------------------------------------------------*\
( )
-
\*------------------------------------------------------------------------------*/
BmToolbarButton::BmToolbarButton( const char *label, float width, float height,
BMessage *message, BHandler *handler,
const char* tipText, bool needsLatch,
const char* resourceName)
: inherited( minimax( int(width), int(height), -1 ,-1),
&BmDummyPicture, &BmDummyPicture, message, handler)
, mHighlighted( false)
, mNeedsLatch( needsLatch)
, mUpdateVariationsFunc( NULL)
, mLabel( label)
, mResourceName( resourceName ? resourceName : label)
{
SetFlags(Flags() & ~B_NAVIGABLE);
TheBubbleHelper->SetHelp( this, tipText);
}
示例15: SetLabel
void
BControl::InitData(BMessage* data)
{
fLabel = NULL;
SetLabel(B_EMPTY_STRING);
fValue = B_CONTROL_OFF;
fEnabled = true;
fFocusChanging = false;
fTracking = false;
fWantsNav = Flags() & B_NAVIGABLE;
fIcon = NULL;
if (data && data->HasString("_fname"))
SetFont(be_plain_font, B_FONT_FAMILY_AND_STYLE);
}