CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWCustomIconsButton.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWCustomIconsButton
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Thu Oct 23 13:05:35 EDT 2008
11 //
12 
13 // system include files
14 #include <algorithm>
15 #include <assert.h>
16 #include "TGPicture.h"
17 
18 // user include files
20 
21 
22 //
23 // constants, enums and typedefs
24 //
25 
26 //
27 // static data member definitions
28 //
29 
30 //
31 // constructors and destructor
32 //
34  const TGPicture* iUpIcon,
35  const TGPicture* iDownIcon,
36  const TGPicture* iDisabledIcon,
37  const TGPicture* iBelowMouseIcon,
38  Int_t id, GContext_t norm, UInt_t option) :
39  TGButton(iParent,id, norm, option),
40  m_upIcon(iUpIcon),
41  m_downIcon(iDownIcon),
42  m_disabledIcon(iDisabledIcon),
43  m_belowMouseIcon(iBelowMouseIcon),
44  m_inside(false)
45 {
46  assert(0!=iUpIcon);
47  assert(0!=iDownIcon);
48  assert(0!=iDisabledIcon);
49  gVirtualX->ShapeCombineMask(GetId(), 0, 0, iUpIcon->GetMask());
50  SetBackgroundPixmap(iUpIcon->GetPicture());
51  Resize(iUpIcon->GetWidth(),iUpIcon->GetHeight());
52  fTWidth = iUpIcon->GetWidth();
53  fTHeight = iUpIcon->GetHeight();
54 }
55 
56 // FWCustomIconsButton::FWCustomIconsButton(const FWCustomIconsButton& rhs)
57 // {
58 // // do actual copying here;
59 // }
60 
62 {
63 }
64 
65 //
66 // assignment operators
67 //
68 // const FWCustomIconsButton& FWCustomIconsButton::operator=(const FWCustomIconsButton& rhs)
69 // {
70 // //An exception safe implementation is
71 // FWCustomIconsButton temp(rhs);
72 // swap(rhs);
73 //
74 // return *this;
75 // }
76 
77 //
78 // member functions
79 //
80 void
81 FWCustomIconsButton::swapIcons(const TGPicture*& iUpIcon,
82  const TGPicture*& iDownIcon,
83  const TGPicture*& iDisabledIcon)
84 {
85  std::swap(iUpIcon,m_upIcon);
86  std::swap(iDownIcon,m_downIcon);
87  std::swap(iDisabledIcon,m_disabledIcon);
88  gVirtualX->ShapeCombineMask(GetId(), 0, 0, m_upIcon->GetMask());
89  fClient->NeedRedraw(this);
90 }
91 
92 void
93 FWCustomIconsButton::setIcons(const TGPicture* iUpIcon,
94  const TGPicture* iDownIcon,
95  const TGPicture* iDisabledIcon,
96  const TGPicture* iBelowMouseIcon)
97 {
98  m_upIcon = iUpIcon;
99  m_downIcon = iDownIcon;
100  m_disabledIcon = iDisabledIcon;
101  m_belowMouseIcon = iBelowMouseIcon;
102 
103  gVirtualX->ShapeCombineMask(GetId(), 0, 0, m_upIcon->GetMask());
104  fClient->NeedRedraw(this);
105 }
106 
107 //
108 // const member functions
109 //
110 
111 //______________________________________________________________________________
113 {
114  if (event->fType == kEnterNotify)
115  m_inside = true;
116  else if (event->fType == kLeaveNotify)
117  m_inside = false;
118 
119  fClient->NeedRedraw(this);
120 
121  return TGButton::HandleCrossing(event);
122 }
123 
124 
125 void
127 {
128  //ChangeOptions(0);
129  //TGButton::DoRedraw();
130  //Stole this from TGPictureButton.
131  int x = (fWidth - fTWidth) >> 1;
132  int y = (fHeight - fTHeight) >> 1;
133 
134  switch(fState)
135  {
136  case kButtonUp:
137  if (m_belowMouseIcon && m_inside)
138  m_belowMouseIcon->Draw(fId, fNormGC,x,y);
139  else
140  m_upIcon->Draw(fId, fNormGC,x,y);
141  break;
142  case kButtonEngaged:
143  case kButtonDown:
144  m_downIcon->Draw(fId, fNormGC,x,y);
145  break;
146  case kButtonDisabled:
147  default:
148  m_disabledIcon->Draw(fId, fNormGC,x,y);
149  }
150 }
151 
152 //
153 // static member functions
154 //
virtual bool HandleCrossing(Event_t *)
const TGPicture * m_disabledIcon
const TGPicture * m_belowMouseIcon
FWCustomIconsButton(const TGWindow *iParent, const TGPicture *iUpIcon, const TGPicture *iDownIcon, const TGPicture *iDisableIcon, const TGPicture *iBelowMouseIcon=0, Int_t id=-1, GContext_t norm=TGButton::GetDefaultGC()(), UInt_t option=0)
assert(m_qm.get())
const TGPicture * m_upIcon
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void setIcons(const TGPicture *iUpIcon, const TGPicture *iDownIcon, const TGPicture *iDisabledIcon, const TGPicture *ibelowMouseIcon=0)
const TGPicture * m_downIcon
void swapIcons(const TGPicture *&iUpIcon, const TGPicture *&iDownIcon, const TGPicture *&iDisabledIcon)
volatile std::atomic< bool > shutdown_flag false