本文整理汇总了C++中GetLabel函数的典型用法代码示例。如果您正苦于以下问题:C++ GetLabel函数的具体用法?C++ GetLabel怎么用?C++ GetLabel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetLabel函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetLabel
wxSize wxRadioButton::DoGetBestSize() const
{
static int s_radioSize = 0;
if ( !s_radioSize )
{
wxScreenDC dc;
dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
s_radioSize = dc.GetCharHeight();
// radio button bitmap size under CE is bigger than the font height,
// adding just one pixel seems to work fine for the default font but it
// would be nice to find some better way to find the correct height
#ifdef __WXWINCE__
s_radioSize++;
#endif // __WXWINCE__
}
wxString str = GetLabel();
int wRadio, hRadio;
if ( !str.empty() )
{
GetTextExtent(GetLabelText(str), &wRadio, &hRadio);
wRadio += s_radioSize + GetCharWidth();
if ( hRadio < s_radioSize )
hRadio = s_radioSize;
}
else
{
wRadio = s_radioSize;
hRadio = s_radioSize;
}
wxSize best(wRadio, hRadio);
CacheBestSize(best);
return best;
}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:40,代码来源:radiobut.cpp
示例2: XtVaGetValues
wxSize wxButton::OldGetBestSize() const
{
Dimension xmargin, ymargin, highlight, shadow, defThickness;
XtVaGetValues( (Widget)m_mainWidget,
XmNmarginWidth, &xmargin,
XmNmarginHeight, &ymargin,
XmNhighlightThickness, &highlight,
XmNshadowThickness, &shadow,
XmNdefaultButtonShadowThickness, &defThickness,
NULL );
int x = 0; int y = 0;
GetTextExtent( GetLabel(), &x, &y );
int margin = highlight * 2 +
( defThickness ? ( ( shadow + defThickness ) * 4 ) : ( shadow * 2 ) );
wxSize best( x + xmargin * 2 + margin,
y + ymargin * 2 + margin );
// all buttons have at least the standard size unless the user explicitly
// wants them to be of smaller size and used wxBU_EXACTFIT style when
// creating the button
if( !HasFlag( wxBU_EXACTFIT ) )
{
wxSize def = GetDefaultSize();
int margin = highlight * 2 +
( defThickness ? ( shadow * 4 + defThickness * 4 ) : 0 );
def.x += margin;
def.y += margin;
if( def.x > best.x )
best.x = def.x;
if( def.y > best.y )
best.y = def.y;
}
return best;
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:40,代码来源:button.cpp
示例3: assert
void StatGetter::GetStatsForPath(const QString& rootPath)
{
pathInWork_ = rootPath;
assert(!pathInWork_.isEmpty());
if (IsRunning())
{
RiseRunningThreadWarningMsg();
return;
}
statTree_.clear();
subdirsInCurPathCount_ = 0;
StatsCont cont {statTree_, subdirsInCurPathCount_};
currentThreadClass_.reset(new StatGetterThread(rootPath, cont,
GetProgBar(), GetLabel()) );
connect(&GetWorkerThread(), SIGNAL(started()), currentThreadClass_.data(),
SLOT(onStart()));
RunThread(currentThreadClass_.data());
}
开发者ID:NoviceF,项目名称:QtFilesystemTreeBuilder,代码行数:22,代码来源:statgetter.cpp
示例4: GetSrclang
void
HTMLTrackElement::CreateTextTrack()
{
nsString label, srcLang;
GetSrclang(srcLang);
GetLabel(label);
TextTrackKind kind;
if (const nsAttrValue* value = GetParsedAttr(nsGkAtoms::kind)) {
kind = static_cast<TextTrackKind>(value->GetEnumValue());
} else {
kind = TextTrackKind::Subtitles;
}
mTrack = new TextTrack(OwnerDoc()->GetParentObject(), kind, label, srcLang,
TextTrackMode::Disabled, TextTrackSource::Track);
mTrack->SetTrackElement(this);
if (mMediaParent) {
mMediaParent->AddTextTrack(mTrack);
}
}
开发者ID:jwwang,项目名称:gecko-dev-openh264,代码行数:22,代码来源:HTMLTrackElement.cpp
示例5: PyMac_PRECHECK
static PyObject *Icn_GetLabel(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSErr _err;
SInt16 labelNumber;
RGBColor labelColor;
Str255 labelString;
#ifndef GetLabel
PyMac_PRECHECK(GetLabel);
#endif
if (!PyArg_ParseTuple(_args, "hO&",
&labelNumber,
PyMac_GetStr255, labelString))
return NULL;
_err = GetLabel(labelNumber,
&labelColor,
labelString);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
QdRGB_New, &labelColor);
return _res;
}
开发者ID:Oize,项目名称:pspstacklesspython,代码行数:22,代码来源:_Icnmodule.c
示例6: RegenerateTooltips
void ControlToolBar::RegenerateTooltips()
{
#if wxUSE_TOOLTIPS
std::vector<wxString> commands;
for (long iWinID = ID_PLAY_BUTTON; iWinID < BUTTON_COUNT; iWinID++)
{
commands.clear();
auto pCtrl = static_cast<AButton*>(this->FindWindow(iWinID));
commands.push_back(pCtrl->GetLabel());
switch (iWinID)
{
case ID_PLAY_BUTTON:
commands.push_back(wxT("Play"));
commands.push_back(_("Loop Play"));
commands.push_back(wxT("PlayLooped"));
break;
case ID_RECORD_BUTTON:
commands.push_back(wxT("Record"));
commands.push_back(_("Append Record"));
commands.push_back(wxT("RecordAppend"));
break;
case ID_PAUSE_BUTTON:
commands.push_back(wxT("Pause"));
break;
case ID_STOP_BUTTON:
commands.push_back(wxT("Stop"));
break;
case ID_FF_BUTTON:
commands.push_back(wxT("SkipEnd"));
break;
case ID_REW_BUTTON:
commands.push_back(wxT("SkipStart"));
break;
}
ToolBar::SetButtonToolTip(*pCtrl, commands);
}
#endif
}
开发者ID:Grunji,项目名称:audacity,代码行数:38,代码来源:ControlToolBar.cpp
示例7: cvCreateMat
CvMat* ShiftMapHierarchy::CalculateLabelMapGuess()
{
CvMat* output = cvCreateMat(_outputSize.height, _outputSize.width, CV_32SC2);
int num_pixels = _outputSize.width * _outputSize.height;
printf("Getting label map... \n");
for(int i = 0; i < num_pixels; i++)
{
int label = _gc->whatLabel(i);
CvPoint point = GetPoint(i, _outputSize);
CvPoint shift = GetShift(label, _shiftSize);
CvPoint guess = GetLabel(point, _initialGuess);
CvPoint pointLabel = cvPoint(shift.x + guess.x, shift.y + guess.y);
// test
//CvPoint mapped = cvPoint(point.x + pointLabel.x, point.y + pointLabel.y);
//if(IsOutside(mapped, _inputSize))
// printf("test");
SetLabel(point, pointLabel, output);
}
return output;
}
开发者ID:TTgogogo,项目名称:retarget-toolkit,代码行数:23,代码来源:ShiftMapHierarchy.cpp
示例8: suffix
void SearchTreeNode::Dump(BasicSearchTree* tree, nSearchTreeNode node_id, const wxString& prefix, wxString& result)
{
wxString suffix(_T(""));
suffix << _T("- \"") << SerializeString(GetLabel(tree)) << _T("\" (") << U2S(node_id) << _T(")");
if (prefix.length() && prefix[prefix.length()-1]=='|')
result << prefix.substr(0,prefix.length()-1) << _T('+') << suffix << _T('\n');
else if (prefix.length() && prefix[prefix.length()-1]==' ')
result << prefix.substr(0,prefix.length()-1) << _T('\\') << suffix << _T('\n');
else
result << prefix << suffix << _T('\n');
wxString newprefix(prefix);
newprefix.append(suffix.length() - 2, _T(' '));
newprefix << _T("|");
SearchTreeLinkMap::iterator i;
unsigned int cnt = 0;
for (i = m_Children.begin(); i!= m_Children.end(); i++)
{
if (cnt == m_Children.size() - 1)
newprefix[newprefix.length() - 1] = _T(' ');
tree->GetNode(i->second,false)->Dump(tree,i->second,newprefix,result);
cnt++;
}
}
开发者ID:stahta01,项目名称:EmBlocks_old,代码行数:23,代码来源:searchtree.cpp
示例9: wxASSERT
//
// Returns the value to be presented to accessibility
//
// Current, the command and key are both provided.
//
wxString
KeyView::GetValue(int line)
{
// Make sure line is valid
if (line < 0 || line >= (int) mLines.GetCount())
{
wxASSERT(false);
return wxEmptyString;
}
// Get the label and key values
wxString value;
if (mViewType == ViewByTree)
{
value = GetLabel(LineToIndex(line));
}
else
{
value = GetFullLabel(LineToIndex(line));
}
wxString key = GetKey(LineToIndex(line));
// Add the key if it isn't empty
if (!key.IsEmpty())
{
if (mViewType == ViewByKey)
{
value = key + wxT(" ") + value;
}
else
{
value = value + wxT(" ") + key;
}
}
return value;
}
开发者ID:tuanmasterit,项目名称:audacity,代码行数:42,代码来源:KeyView.cpp
示例10: StackPush
std::ostream& LoadBalanceInverseOperator::Print(std::ostream& os, const bool verbose) const
{
StackPush();
if (GetMyPID() == 0) {
os << "***MLAPI::InverseOperator" << std::endl;
os << "Label = " << GetLabel() << std::endl;
os << "Number of rows = " << GetRangeSpace().GetNumGlobalElements() << std::endl;
os << "Number of columns = " << GetRangeSpace().GetNumGlobalElements() << std::endl;
os << "Flop count = " << GetFlops() << std::endl;
os << "Cumulative time = " << GetTime() << std::endl;
if (GetTime() != 0.0)
os << "MFlops rate = " << 1.0e-6 * GetFlops() / GetTime() << std::endl;
else
os << "MFlops rate = 0.0" << std::endl;
os << std::endl;
}
StackPop();
return(os);
}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:24,代码来源:MLAPI_LoadBalanceInverseOperator.cpp
示例11: DoUpdateWindowUI
// wxControl-specific processing after processing the update event
void wxControlBase::DoUpdateWindowUI(wxUpdateUIEvent& event)
{
// call inherited
wxWindowBase::DoUpdateWindowUI(event);
// update label
if ( event.GetSetText() )
{
if ( event.GetText() != GetLabel() )
SetLabel(event.GetText());
}
// Unfortunately we don't yet have common base class for
// wxRadioButton, so we handle updates of radiobuttons here.
// TODO: If once wxRadioButtonBase will exist, move this code there.
#if wxUSE_RADIOBTN
if ( event.GetSetChecked() )
{
wxRadioButton *radiobtn = wxDynamicCastThis(wxRadioButton);
if ( radiobtn )
radiobtn->SetValue(event.GetChecked());
}
#endif // wxUSE_RADIOBTN
}
开发者ID:jonntd,项目名称:dynamica,代码行数:25,代码来源:ctrlcmn.cpp
示例12: PDF_EncodeText
int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const {
if (!m_pDocument) {
return -1;
}
CPDF_Dictionary* pPDFRoot = m_pDocument->GetRoot();
if (!pPDFRoot) {
return -1;
}
int nPages = m_pDocument->GetPageCount();
CFX_ByteString bsLbl;
CFX_ByteString bsOrig = bsLabel;
for (int i = 0; i < nPages; i++) {
bsLbl = PDF_EncodeText(GetLabel(i));
if (!bsLbl.Compare(bsOrig)) {
return i;
}
}
bsLbl = bsOrig;
int nPage = FXSYS_atoi(bsLbl);
if (nPage > 0 && nPage <= nPages) {
return nPage;
}
return -1;
}
开发者ID:andoma,项目名称:pdfium,代码行数:24,代码来源:doc_basic.cpp
示例13: padding
sf::Vector2f Button::CalculateRequisition() {
float padding( Context::Get().GetEngine().GetProperty<float>( "Padding", shared_from_this() ) );
float spacing( Context::Get().GetEngine().GetProperty<float>( "Spacing", shared_from_this() ) );
const std::string& font_name( Context::Get().GetEngine().GetProperty<std::string>( "FontName", shared_from_this() ) );
unsigned int font_size( Context::Get().GetEngine().GetProperty<unsigned int>( "FontSize", shared_from_this() ) );
const sf::Font& font( *Context::Get().GetEngine().GetResourceManager().GetFont( font_name ) );
auto requisition = Context::Get().GetEngine().GetTextMetrics( m_label, font, font_size );
requisition.y = Context::Get().GetEngine().GetFontLineHeight( font, font_size );
requisition.x += 2 * padding;
requisition.y += 2 * padding;
if( GetChild() ) {
requisition.x += GetChild()->GetRequisition().x;
requisition.y = std::max( requisition.y, GetChild()->GetRequisition().y + 2 * padding );
if( GetLabel().getSize() > 0 ) {
requisition.x += spacing;
}
}
return requisition;
}
开发者ID:Chiranjivee,项目名称:SFML-book,代码行数:24,代码来源:Button.cpp
示例14: GetLabel
wxString wxTopLevelWindowMSW::GetTitle() const
{
return GetLabel();
}
开发者ID:nwhitehead,项目名称:wxWidgets,代码行数:4,代码来源:toplevel.cpp
示例15: GetSize
void wxCustomButton::Paint( wxDC &dc )
{
#if (wxMINOR_VERSION<8)
dc.BeginDrawing();
#endif
int w, h;
GetSize(&w,&h);
wxColour foreColour = GetForegroundColour();
wxColour backColour = GetBackgroundColour();
if (m_focused)
{
backColour.Set( wxMin(backColour.Red() + 20, 255),
wxMin(backColour.Green() + 20, 255),
wxMin(backColour.Blue() + 20, 255) );
}
wxBitmap bitmap;
if (IsEnabled())
{
if (GetValue() && m_bmpSelected.Ok())
bitmap = m_bmpSelected;
else if (m_focused && m_bmpFocus.Ok())
bitmap = m_bmpFocus;
else if (m_bmpLabel.Ok())
bitmap = m_bmpLabel;
}
else
{
// try to create disabled if it doesn't exist
if (!m_bmpDisabled.Ok() && m_bmpLabel.Ok())
m_bmpDisabled = CreateBitmapDisabled(m_bmpLabel);
if (m_bmpDisabled.Ok())
bitmap = m_bmpDisabled;
else if (m_bmpLabel.Ok())
bitmap = m_bmpLabel;
foreColour = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT);
}
wxBrush brush(backColour, wxSOLID);
dc.SetBackground(brush);
dc.SetBrush(brush);
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRectangle(0, 0, w, h);
if (bitmap.Ok())
dc.DrawBitmap(bitmap, m_bitmapPos.x, m_bitmapPos.y, TRUE );
if (!GetLabel().IsEmpty())
{
dc.SetFont(GetFont());
dc.SetTextBackground(backColour);
dc.SetTextForeground(foreColour);
dc.DrawText(GetLabel(), m_labelPos.x, m_labelPos.y);
}
if (GetValue()) // draw sunken border
{
dc.SetPen(*wxGREY_PEN);
dc.DrawLine(0,h-1,0,0); dc.DrawLine(0,0,w,0);
dc.SetPen(*wxWHITE_PEN);
dc.DrawLine(w-1,1,w-1,h-1); dc.DrawLine(w-1,h-1,0,h-1);
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine(1,h-2,1,1); dc.DrawLine(1,1,w-1,1);
}
else if (((m_button_style & wxCUSTBUT_FLAT) == 0) || m_focused) // draw raised border
{
dc.SetPen(*wxWHITE_PEN);
dc.DrawLine(0,h-2,0,0); dc.DrawLine(0,0,w-1,0);
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine(w-1,0,w-1,h-1); dc.DrawLine(w-1,h-1,-1,h-1);
dc.SetPen(*wxGREY_PEN);
dc.DrawLine(2,h-2,w-2,h-2); dc.DrawLine(w-2,h-2,w-2,1);
}
dc.SetBackground(wxNullBrush);
dc.SetBrush(wxNullBrush);
dc.SetPen(wxNullPen);
#if (wxMINOR_VERSION<8)
dc.EndDrawing();
#endif
}
开发者ID:erelh,项目名称:gpac,代码行数:88,代码来源:menubtn.cpp
示例16: wxCHECK_MSG
bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
{
wxCHECK_MSG( aLayer == LAYER_NOTES || aLayer == LAYER_BUS || aLayer == LAYER_WIRE, false,
wxT( "Invalid layer type passed to SCH_SCREEN::IsTerminalPoint()." ) );
SCH_SHEET_PIN* label;
SCH_TEXT* text;
switch( aLayer )
{
case LAYER_BUS:
if( GetBus( aPosition ) )
return true;
label = GetSheetLabel( aPosition );
if( label && IsBusLabel( label->GetText() ) && label->IsConnected( aPosition ) )
return true;
text = GetLabel( aPosition );
if( text && IsBusLabel( text->GetText() ) && text->IsConnected( aPosition )
&& (text->Type() != SCH_LABEL_T) )
return true;
break;
case LAYER_NOTES:
if( GetLine( aPosition ) )
return true;
break;
case LAYER_WIRE:
if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_BUS_WIRE_ENTRY_T) )
return true;
if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_BUS_BUS_ENTRY_T) )
return true;
if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_JUNCTION_T ) )
return true;
if( GetPin( aPosition, NULL, true ) )
return true;
if( GetWire( aPosition ) )
return true;
text = GetLabel( aPosition );
if( text && text->IsConnected( aPosition ) && !IsBusLabel( text->GetText() ) )
return true;
label = GetSheetLabel( aPosition );
if( label && label->IsConnected( aPosition ) && !IsBusLabel( label->GetText() ) )
return true;
break;
default:
break;
}
return false;
}
开发者ID:hzeller,项目名称:kicad-source-mirror,代码行数:69,代码来源:sch_screen.cpp
示例17: GetBestSize
//.........这里部分代码省略.........
}
#else // XP version
wxUxThemeEngine *themeEngine = wxUxThemeEngine::GetIfActive();
if ( !themeEngine )
return false;
wxUxThemeHandle theme(this, L"BUTTON");
if ( !theme )
return false;
int state;
switch ( Get3StateValue() )
{
case wxCHK_CHECKED:
state = CBS_CHECKEDNORMAL;
break;
case wxCHK_UNDETERMINED:
state = CBS_MIXEDNORMAL;
break;
default:
wxFAIL_MSG( _T("unexpected Get3StateValue() return value") );
// fall through
case wxCHK_UNCHECKED:
state = CBS_UNCHECKEDNORMAL;
break;
}
if ( !IsEnabled() )
state += CBS_DISABLED_OFFSET;
else if ( m_isPressed )
state += CBS_PRESSED_OFFSET;
else if ( m_isHot )
state += CBS_HOT_OFFSET;
HRESULT hr = themeEngine->DrawThemeBackground
(
theme,
hdc,
BP_CHECKBOX,
state,
&rectCheck,
NULL
);
if ( FAILED(hr) )
{
wxLogApiError(_T("DrawThemeBackground(BP_CHECKBOX)"), hr);
}
#endif // 0/1
// draw the text
const wxString& label = GetLabel();
// first we need to measure it
UINT fmt = DT_NOCLIP;
// drawing underlying doesn't look well with focus rect (and the native
// control doesn't do it)
if ( isFocused )
fmt |= DT_HIDEPREFIX;
if ( isRightAligned )
fmt |= DT_RIGHT;
// TODO: also use DT_HIDEPREFIX if the system is configured so
// we need to get the label real size first if we have to draw a focus rect
// around it
if ( isFocused )
{
if ( !::DrawText(hdc, label, label.length(), &rectLabel,
fmt | DT_CALCRECT) )
{
wxLogLastError(_T("DrawText(DT_CALCRECT)"));
}
}
if ( !IsEnabled() )
{
::SetTextColor(hdc, ::GetSysColor(COLOR_GRAYTEXT));
}
if ( !::DrawText(hdc, label, label.length(), &rectLabel, fmt) )
{
wxLogLastError(_T("DrawText()"));
}
// finally draw the focus
if ( isFocused )
{
rectLabel.left--;
rectLabel.right++;
if ( !::DrawFocusRect(hdc, &rectLabel) )
{
wxLogLastError(_T("DrawFocusRect()"));
}
}
return true;
}
开发者ID:EdgarTx,项目名称:wx,代码行数:101,代码来源:checkbox.cpp
示例18: GetSize
void wxCustomButton::Paint( wxDC &dc )
{
int w, h;
GetSize(&w,&h);
wxColour foreColour = GetForegroundColour();
wxColour backColour = GetBackgroundColour();
if (m_focused)
{
backColour.Set( wxMin(backColour.Red() + 20, 255),
wxMin(backColour.Green() + 20, 255),
wxMin(backColour.Blue() + 20, 255) );
}
wxBitmap bitmap;
if (IsEnabled())
{
if (GetValue() && m_bmpSelected.Ok())
bitmap = m_bmpSelected;
else if (m_focused && m_bmpFocus.Ok())
bitmap = m_bmpFocus;
else if (m_bmpLabel.Ok())
bitmap = m_bmpLabel;
}
else
{
// try to create disabled if it doesn't exist
if (!m_bmpDisabled.Ok() && m_bmpLabel.Ok())
m_bmpDisabled = CreateBitmapDisabled(m_bmpLabel);
if (m_bmpDisabled.Ok())
bitmap = m_bmpDisabled;
else if (m_bmpLabel.Ok())
bitmap = m_bmpLabel;
foreColour = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT);
}
#if wxCHECK_VERSION(2, 8, 0)
// wxCONTROL_DISABLED
//flags may have the wxCONTROL_PRESSED, wxCONTROL_CURRENT or wxCONTROL_ISDEFAULT
int ren_flags = 0;
if (GetValue())
ren_flags |= wxCONTROL_PRESSED;
if (m_focused)
ren_flags |= wxCONTROL_CURRENT;
if (!IsEnabled())
ren_flags |= wxCONTROL_DISABLED;
wxRendererNative::Get().DrawPushButton(this, dc, wxRect(0, 0, w, h), ren_flags);
#else
wxBrush brush(backColour, wxSOLID);
dc.SetBackground(brush);
dc.SetBrush(brush);
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRectangle(0, 0, w, h);
#endif // !wxCHECK_VERSION(2, 8, 0)
if (bitmap.Ok())
dc.DrawBitmap(bitmap, m_bitmapPos.x, m_bitmapPos.y, true );
if (!GetLabel().IsEmpty())
{
dc.SetFont(GetFont());
dc.SetTextBackground(backColour);
dc.SetTextForeground(foreColour);
dc.DrawText(GetLabel(), m_labelPos.x, m_labelPos.y);
}
#if !wxCHECK_VERSION(2, 8, 0)
if (GetValue()) // draw sunken border
{
dc.SetPen(*wxGREY_PEN);
dc.DrawLine(0,h-1,0,0); dc.DrawLine(0,0,w,0);
dc.SetPen(*wxWHITE_PEN);
dc.DrawLine(w-1,1,w-1,h-1); dc.DrawLine(w-1,h-1,0,h-1);
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine(1,h-2,1,1); dc.DrawLine(1,1,w-1,1);
}
else if (((m_button_style & wxCUSTBUT_FLAT) == 0) || m_focused) // draw raised border
{
dc.SetPen(*wxWHITE_PEN);
dc.DrawLine(0,h-2,0,0); dc.DrawLine(0,0,w-1,0);
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine(w-1,0,w-1,h-1); dc.DrawLine(w-1,h-1,-1,h-1);
dc.SetPen(*wxGREY_PEN);
dc.DrawLine(2,h-2,w-2,h-2); dc.DrawLine(w-2,h-2,w-2,1);
}
#endif // !wxCHECK_VERSION(2, 8, 0)
dc.SetBackground(wxNullBrush);
dc.SetBrush(wxNullBrush);
//.........这里部分代码省略.........
开发者ID:SamanthaClark,项目名称:UI-Builder,代码行数:101,代码来源:toggle.cpp
示例19: GetLabel
int ChargedHiggsQCDPurity::analyze(Event*e,string systname)
{
#ifdef VERBOSE
if (VERBOSE >0 ) cout<<"[ChargedHiggsQCDPurity]::[analyze]::[DEBUG1] start analyze event"<<endl;
#endif
string label = GetLabel(e);
// do not distinguish between data and mc,
// so we can run closures
// Fill Real Iso
Tau *t = e->GetTau(0);
// Fill Inverted Iso
Tau *tInv = e->GetTauInvIso(0);
e->ApplyTopReweight();
e->ApplyWReweight();
#ifdef VERBOSE
if (VERBOSE >0 ) cout<<"[ChargedHiggsQCDPurity]::[analyze]::[DEBUG1] is Tau? "<< (t==NULL) <<endl;
if (VERBOSE >0 ) cout<<"[ChargedHiggsQCDPurity]::[analyze]::[DEBUG1] is TauInv? "<< (tInv == NULL)<<endl;
#endif
// --- take the selection from the tau nu analysis
CutSelector direct;
direct.SetMask(ChargedHiggsTauNu::MaxCut-1);
direct.SetCut(ChargedHiggsTauNu::Selection(e,true,false,is80X,isLightMass));
CutSelector inverse;
inverse.SetMask(ChargedHiggsTauNu::MaxCut-1);
inverse.SetCut(ChargedHiggsTauNu::Selection(e,false,false,is80X,isLightMass));
// TODO:
// * what do I do with event with a Tau and an Inv tau? -> DY ?
// * put a limit on the TauInv sideband ? 3.0 -20 GeV
bool passDirectLoose=direct.passAllUpTo(ChargedHiggsTauNu::ThreeJets);
bool passInverseLoose=inverse.passAllUpTo(ChargedHiggsTauNu::ThreeJets);
// bool passDirectLoose=direct.passAllUpTo(ChargedHiggsTauNu::OneBjet);
// bool passInverseLoose=inverse.passAllUpTo(ChargedHiggsTauNu::OneBjet);
//#warning QCD BJets
//LogN(__FUNCTION__,"WARNING","ONE B REQUIRED FOR QCD LOOSE",10);
// check minimal selection: Three bjets
if ( not passDirectLoose
and not passInverseLoose
) return EVENT_NOT_USED;
bool passPrescale=false;
if(e->GetWeight()->GetMC().find("ST") != string::npos || e->GetWeight()->GetMC().find("WZ") != string::npos || e->GetWeight()->GetMC().find("WW") != string::npos || e->GetWeight()->GetMC().find("ZZ") != string::npos) {
passPrescale=true; // set trigger, but apply SF!
// Met SF only for pT > 20 (only for MC)
string metLegSF = "metLegData";
if(not e->ExistSF(metLegSF)) Log(__FUNCTION__,"WARING" ,"No Tau metLeg SF");
else if(e->GetMet().Pt()>20 and not e->IsRealData()) {
e->SetPtEtaSF(metLegSF, e->GetMet().Pt(), 0);
e->ApplySF(metLegSF);
}
}
else {
// Apply MET leg SF (only on MC)
// NEGLECT IT
/*
string metLegSF = "metLeg";
if(not e->ExistSF(metLegSF)) Log(__FUNCTION__,"WARING" ,"No Tau metLeg SF");
else if(e->GetMet().Pt()>20 and not e->IsRealData()) {
e->SetPtEtaSF(metLegSF, e->GetMet().Pt(), 0);
e->ApplySF(metLegSF);
}
*/
if(e->IsTriggered("HLT_LooseIsoPFTau50_Trk30_eta2p1_MET90")) passPrescale=true;
}
// USE PRESCALE PATH ONLY FOR THE "inclusive/Loose" selection
//bool passPrescale=false;
//if (not e->IsRealData()) passPrescale=true;
//if ( e->IsTriggered("HLT_LooseIsoPFTau50_Trk30_eta2p1_v") ) passPrescale=true;
//#warning MET80 TRigger in QCD
//if ( e->IsTriggered("HLT_LooseIsoPFTau50_Trk30_eta2p1_MET90") ) passPrescale=true;
//LogN(__FUNCTION__,"WARNING","MET 80 in QCD Loose",10);
//
//bool passMatchDirect=true;
//bool passMatchInverse=true;
#warning Tau Match
bool passMatchDirect=false;
bool passMatchInverse=false;
if (e->IsRealData()) { passMatchDirect=true; passMatchInverse=true;}
else {
if (e->GetTau(0) !=NULL and e->GetTau(0)->Rematch(e)==15) passMatchDirect=true;
if (e->GetTauInvIso(0) !=NULL and e->GetTauInvIso(0)->Rematch(e)==15) passMatchInverse=true;
}
//.........这里部分代码省略.........
开发者ID:jeyserma,项目名称:ChargedHiggs,代码行数:101,代码来源:AnalysisChargedHiggsQCDPurity.cpp
示例20: GetModel
void SpaceStation::LoadFromJson(const Json::Value &jsonObj, Space *space)
{
ModelBody::LoadFromJson(jsonObj, space);
GetModel()->SetLabel(GetLabel());
if (!jsonObj.isMember("space_station")) throw SavedGameCorruptException();
Json::Value spaceStationObj = jsonObj["space_station"];
if (!spaceStationObj.isMember("ship_docking")) throw SavedGameCorruptException();
if (!spaceStationObj.isMember("ports")) throw SavedGameCorruptException();
if (!spaceStationObj.isMember("index_for_system_body")) throw SavedGameCorruptException();
if (!spaceStationObj.isMember("door_animation_step")) throw SavedGameCorruptException();
if (!spaceStationObj.isMember("door_animation_state")) throw SavedGameCorruptException();
m_oldAngDisplacement = 0.0;
Json::Value shipDockingArray = spaceStationObj["ship_docking"];
if (!shipDockingArray.isArray()) throw SavedGameCorruptException();
m_shipDocking.reserve(shipDockingArray.size());
for (Uint32 i = 0; i < shipDockingArray.size(); i++)
{
m_shipDocking.push_back(shipDocking_t());
shipDocking_t &sd = m_shipDocking.back();
Json::Value shipDockingArrayEl = shipDockingArray[i];
if (!shipDockingArrayEl.isMember("index_for_body")) throw SavedGameCorruptException();
if (!shipDockingArrayEl.isMember("stage")) throw SavedGameCorruptException();
if (!shipDockingArrayEl.isMember("stage_pos")) throw SavedGameCorruptException();
if (!shipDockingArrayEl.isMember("from_pos")) throw SavedGameCorruptException();
if (!shipDockingArrayEl.isMember("from_rot")) throw SavedGameCorruptException();
sd.shipIndex = shipDockingArrayEl["index_for_body"].asInt();
sd.stage = shipDockingArrayEl["stage"].asInt();
sd.stagePos = StrToDouble(shipDockingArrayEl["stage_pos"].asString()); // For some reason stagePos was saved as a float in pre-JSON system (saved & loaded as double here).
JsonToVector(&(sd.fromPos), shipDockingArrayEl, "from_pos");
JsonToQuaternion(&(sd.fromRot), shipDockingArrayEl, "from_rot");
}
// retrieve each of the port details and bay IDs
Json::Value portArray = spaceStationObj["ports"];
if (!portArray.isArray()) throw SavedGameCorruptException();
m_ports.reserve(portArray.size());
for (Uint32 i = 0; i < portArray.size(); i++)
{
m_ports.push_back(SpaceStationType::SPort());
SpaceStationType::SPort &port = m_ports.back();
Json::Value portArrayEl = portArray[i];
if (!portArrayEl.isMember("min_ship_size")) throw SavedGameCorruptException();
if (!portArrayEl.isMember("max_ship_size")) throw SavedGameCorruptException();
if (!portArrayEl.isMember("in_use")) throw SavedGameCorruptException();
if (!portArrayEl.isMember("bays")) throw SavedGameCorruptException();
port.minShipSize = portArrayEl["min_ship_size"].asInt();
port.maxShipSize = portArrayEl["max_ship_size"].asInt();
port.inUse = portArrayEl["in_use"].asBool();
Json::Value bayArray = portArrayEl["bays"];
if (!bayArray.isArray()) throw SavedGameCorruptException();
port.bayIDs.reserve(bayArray.size());
for (Uint32 j = 0; j < bayArray.size(); j++)
{
Json::Value bayArrayEl = bayArray[j];
if (!bayArrayEl.isMember("bay_id")) throw SavedGameCorruptException();
if (!bayArrayEl.isMember("name")) throw SavedGameCorruptException();
port.bayIDs.push_back(std::make_pair(bayArrayEl["bay_id"].asInt(), bayArrayEl["name"].asString()));
}
}
m_sbody = space->GetSystemBodyByIndex(spaceStationObj["index_for_system_body"].asUInt());
m_doorAnimationStep = StrToDouble(spaceStationObj["door_animation_step"].asString());
m_doorAnimationState = StrToDouble(spaceStationObj["door_animation_state"].asString());
InitStation();
m_navLights->LoadFromJson(spaceStationObj);
}
开发者ID:christiank,项目名称:pioneer,代码行数:79,代码来源:SpaceStation.cpp
注:本文中的GetLabel函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论