本文整理汇总了C++中Flags函数的典型用法代码示例。如果您正苦于以下问题:C++ Flags函数的具体用法?C++ Flags怎么用?C++ Flags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Flags函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
}
开发者ID:HaikuArchives,项目名称:MeV,代码行数:52,代码来源:Tool.cpp
示例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);
}
开发者ID:michael-manley,项目名称:haiku,代码行数:52,代码来源:MenuField.cpp
示例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);
}
开发者ID:Bilalh,项目名称:KeyRemap4MacBook,代码行数:39,代码来源:VK_JIS_TEMPORARY.cpp
示例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;
}
开发者ID:mylegacy,项目名称:haiku,代码行数:13,代码来源:BMCPrivate.cpp
示例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);
}
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:39,代码来源:Button.cpp
示例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);
}
开发者ID:mmanley,项目名称:Antares,代码行数:13,代码来源:Workspaces.cpp
示例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);
}
}
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:51,代码来源:Box.cpp
示例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();
}
开发者ID:yunxiaoxiao110,项目名称:haiku,代码行数:38,代码来源:ShowImageWindow.cpp
示例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]);
}
}
开发者ID:SilverIce,项目名称:Movement,代码行数:14,代码来源:util.cpp
示例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));
}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:50,代码来源:ScrollView.cpp
示例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);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:14,代码来源:StatusBar.cpp
示例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);
}
开发者ID:jessicah,项目名称:haiku-private,代码行数:14,代码来源:StatusBar.cpp
示例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;
}
开发者ID:paulfab,项目名称:QGIS,代码行数:15,代码来源:qgsvectorlayerlabelprovider.cpp
示例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);
}
开发者ID:HaikuArchives,项目名称:Beam,代码行数:19,代码来源:BmToolbarButton.cpp
示例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);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:15,代码来源:Control.cpp
示例16: BView
BStringView::BStringView(BMessage* archive)
:
BView(archive),
fText(NULL),
fTruncation(B_NO_TRUNCATION),
fPreferredSize(0, -1)
{
fAlign = (alignment)archive->GetInt32("_align", B_ALIGN_LEFT);
fTruncation = (uint32)archive->GetInt32("_truncation", B_NO_TRUNCATION);
const char* text = archive->GetString("_text", NULL);
SetText(text);
SetFlags(Flags() | B_FULL_UPDATE_ON_RESIZE);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:15,代码来源:StringView.cpp
示例17: Flags
status_t
BlockGroup::SetExtentTree(off_t rootAddress)
{
status_t status = fCurrentExtentTree->SetRoot(rootAddress, NULL);
if (status != B_OK)
return status;
if (fItem != NULL) {
// re-allocate BlockGroup;
uint64 flags = Flags();
return Initialize(flags);
}
return B_OK;
}
开发者ID:mmuman,项目名称:haiku,代码行数:15,代码来源:ExtentAllocator.cpp
示例18:
WriterImplBase::~WriterImplBase()
{
delete fHeapWriter;
delete fCompressionAlgorithm;
delete fCompressionParameters;
delete fDecompressionAlgorithm;
delete fDecompressionParameters;
if (fOwnsFile)
delete fFile;
if (!fFinished && fFileName != NULL
&& (Flags() & B_HPKG_WRITER_UPDATE_PACKAGE) == 0) {
unlink(fFileName);
}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:16,代码来源:WriterImplBase.cpp
示例19: IOLOG_DEVEL
void
PressDownKeys::clear(void) {
IOLOG_DEVEL("PressDownKeys::clear list_.size = %d\n", static_cast<int>(list_.size()));
Item* p = static_cast<Item*>(list_.safe_front());
for (;;) {
if (!p) break;
Params_KeyboardEventCallBack params(EventType::UP, Flags(0), p->key, p->keyboardType, false);
EventOutputQueue::push(params);
IOLOG_DEVEL("PressDownKeys::clear key:%d, keyboardType:%d\n", params.key.get(), params.keyboardType.get());
p = static_cast<Item*>(list_.erase_and_delete(p));
}
}
开发者ID:MethodGrab,项目名称:Karabiner,代码行数:16,代码来源:PressDownKeys.cpp
示例20: GetFontHeight
void
BAbstractSpinner::_ValidateLayoutData()
{
if (fLayoutData->valid)
return;
font_height fontHeight = fLayoutData->font_info;
GetFontHeight(&fontHeight);
if (Label() != NULL) {
fLayoutData->label_width = StringWidth(Label());
fLayoutData->label_height = ceilf(fontHeight.ascent
+ fontHeight.descent + fontHeight.leading);
} else {
fLayoutData->label_width = 0;
fLayoutData->label_height = 0;
}
float divider = 0;
if (fLayoutData->label_width > 0) {
divider = ceilf(fLayoutData->label_width
+ be_control_look->DefaultLabelSpacing());
}
if ((Flags() & B_SUPPORTS_LAYOUT) == 0)
divider = std::max(divider, fDivider);
float minTextWidth = fTextView->StringWidth("99999");
float textViewHeight = fTextView->LineHeight(0) + kFrameMargin * 2;
float textViewWidth = minTextWidth + textViewHeight * 2;
fLayoutData->text_view_width = textViewWidth;
fLayoutData->text_view_height = textViewHeight;
BSize min(textViewWidth, textViewHeight);
if (divider > 0.0f)
min.width += divider;
if (fLayoutData->label_height > min.height)
min.height = fLayoutData->label_height;
fLayoutData->min = min;
fLayoutData->valid = true;
ResetLayoutInvalidation();
}
开发者ID:simonsouth,项目名称:haiku,代码行数:47,代码来源:AbstractSpinner.cpp
注:本文中的Flags函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论