这篇教程C++ GetLabel函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetLabel函数的典型用法代码示例。如果您正苦于以下问题:C++ GetLabel函数的具体用法?C++ GetLabel怎么用?C++ GetLabel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetLabel函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetLabelwxSize 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,
示例2: XtVaGetValueswxSize 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,
示例3: assertvoid 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,
示例4: GetSrclangvoidHTMLTrackElement::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,
示例5: PyMac_PRECHECKstatic 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,
示例6: RegenerateTooltipsvoid 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,
示例7: cvCreateMatCvMat* 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,
示例8: suffixvoid 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,
示例9: wxASSERT//// Returns the value to be presented to accessibility//// Current, the command and key are both provided.//wxStringKeyView::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,
示例10: StackPushstd::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,
示例11: DoUpdateWindowUI// wxControl-specific processing after processing the update eventvoid 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,
示例12: PDF_EncodeTextint32_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,
示例13: paddingsf::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,
示例14: GetLabelwxString wxTopLevelWindowMSW::GetTitle() const{ return GetLabel();}
开发者ID:nwhitehead,项目名称:wxWidgets,代码行数:4,
示例15: GetSizevoid 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,
示例16: wxCHECK_MSGbool 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,
示例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,
示例18: GetSizevoid 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,
示例19: GetLabelint 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,
示例20: GetModelvoid 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,
示例21: GetX//.........这里部分代码省略......... int subtractThis = 0; if (GetColPosition() > 0) tabBeneath = m_view->FindTabControlForPosition(GetColPosition() - 1, GetRowPosition() + 1); if (tabBeneath && tabBeneath->IsSelected()) subtractThis = (m_view->GetTabSelectionHeight() - m_view->GetTabHeight());#ifdef __WXMOTIF__ subtractThis += 1;#endif // Draw only to next tab down. dc.DrawLine((tabX + GetWidth()), tabY, (tabX + GetWidth()), (tabY + GetHeight() + tabHeightInc - subtractThis)); // Draw black line to emphasize shadow dc.SetPen(*wxBLACK_PEN); dc.DrawLine((tabX + GetWidth() + 1), (tabY+1), (tabX + GetWidth() + 1), (tabY + GetHeight() + tabHeightInc - subtractThis)); } } // Draw centered text int textY = tabY + m_view->GetVerticalTabTextSpacing() + tabHeightInc; if (m_isSelected) dc.SetFont(* m_view->GetSelectedTabFont()); else dc.SetFont(* GetFont()); wxColour col(m_view->GetTextColour()); dc.SetTextForeground(col); dc.SetBackgroundMode(wxTRANSPARENT); wxCoord textWidth, textHeight; dc.GetTextExtent(GetLabel(), &textWidth, &textHeight); int textX = (int)(tabX + (GetWidth() - textWidth)/2.0); if (textX < (tabX + 2)) textX = (tabX + 2); dc.SetClippingRegion(tabX, tabY, GetWidth(), GetHeight()); dc.DrawText(GetLabel(), textX, textY); dc.DestroyClippingRegion(); if (m_isSelected) { dc.SetPen(*m_view->GetHighlightPen()); // Draw white highlight from the tab's left side to the left hand edge of the view dc.DrawLine(m_view->GetViewRect().x, (tabY + GetHeight() + tabHeightInc), tabX, (tabY + GetHeight() + tabHeightInc)); // Draw white highlight from the tab's right side to the right hand edge of the view dc.DrawLine((tabX + GetWidth()), (tabY + GetHeight() + tabHeightInc), m_view->GetViewRect().x + m_view->GetViewRect().width, (tabY + GetHeight() + tabHeightInc)); }#else // New HEL version with rounder tabs if (!m_view) return; int tabInc = 0; if (m_isSelected) { tabInc = m_view->GetTabSelectionHeight() - m_view->GetTabHeight(); } int tabLeft = GetX() + m_view->GetViewRect().x;
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:67,
示例22: GetLmrObjParams// Renders space station and adjacent city if applicable// For orbital starports: renders as normal// For surface starports: // Lighting: Calculates available light for model and splits light between directly and ambiently lit// Lighting is done by manipulating global lights or setting uniforms in atmospheric models shader// Adds an ambient light at close ranges if dark by manipulating the global ambient levelvoid SpaceStation::Render(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform){ LmrObjParams ¶ms = GetLmrObjParams(); params.label = GetLabel().c_str(); SetLmrTimeParams(); for (int i=0; i<MAX_DOCKING_PORTS; i++) { params.animStages[ANIM_DOCKING_BAY_1 + i] = m_shipDocking[i].stage; params.animValues[ANIM_DOCKING_BAY_1 + i] = m_shipDocking[i].stagePos; } Body *b = GetFrame()->m_astroBody; assert(b); if (!b->IsType(Object::PLANET)) { // orbital spaceport -- don't make city turds or change lighting based on atmosphere RenderLmrModel(r, viewCoords, viewTransform); } else { Planet *planet = static_cast<Planet*>(b); // calculate lighting // available light is calculated and split between directly (diffusely/specularly) lit and ambiently lit const std::vector<Camera::LightSource> &lightSources = camera->GetLightSources(); double ambient, intensity; CalcLighting(planet, ambient, intensity, lightSources); std::vector<Graphics::Light> origLights, newLights; for(size_t i = 0; i < lightSources.size(); i++) { Graphics::Light light(lightSources[i].GetLight()); origLights.push_back(light); Color c = light.GetDiffuse(); Color ca = light.GetAmbient(); Color cs = light.GetSpecular(); ca.r = c.r * float(ambient); ca.g = c.g * float(ambient); ca.b = c.b * float(ambient); c.r*=float(intensity); c.g*=float(intensity); c.b*=float(intensity); cs.r*=float(intensity); cs.g*=float(intensity); cs.b*=float(intensity); light.SetDiffuse(c); light.SetAmbient(ca); light.SetSpecular(cs); newLights.push_back(light); } r->SetLights(newLights.size(), &newLights[0]); double overallLighting = ambient+intensity; // turn off global ambient color const Color oldAmbient = r->GetAmbientColor(); r->SetAmbientColor(Color::BLACK); // as the camera gets close adjust scene ambient so that intensity+ambient = minIllumination double fadeInEnd, fadeInLength, minIllumination; if (Graphics::AreShadersEnabled()) { minIllumination = 0.125; fadeInEnd = 800.0; fadeInLength = 2000.0; } else { minIllumination = 0.25; fadeInEnd = 1500.0; fadeInLength = 3000.0; } /* don't render city if too far away */ if (viewCoords.Length() < 1000000.0){ r->SetAmbientColor(Color::BLACK); if (!m_adjacentCity) { m_adjacentCity = new CityOnPlanet(planet, this, m_sbody->seed); } m_adjacentCity->Render(r, camera, this, viewCoords, viewTransform, overallLighting, minIllumination); } r->SetAmbientColor(Color::BLACK); FadeInModelIfDark(r, GetCollMesh()->GetBoundingRadius(), viewCoords.Length(), fadeInEnd, fadeInLength, overallLighting, minIllumination); RenderLmrModel(r, viewCoords, viewTransform); // restore old lights r->SetLights(origLights.size(), &origLights[0]);//.........这里部分代码省略.........
开发者ID:Nikoraito,项目名称:pioneer,代码行数:101,
示例23: GetLabelstd::string CGUISpinControlEx::GetDescription() const{ return StringUtils::Format("%s (%s)", m_buttonControl.GetDescription().c_str(), GetLabel().c_str());}
开发者ID:68foxboris,项目名称:xbmc,代码行数:4,
示例24: GetSizer//.........这里部分代码省略......... wxSizer *pMainSizer = GetSizer(); if(m_pButtonsSizer) { FindWindow(wxID_OK)->Hide(); FindWindow(wxID_CANCEL)->Hide(); pMainSizer->Detach(m_pButtonsSizer); } pMainSizer->Add(new wxStaticLine(this), 0, wxEXPAND | wxALL, 4); wxGauge *pProgressBar = new wxGauge(this, wxID_ANY, 1, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL | wxGA_SMOOTH); wxStaticText *pCurrentItem = new wxStaticText(this, wxID_ANY, L"Initialising extraction..."); pMainSizer->Add(pProgressBar, 0, wxEXPAND | wxALL, 2); pMainSizer->Add(pCurrentItem, 0, wxEXPAND | wxALL, 2); pMainSizer->RecalcSizes(); SetSize(pMainSizer->GetMinSize()); Layout(); ::wxSafeYield(this); int iTotalCount = 1, iDoneCount = 0; std::queue<IDirectory*> qTodo; try { qTodo.push(m_pArchive->openDirectory(m_sPathToExtract)); iTotalCount += static_cast<int>(qTodo.front()->getItemCount()); size_t iSkipLength = qTodo.front()->getPath().length(); pProgressBar->SetRange(iTotalCount); while(!qTodo.empty()) { IDirectory *pDirectory = qTodo.front(); pCurrentItem->SetLabel(pDirectory->getPath()); pProgressBar->SetValue(++iDoneCount); ::wxSafeYield(this); RainString sDirectoryBase = pDirectory->getPath(); sDirectoryBase = sFolder + sDirectoryBase.mid(iSkipLength, sDirectoryBase.length() - iSkipLength); if(!RainDoesDirectoryExist(sDirectoryBase)) RainCreateDirectory(sDirectoryBase); for(IDirectory::iterator itr = pDirectory->begin(), itrEnd = pDirectory->end(); itr != itrEnd; ++itr) { if(itr->isDirectory()) { IDirectory *pChild = itr->open(); iTotalCount += 1 + static_cast<int>(pChild->getItemCount()); qTodo.push(pChild); pProgressBar->SetRange(iTotalCount); } else { std::auto_ptr<IFile> pFile; pCurrentItem->SetLabel(pDirectory->getPath() + itr->name()); pProgressBar->SetValue(++iDoneCount); ::wxSafeYield(this); pFile.reset(RainOpenFile(sDirectoryBase + itr->name(), FM_Write)); itr->pump(&*pFile); } } delete pDirectory; qTodo.pop(); } } catch(RainException *pE) { while(!qTodo.empty()) { delete qTodo.front(); qTodo.pop(); } EXCEPTION_MESSAGE_BOX_1(L"Error extracting directory /'%s/'", m_sPathToExtract.getCharacters(), pE); SetReturnCode(GetEscapeId()); return; } } else { wxFileName oFilename(m_pDestinationPath->GetValue()); RainString sFolder = oFilename.GetPath(); IFile *pFile = 0; try { if(!_ensureDirectoryExists(sFolder)) return; pFile = RainOpenFile(m_pDestinationPath->GetValue(), FM_Write); m_pArchive->pumpFile(m_sPathToExtract, pFile); } catch(RainException *pE) { delete pFile; EXCEPTION_MESSAGE_BOX_1(L"Error extracting /'%s/'", m_sPathToExtract.getCharacters(), pE); return; } delete pFile; } wxString sMessage = L"Extracted " + m_sPathToExtract; if(m_pPositiveResultNoficiationBar) m_pPositiveResultNoficiationBar->SetStatusText(sMessage); else ::wxMessageBox(sMessage, GetLabel(), wxOK | wxCENTER | wxICON_INFORMATION, this); EndModal(GetAffirmativeId());}
开发者ID:lkdd,项目名称:modstudio2,代码行数:101,
示例25: dcwxSize wxGenericHyperlinkCtrl::DoGetBestClientSize() const{ wxClientDC dc((wxWindow *)this); return dc.GetTextExtent(GetLabel());}
开发者ID:CustomCardsOnline,项目名称:wxWidgets,代码行数:5,
示例26: DockingUpdatevoid SpaceStation::DockingUpdate(const double timeStep){ vector3d p1, p2, zaxis; for (Uint32 i=0; i<m_shipDocking.size(); i++) { shipDocking_t &dt = m_shipDocking[i]; if (!dt.ship) continue; // docked stage is m_type->NumDockingPorts() + 1 => ship docked if (dt.stage > m_type->NumDockingStages()) continue; double stageDuration = (dt.stage > 0 ? m_type->GetDockAnimStageDuration(dt.stage-1) : m_type->GetUndockAnimStageDuration(abs(dt.stage)-1)); dt.stagePos += timeStep / stageDuration; if (dt.stage == 1) { // SPECIAL stage! Docking granted but waiting for ship to dock m_doorAnimationStep = 0.3; // open door if (dt.stagePos >= 1.0) { if (dt.ship == Pi::player) Pi::game->log->Add(GetLabel(), Lang::DOCKING_CLEARANCE_EXPIRED); dt.ship = 0; dt.stage = 0; m_doorAnimationStep = -0.3; // close door } continue; } if (dt.stagePos > 1.0) { // use end position of last segment for start position of new segment SpaceStationType::positionOrient_t dport; PiVerify(m_type->GetDockAnimPositionOrient(i, dt.stage, 1.0f, dt.fromPos, dport, dt.ship)); matrix3x3d fromRot = matrix3x3d::FromVectors(dport.xaxis, dport.yaxis, dport.zaxis); dt.fromRot = Quaterniond::FromMatrix3x3(fromRot); dt.fromPos = dport.pos; // transition between docking stages dt.stagePos = 0; if (dt.stage >= 0) dt.stage++; else dt.stage--; } if (dt.stage < -m_type->ShipLaunchStage() && dt.ship->GetFlightState() != Ship::FLYING) { // launch ship dt.ship->SetFlightState(Ship::FLYING); dt.ship->SetAngVelocity(GetAngVelocity()); if (m_type->IsSurfaceStation()) { dt.ship->SetThrusterState(1, 1.0); // up } else { dt.ship->SetThrusterState(2, -1.0); // forward } LuaEvent::Queue("onShipUndocked", dt.ship, this); } if (dt.stage < -m_type->NumUndockStages()) { // undock animation finished, clear port dt.stage = 0; dt.ship = 0; LockPort(i, false); m_doorAnimationStep = -0.3; // close door } else if (dt.stage > m_type->NumDockingStages()) { // set docked dt.ship->SetDockedWith(this, i); LuaEvent::Queue("onShipDocked", dt.ship, this); LockPort(i, false); m_doorAnimationStep = -0.3; // close door } } m_doorAnimationState = Clamp(m_doorAnimationState + m_doorAnimationStep*timeStep, 0.0, 1.0); if (m_doorAnimation) m_doorAnimation->SetProgress(m_doorAnimationState);}
开发者ID:christiank,项目名称:pioneer,代码行数:74,
示例27: marker_timesC3DFileAdapter::OutputTablesC3DFileAdapter::extendRead(const std::string& fileName) const { auto reader = btk::AcquisitionFileReader::New(); reader->SetFilename(fileName); reader->Update(); auto acquisition = reader->GetOutput(); EventTable event_table{}; auto events = acquisition->GetEvents(); for (auto it = events->Begin(); it != events->End(); ++it) { auto et = *it; event_table.push_back({ et->GetLabel(), et->GetTime(), et->GetFrame(), et->GetDescription() }); } OutputTables tables{}; auto marker_pts = btk::PointCollection::New(); for(auto it = acquisition->BeginPoint(); it != acquisition->EndPoint(); ++it) { auto pt = *it; if(pt->GetType() == btk::Point::Marker) marker_pts->InsertItem(pt); } if(marker_pts->GetItemNumber() != 0) { int marker_nrow = marker_pts->GetFrontItem()->GetFrameNumber(); int marker_ncol = marker_pts->GetItemNumber(); std::vector<double> marker_times(marker_nrow); SimTK::Matrix_<SimTK::Vec3> marker_matrix(marker_nrow, marker_ncol); std::vector<std::string> marker_labels{}; for (auto it = marker_pts->Begin(); it != marker_pts->End(); ++it) { marker_labels.push_back(SimTK::Value<std::string>((*it)->GetLabel())); } double time_step{1.0 / acquisition->GetPointFrequency()}; for(int f = 0; f < marker_nrow; ++f) { SimTK::RowVector_<SimTK::Vec3> row{ marker_pts->GetItemNumber(), SimTK::Vec3(SimTK::NaN) }; int m{0}; for(auto it = marker_pts->Begin(); it != marker_pts->End(); ++it) { auto pt = *it; // BTK reads empty values as zero, but sets a "residual" value // to -1 and it is how it knows to export these values as // blank, instead of 0, when exporting to .trc // See: BTKCore/Code/IO/btkTRCFileIO.cpp#L359-L360 // Read in value if it is not zero or residual is not -1 if (!pt->GetValues().row(f).isZero() || //not precisely zero (pt->GetResiduals().coeff(f) != -1) ) {//residual is not -1 row[m] = SimTK::Vec3{ pt->GetValues().coeff(f, 0), pt->GetValues().coeff(f, 1), pt->GetValues().coeff(f, 2) }; } ++m; } marker_matrix.updRow(f) = row; marker_times[f] = 0 + f * time_step; //TODO: 0 should be start_time } // Create the data auto marker_table = std::make_shared<TimeSeriesTableVec3>(marker_times, marker_matrix, marker_labels); marker_table-> updTableMetaData(). setValueForKey("DataRate", std::to_string(acquisition->GetPointFrequency())); marker_table-> updTableMetaData(). setValueForKey("Units", acquisition->GetPointUnit()); marker_table->updTableMetaData().setValueForKey("events", event_table); tables.emplace(_markers, marker_table); } // This is probably the right way to get the raw forces data from force // platforms. Extract the collection of force platforms. auto force_platforms_extractor = btk::ForcePlatformsExtractor::New(); force_platforms_extractor->SetInput(acquisition); auto force_platform_collection = force_platforms_extractor->GetOutput(); force_platforms_extractor->Update(); std::vector<SimTK::Matrix_<double>> fpCalMatrices{}; std::vector<SimTK::Matrix_<double>> fpCorners{}; std::vector<SimTK::Matrix_<double>> fpOrigins{};//.........这里部分代码省略.........
开发者ID:antoinefalisse,项目名称:opensim-core,代码行数:101,
示例28: GetLabelCStdString CGUISpinControlEx::GetDescription() const{ CStdString strLabel; strLabel.Format("%s (%s)", m_buttonControl.GetDescription(), GetLabel()); return strLabel;}
开发者ID:AaronDnz,项目名称:xbmc,代码行数:6,
示例29: GetBestSizebool wxCheckBox::MSWOnDraw(WXDRAWITEMSTRUCT *item){ DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)item; if ( !IsOwnerDrawn() || dis->CtlType != ODT_BUTTON ) return wxCheckBoxBase::MSWOnDraw(item); // calculate the rectangles for the check mark itself and the label HDC hdc = dis->hDC; RECT& rect = dis->rcItem; RECT rectCheck, rectLabel; rectLabel.top = rect.top + (rect.bottom - rect.top - GetBestSize().y) / 2; rectLabel.bottom = rectLabel.top + GetBestSize().y; const int MARGIN = 3; const int CXMENUCHECK = ::GetSystemMetrics(SM_CXMENUCHECK); // the space between the checkbox and the label is included in the // check-mark bitmap const int checkSize = wxMin(CXMENUCHECK - MARGIN, GetSize().y); rectCheck.top = rect.top + (rect.bottom - rect.top - checkSize) / 2; rectCheck.bottom = rectCheck.top + checkSize; const bool isRightAligned = HasFlag(wxALIGN_RIGHT); if ( isRightAligned ) { rectLabel.right = rect.right - CXMENUCHECK; rectLabel.left = rect.left; rectCheck.left = rectLabel.right + ( CXMENUCHECK + MARGIN - checkSize ) / 2; rectCheck.right = rectCheck.left + checkSize; } else // normal, left-aligned checkbox { rectCheck.left = rect.left + ( CXMENUCHECK - MARGIN - checkSize ) / 2; rectCheck.right = rectCheck.left + checkSize; rectLabel.left = rect.left + CXMENUCHECK; rectLabel.right = rect.right; } // shall we draw a focus rect? const bool isFocused = m_isPressed || FindFocus() == this; // draw the checkbox itself wxDCTemp dc(hdc); int flags = 0; if ( !IsEnabled() ) flags |= wxCONTROL_DISABLED; switch ( Get3StateValue() ) { case wxCHK_CHECKED: flags |= wxCONTROL_CHECKED; break; case wxCHK_UNDETERMINED: flags |= wxCONTROL_PRESSED; break; default: wxFAIL_MSG( wxT("unexpected Get3StateValue() return value") ); // fall through case wxCHK_UNCHECKED: // no extra styles needed break; } if ( wxFindWindowAtPoint(wxGetMousePosition()) == this ) flags |= wxCONTROL_CURRENT; wxRendererNative::Get(). DrawCheckBox(this, dc, wxRectFromRECT(rectCheck), flags); // 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 ) { RECT oldLabelRect = rectLabel; // needed if right aligned if ( !::DrawText(hdc, label.t_str(), label.length(), &rectLabel, fmt | DT_CALCRECT) ) { wxLogLastError(wxT("DrawText(DT_CALCRECT)")); }//.........这里部分代码省略.........
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:101,
注:本文中的GetLabel函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetLanguage函数代码示例 C++ GetKrick函数代码示例 |