void CheckBox::OnMouseReleased(const Event::MouseButtonEvent& mouse) { if (mouse.Button == Mouse::Left) { if (mChecked) { mChecked = false; LoadStyle(GetDefaultStyle()); } else { mChecked = true; LoadStyle(GetDefaultStyle() + "_Checked"); } } }
Label::Label(const Unicode::Text& caption) : Widget(), mCaption(caption, Font::GetDefaultFont(), 30.f) { SetDefaultStyle("BI_Label"); LoadStyle(GetDefaultStyle()); }
Doc_Stc::Doc_Stc(const wxString & file) { Create (Manager::Get()->GetDocManager()->GetWindow(), wxID_ANY); LoadStyle(); if (file.Len() && ::wxFileExists(file)) LoadFile (file); }
GridDecorator::GridDecorator() : Icon() { SetDefaultStyle("BI_GridDecorator"); LoadStyle(GetDefaultStyle()); for (unsigned int i = Align::TOP_LEFT; i <= Align::BOTTOM_RIGHT; ++i) Add(&mIcons[i]); }
void Widget::LoadStyle(const std::string& style) { ResourceManager* rm = ResourceManager::Get(); StyleProperties& properties = rm->GetStyle(style); if (properties["from"] != "") LoadStyle(properties["from"]); SetX(rm->GetValue(properties["x"], GetPosition().x)); SetY(rm->GetValue(properties["y"], GetPosition().y)); mAlignOffset.x = rm->GetValue(properties["x"], mAlignOffset.x); mAlignOffset.y = rm->GetValue(properties["y"], mAlignOffset.y); SetWidth(rm->GetValue(properties["width"], GetWidth())); SetHeight(rm->GetValue(properties["height"], GetHeight())); // Detect alignement if (properties["align"] != "") { std::string strA = properties["align"]; if (strA == "top_left") mAlign = Align::TOP_LEFT; else if (strA == "top_center") mAlign = Align::TOP_CENTER; else if (strA == "top_right") mAlign = Align::TOP_RIGHT; else if (strA == "left") mAlign = Align::LEFT; else if (strA == "center") mAlign = Align::CENTER; else if (strA == "right") mAlign = Align::RIGHT; else if (strA == "bottom_left") mAlign = Align::BOTTOM_LEFT; else if (strA == "bottom_center") mAlign = Align::BOTTOM_CENTER; else if (strA == "bottom_right") mAlign = Align::BOTTOM_RIGHT; else mAlign = Align::NONE; } SetColor(rm->GetColorValue(properties["color"], GetColor())); SetBorderColor(rm->GetColorValue(properties["borderColor"], GetBorderColor())); SetEnabled(rm->GetValue(properties["enabled"], IsEnabled())); SetVisible(rm->GetValue(properties["visible"], IsVisible())); SetFocusable(rm->GetValue(properties["focusable"], IsFocusable())); UpdatePosition(); }
void IGUIObject::LoadStyle(CGUI& GUIinstance, const CStr& StyleName) { // Fetch style if (GUIinstance.m_Styles.count(StyleName) == 1) { LoadStyle(GUIinstance.m_Styles[StyleName]); } else { debug_warn(L"IGUIObject::LoadStyle failed"); } }
TextButton::TextButton(const Unicode::Text& caption) : Widget(), ButtonPolicy(*static_cast<Widget*>(this)), mCaption(caption), mDecorator() { Add(&mDecorator); Add(&mCaption); SetDefaultStyle("BI_TextButton"); LoadStyle(GetDefaultStyle()); }
CheckBox::CheckBox(const Unicode::Text& caption) : Widget(), mChecked(false), mDecorator(), mCaption(caption), mCheckIcon() { SetDefaultStyle("BI_CheckBox"); LoadStyle(GetDefaultStyle()); Add(&mDecorator); Add(&mCaption); Add(&mCheckIcon); //mCheckIcon.AddMouseListener(this); AddMouseListener(this); }
BOOL CClientApp::InitInstance() { // 如果一个运行在 Windows XP 上的应用程序清单指定要 // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式, //则需要 InitCommonControlsEx()。 否则,将无法创建窗口。 INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // 将它设置为包括所有要在应用程序中使用的 // 公共控件类。 InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); // 初始化 OLE 库 if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); EnableTaskbarInteraction(FALSE); // 使用 RichEdit 控件需要 AfxInitRichEdit2() // AfxInitRichEdit2(); //MessageBox(0, 0, 0, 0); // 进程锁,防止多个主窗口创建 // m_hMutex = OpenMutex(MUTEX_ALL_ACCESS, FALSE, MAIN_MUTEX_NAME); // if (GetLastError() == ERROR_FILE_NOT_FOUND) // { // m_hMutex = CreateMutex(NULL, TRUE, MAIN_MUTEX_NAME); // } // else // { // HWND hMainWnd = FindWindow(_T("MyEchoLoginWnd"), NULL); // if (hMainWnd == NULL) // hMainWnd = FindWindow(_T("MyEchoMainFrame"), NULL); // if (hMainWnd) // { // ::ShowWindow(hMainWnd, IsIconic(hMainWnd) ? SW_RESTORE : SW_SHOW); // ::SetForegroundWindow(hMainWnd); // } // return FALSE; // } CrashHandler::getInstance()->handleUncaughtException(TRUE); if (!config_init()) return FALSE; Dulib_Init(); TCHAR tzAppPath[MAX_PATH] = { 0 }; ::GetModuleFileName(GetModuleHandle(NULL), tzAppPath, _countof(tzAppPath)); ::PathRemoveFileSpec(tzAppPath); #ifdef _DEBUG ::PathAppend(tzAppPath, _T("\\..\\skin\\config.xml")); m_pWinManager = LoadStyle(tzAppPath); #else //::PathAppend(tzAppPath, _T("skin.skn")); m_pWinManager = LoadStyleZipMemory(g_rsrcData, g_dataLen); #endif if (!m_pWinManager) return FALSE; CLoginWnd pLoginWnd; pLoginWnd.DoModal(); // 试图加载共享 MDI 菜单和快捷键表 //TODO: 添加附加成员变量,并加载对 // 应用程序可能需要的附加菜单类型的调用 HINSTANCE hInst = AfxGetResourceHandle(); m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_ClientTYPE)); return TRUE; }
void CheckBox::SetChecked(bool checked) { mChecked = checked; LoadStyle((checked) ? GetDefaultStyle() + "_Checked" : GetDefaultStyle()); }
void graphLE3(Long64_t entry=0,int num=2,int spot=0){ gROOT->ProcessLine(".L ~/analysis/scripts/LoadStyle.C"); LoadStyle(); LendaEvent * event = new LendaEvent(); TTree* flt =(TTree*)gDirectory->Get("flt"); flt->SetBranchAddress("Event",&event); flt->GetEntry(entry); cout<<event->Traces.size()<<endl; int size = (int) event->Traces[spot].size(); Double_t* x = malloc(size*sizeof(Double_t)); Double_t* y = malloc(size*sizeof(Double_t)); Double_t* y1= malloc(size*sizeof(Double_t)); Double_t* y2=malloc(size*sizeof(Double_t)); cout<<"size is "<<size<<endl; for (int i=0;i<size;i++){ x[i]=i*10; y[i]=event->Traces[spot][i] -380; y1[i]=event->Filters[spot][i]; y2[i]=event->CFDs[spot][i]; } cout<<"50 "<<event->CFDs[spot][50]<<endl; cout<<"50 "<<event->CFDs[spot][51]<<endl; cout<<"50 "<<event->CFDs[spot][52]<<endl; cout<<"50 "<<event->CFDs[spot][53]<<endl; TGraph *gr = new TGraph(size,x,y); TGraph *gr1 = new TGraph(size,x,y1); TGraph *gr2 = new TGraph(size,x,y2); TCanvas *c = new TCanvas(); c->cd(1); gr->SetFillColor(kBlack); gr1->SetFillColor(0); gr2->SetFillColor(0); gr->SetLineColor(kBlack); gr1->SetLineColor(kBlue); gr2->SetLineColor(kRed); gr->SetLineWidth(3); gr2->SetLineWidth(3); gr1->SetLineWidth(3); gr->SetMarkerSize(.7); gr1->SetMarkerSize(.7); gr2->SetMarkerSize(.7); gr->SetMarkerStyle(8); gr1->SetMarkerStyle(8); gr2->SetMarkerStyle(8); TMultiGraph *mg = new TMultiGraph(); leg = new TLegend(0.7,0.7,1,1); leg->SetLineWidth(0); leg->SetHeader(""); leg->AddEntry(gr, "Trace","l"); leg->AddEntry(gr1,"Fast Filter","l"); leg->AddEntry(gr2,"CFD Filter","l"); leg->SetTextSize(.05); leg->SetFillColor(kWhite); mg->Add(gr); mg->Add(gr1); mg->Add(gr2); mg->SetTitle("Pixie Digital Waveform"); mg->Draw("a L P"); mg->GetHistogram()->GetXaxis()->SetTitle("Time [ns]"); mg->GetHistogram()->GetYaxis()->SetTitle("ADC Channel"); mg->GetHistogram()->GetYaxis()->SetTitleOffset(1.3); leg->Draw(); }
int efffake() { LoadStyle(); const int ncen=6; const char *ccent[ncen] = {"0-5%","5-10%","10-30%","30-50%","50-70%","70-90%"}; const int knj=2; const char *calgo[knj]={"akVs3PF","akPu3PF"}; const int iAlg[knj] = {0,2}; //! Input file PbPb TFile *fin_pbpb = NULL; fin_pbpb = new TFile("../input/JetResponse_histos_JECv14_embeded_pp_cent.root","r"); TFile *fin_pp=NULL; fin_pp = new TFile("../input/JetResponse_histos_JECv14_pp.root","r"); //! pp TGraphAsymmErrors *gr_fake_pp_pt[knj]; TGraphAsymmErrors *gr_eff_pp_pt[knj]; //! Heavy-ion TGraphAsymmErrors *gr_fake_pbpb_pt[knj][ncen]; TGraphAsymmErrors *gr_eff_pbpb_pt [knj][ncen]; Color_t icol[ncen] = {kRed, kBlue, kGreen+3, kOrange+3, kMagenta, kBlack}; int isty[ncen] = {24 , 25 , 26 , 30 , 32 , 27 }; TH1F *hnum=0, *hden=0; for(int nj=0;nj<knj;nj++){ TH1F *hden = (TH1F*)fin_pp->Get(Form("hPtAll%d_0",iAlg[nj])); hden->Rebin(5); TH1F *hnum = (TH1F*)fin_pp->Get(Form("hPtSel%d_0",iAlg[nj])); hnum->Rebin(5); gr_eff_pp_pt[nj] = new TGraphAsymmErrors(hnum, hden,"cl=0.683 b(1,1) mode"); gr_eff_pp_pt[nj]->SetMarkerStyle(20); gr_eff_pp_pt[nj]->SetMarkerColor(1); gr_eff_pp_pt[nj]->SetMarkerSize(1.2); delete hden; delete hnum; TH1F *hden = (TH1F*)fin_pp->Get(Form("hFakePtAll%d_0",iAlg[nj])); TH1F *hnum = (TH1F*)fin_pp->Get(Form("hFakePtSel%d_0",iAlg[nj])); gr_fake_pp_pt[nj] = new TGraphAsymmErrors(hnum, hden,"cl=0.683 b(1,1) mode"); gr_fake_pp_pt[nj]->SetMarkerStyle(24); gr_fake_pp_pt[nj]->SetMarkerColor(1); gr_fake_pp_pt[nj]->SetMarkerSize(1.3); delete hden; delete hnum; for(int ic=0;ic<ncen; ic++){ TH1F *hden = (TH1F*)fin_pbpb->Get(Form("hPtAll%d_%d",iAlg[nj],ic)); hden->Rebin(5); TH1F *hnum = (TH1F*)fin_pbpb->Get(Form("hPtSel%d_%d",iAlg[nj],ic)); hnum->Rebin(5); gr_eff_pbpb_pt[nj][ic] = new TGraphAsymmErrors(hnum, hden,"cl=0.683 b(1,1) mode"); gr_eff_pbpb_pt[nj][ic]->SetName(Form("gr_eff_pbpb_pt_%d_%d",nj,ic)); gr_eff_pbpb_pt[nj][ic]->SetMarkerStyle(isty[ic]); gr_eff_pbpb_pt[nj][ic]->SetMarkerColor(icol[ic]); gr_eff_pbpb_pt[nj][ic]->SetLineColor(icol[ic]); gr_eff_pbpb_pt[nj][ic]->SetMarkerSize(1.6); delete hden; delete hnum; TH1F *hden = (TH1F*)fin_pp->Get(Form("hFakePtAll%d_%d",iAlg[nj],ic)); TH1F *hnum = (TH1F*)fin_pp->Get(Form("hFakePtSel%d_%d",iAlg[nj],ic)); gr_fake_pbpb_pt[nj][ic] = new TGraphAsymmErrors(hnum, hden,"cl=0.683 b(1,1) mode"); gr_fake_pbpb_pt[nj][ic]->SetName(Form("gr_fake_pbpb_pt_%d_%d",nj,ic)); gr_fake_pbpb_pt[nj][ic]->SetMarkerStyle(isty[ic]); gr_fake_pbpb_pt[nj][ic]->SetMarkerColor(icol[ic]); gr_fake_pbpb_pt[nj][ic]->SetLineColor(icol[ic]); gr_fake_pbpb_pt[nj][ic]->SetMarkerSize(1.6); delete hden; delete hnum; } }//! nj TLegend *leg = new TLegend(0.3771486,0.2040302,0.7583418,0.5906801,"","BRNDC"); leg->SetHeader(""); leg->SetBorderSize(0); leg->SetLineColor(10); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(10); leg->SetTextSize(0.04); leg->AddEntry(gr_eff_pp_pt[0],"pp","p"); leg->AddEntry(gr_eff_pbpb_pt[0][0],ccent[0],"p"); leg->AddEntry(gr_eff_pbpb_pt[0][1],ccent[1],"p"); leg->AddEntry(gr_eff_pbpb_pt[0][2],ccent[2],"p"); leg->AddEntry(gr_eff_pbpb_pt[0][3],ccent[3],"p"); leg->AddEntry(gr_eff_pbpb_pt[0][4],ccent[4],"p"); leg->AddEntry(gr_eff_pbpb_pt[0][5],ccent[5],"p"); TCanvas *c1[knj], *c2[knj]; for(int nj=0; nj<knj; nj++){ c1[nj] = new TCanvas(Form("c1_%d",nj),Form("%s Eff ",calgo[nj]),913,822); c1[nj]->cd(); c1[nj]->SetLeftMargin(0.13); c1[nj]->SetBottomMargin(0.18); gr_eff_pp_pt[nj]->SetMaximum(1.04); gr_eff_pp_pt[nj]->SetMinimum(0.56); gr_eff_pp_pt[nj]->SetTitle(""); gr_eff_pp_pt[nj]->GetXaxis()->SetRangeUser(15,150); gr_eff_pp_pt[nj]->GetXaxis()->SetTitle("GenJet p_{T} (GeV/c)"); gr_eff_pp_pt[nj]->GetXaxis()->SetLabelSize(0.05); gr_eff_pp_pt[nj]->GetXaxis()->SetTitleSize(0.05); gr_eff_pp_pt[nj]->GetXaxis()->CenterTitle(); gr_eff_pp_pt[nj]->GetYaxis()->SetTitle("Jet reconstruction efficiency"); gr_eff_pp_pt[nj]->GetYaxis()->CenterTitle(); gr_eff_pp_pt[nj]->GetYaxis()->SetTitleOffset(1.26); gr_eff_pp_pt[nj]->GetYaxis()->SetLabelSize(0.05); gr_eff_pp_pt[nj]->GetYaxis()->SetTitleSize(0.05); gr_eff_pp_pt[nj]->Draw("ap"); for(int ic=0; ic<ncen; ic++){ gr_eff_pbpb_pt[nj][ic]->Draw("psame"); } leg->Draw(); drawText2(Form("%s |#eta|<2",calgo[nj]),0.45,0.60,26); // c2[nj] = new TCanvas(Form("c2_%d",nj),Form("%s Fake ",calgo[nj]),913,822); c2[nj]->cd(); c2[nj]->SetLeftMargin(0.13); c2[nj]->SetBottomMargin(0.18); gr_fake_pp_pt[nj]->SetMaximum(1.04); gr_fake_pp_pt[nj]->SetMinimum(0.0); gr_fake_pp_pt[nj]->SetTitle(""); gr_fake_pp_pt[nj]->GetXaxis()->SetRangeUser(15,150); gr_fake_pp_pt[nj]->GetXaxis()->SetTitle("GenJet p_{T} (GeV/c)"); gr_fake_pp_pt[nj]->GetXaxis()->SetLabelSize(0.05); gr_fake_pp_pt[nj]->GetXaxis()->SetTitleSize(0.05); gr_fake_pp_pt[nj]->GetXaxis()->CenterTitle(); gr_fake_pp_pt[nj]->GetYaxis()->SetTitle("Fake Rate"); gr_fake_pp_pt[nj]->GetYaxis()->CenterTitle(); gr_fake_pp_pt[nj]->GetYaxis()->SetTitleOffset(1.26); gr_fake_pp_pt[nj]->GetYaxis()->SetLabelSize(0.05); gr_fake_pp_pt[nj]->GetYaxis()->SetTitleSize(0.05); gr_fake_pp_pt[nj]->Draw("ap"); for(int ic=0; ic<ncen; ic++){ gr_fake_pbpb_pt[nj][ic]->Draw("psame"); } leg->Draw(); drawText2(Form("%s |#eta|<2",calgo[nj]),0.45,0.60,26); } return 0; }