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 // $Id: FWCustomIconsButton.cc,v 1.6 2009/11/23 14:53:40 amraktad Exp $
12 //
13 
14 // system include files
15 #include <algorithm>
16 #include <assert.h>
17 #include "TGPicture.h"
18 
19 // user include files
21 
22 
23 //
24 // constants, enums and typedefs
25 //
26 
27 //
28 // static data member definitions
29 //
30 
31 //
32 // constructors and destructor
33 //
35  const TGPicture* iUpIcon,
36  const TGPicture* iDownIcon,
37  const TGPicture* iDisabledIcon,
38  const TGPicture* iBelowMouseIcon,
39  Int_t id, GContext_t norm, UInt_t option) :
40  TGButton(iParent,id, norm, option),
41  m_upIcon(iUpIcon),
42  m_downIcon(iDownIcon),
43  m_disabledIcon(iDisabledIcon),
44  m_belowMouseIcon(iBelowMouseIcon),
45  m_inside(false)
46 {
47  assert(0!=iUpIcon);
48  assert(0!=iDownIcon);
49  assert(0!=iDisabledIcon);
50  gVirtualX->ShapeCombineMask(GetId(), 0, 0, iUpIcon->GetMask());
51  SetBackgroundPixmap(iUpIcon->GetPicture());
52  Resize(iUpIcon->GetWidth(),iUpIcon->GetHeight());
53  fTWidth = iUpIcon->GetWidth();
54  fTHeight = iUpIcon->GetHeight();
55 }
56 
57 // FWCustomIconsButton::FWCustomIconsButton(const FWCustomIconsButton& rhs)
58 // {
59 // // do actual copying here;
60 // }
61 
63 {
64 }
65 
66 //
67 // assignment operators
68 //
69 // const FWCustomIconsButton& FWCustomIconsButton::operator=(const FWCustomIconsButton& rhs)
70 // {
71 // //An exception safe implementation is
72 // FWCustomIconsButton temp(rhs);
73 // swap(rhs);
74 //
75 // return *this;
76 // }
77 
78 //
79 // member functions
80 //
81 void
82 FWCustomIconsButton::swapIcons(const TGPicture*& iUpIcon,
83  const TGPicture*& iDownIcon,
84  const TGPicture*& iDisabledIcon)
85 {
86  std::swap(iUpIcon,m_upIcon);
87  std::swap(iDownIcon,m_downIcon);
88  std::swap(iDisabledIcon,m_disabledIcon);
89  gVirtualX->ShapeCombineMask(GetId(), 0, 0, m_upIcon->GetMask());
90  fClient->NeedRedraw(this);
91 }
92 
93 void
94 FWCustomIconsButton::setIcons(const TGPicture* iUpIcon,
95  const TGPicture* iDownIcon,
96  const TGPicture* iDisabledIcon,
97  const TGPicture* iBelowMouseIcon)
98 {
99  m_upIcon = iUpIcon;
100  m_downIcon = iDownIcon;
101  m_disabledIcon = iDisabledIcon;
102  m_belowMouseIcon = iBelowMouseIcon;
103 
104  gVirtualX->ShapeCombineMask(GetId(), 0, 0, m_upIcon->GetMask());
105  fClient->NeedRedraw(this);
106 }
107 
108 //
109 // const member functions
110 //
111 
112 //______________________________________________________________________________
114 {
115  if (event->fType == kEnterNotify)
116  m_inside = true;
117  else if (event->fType == kLeaveNotify)
118  m_inside = false;
119 
120  fClient->NeedRedraw(this);
121 
122  return TGButton::HandleCrossing(event);
123 }
124 
125 
126 void
128 {
129  //ChangeOptions(0);
130  //TGButton::DoRedraw();
131  //Stole this from TGPictureButton.
132  int x = (fWidth - fTWidth) >> 1;
133  int y = (fHeight - fTHeight) >> 1;
134 
135  gVirtualX->FillRectangle(fId, fNormGC, 2,2,fWidth,fHeight);
136 
137  switch(fState)
138  {
139  case kButtonUp:
140  if (m_belowMouseIcon && m_inside)
141  m_belowMouseIcon->Draw(fId, fNormGC,x,y);
142  else
143  m_upIcon->Draw(fId, fNormGC,x,y);
144  break;
145  case kButtonEngaged:
146  case kButtonDown:
147  m_downIcon->Draw(fId, fNormGC,x,y);
148  break;
149  case kButtonDisabled:
150  default:
151  m_disabledIcon->Draw(fId, fNormGC,x,y);
152  }
153 }
154 
155 //
156 // static member functions
157 //
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)
const TGPicture * m_upIcon
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
tuple norm
Definition: lumiNorm.py:78
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
unsigned int UInt_t
Definition: FUTypes.h:12
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)