Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:17

0001 #include "Fireworks/Core/src/FWNumberEntry.h"
0002 
0003 #include <cstdlib>
0004 
0005 //------------------------------FWNumberEntryField------------------------------//
0006 
0007 //______________________________________________________________________________
0008 FWNumberEntryField::FWNumberEntryField(
0009     const TGWindow* p, Int_t id, Double_t val, GContext_t norm, FontStruct_t font, UInt_t option, ULong_t back)
0010     : TGNumberEntryField(p, id, val, norm, font, option, back) {
0011   // Constructs a number entry field.
0012 }
0013 
0014 //______________________________________________________________________________
0015 FWNumberEntryField::FWNumberEntryField(const TGWindow* parent,
0016                                        Int_t id,
0017                                        Double_t val,
0018                                        EStyle style,
0019                                        EAttribute attr,
0020                                        ELimit limits,
0021                                        Double_t min,
0022                                        Double_t max)
0023     : TGNumberEntryField(parent, id, val, style, attr, limits, min, max) {
0024   // Constructs a number entry field.
0025 }
0026 
0027 //------------------------------------------------------------------------------
0028 
0029 //______________________________________________________________________________
0030 Bool_t FWNumberEntryField::HandleFocusChange(Event_t* event) {
0031   // Handle focus change.
0032   // Avoid verification by TGNumberEntryField (which is f***ed).
0033 
0034   return TGTextEntry::HandleFocusChange(event);
0035 }
0036 
0037 //______________________________________________________________________________
0038 void FWNumberEntryField::ReturnPressed() {
0039   // Return was pressed.
0040   // Avoid verification by TGNumberEntryField (which is f***ed).
0041 
0042   TGTextEntry::ReturnPressed();
0043 }
0044 
0045 //------------------------------------------------------------------------------
0046 
0047 //______________________________________________________________________________
0048 UInt_t FWNumberEntryField::GetUIntNumber() { return static_cast<UInt_t>(strtoul(GetText(), nullptr, 10)); }
0049 
0050 //______________________________________________________________________________
0051 void FWNumberEntryField::SetUIntNumber(UInt_t n) { SetText(Form("%u", n), kFALSE); }
0052 
0053 //______________________________________________________________________________
0054 ULong64_t FWNumberEntryField::GetULong64Number() { return static_cast<ULong64_t>(strtoull(GetText(), nullptr, 10)); }
0055 
0056 //______________________________________________________________________________
0057 void FWNumberEntryField::SetULong64Number(ULong64_t n) { SetText(Form("%llu", n), kFALSE); }