13 #include <boost/bind.hpp>
18 #include "TGColorDialog.h"
44 TGFrame(p, 20, 20, kOwnBackground)
52 if (event->fType == kButtonRelease)
63 SetBackgroundColor(TColor::Number2Pixel(
fColor));
68 Emit(
"ColorSelected(Color_t)", ci);
75 TGHorizontalFrame(p, 10, 10, kOwnBackground, TGFrame::GetBlackPixel()),
76 fBackgroundIsBlack(kTRUE)
90 SetBackgroundColor(TGFrame::GetBlackPixel());
92 SetBackgroundColor(TGFrame::GetWhitePixel());
98 TGCompositeFrame::DoRedraw();
118 fCc.back()->Connect(
"ColorSelected(Color_t)",
"FWColorRow",
this,
"ColorChanged(Color_t)");
123 fCc[iIndex]->SetColor(iColor);
129 Int_t returnValue = -1;
131 for(std::vector<FWColorFrame*>::const_iterator it =
fCc.begin(), itEnd =
fCc.end();
132 it != itEnd; ++it, ++
index)
134 if ((*it)->GetColor() == iColor)
142 Emit(
"ColorChanged(Color_t)", ci);
154 TGVerticalFrame(p, 10, 10, kDoubleBorder | kRaisedFrame | kOwnBackground,
kColorPopupGray),
157 SetWindowAttributes_t wattr;
158 wattr.fMask = kWAOverrideRedirect;
159 wattr.fOverrideRedirect = kTRUE;
160 gVirtualX->ChangeWindowAttributes(fId, &wattr);
161 AddInput(kStructureNotifyMask);
169 fFirstRow ->Connect(
"ColorChanged(Color_t)",
"FWColorPopup",
this,
"ColorSelected(Color_t)");
170 fSecondRow->Connect(
"ColorChanged(Color_t)",
"FWColorPopup",
this,
"ColorSelected(Color_t)");
180 if (event->fX < 0 || event->fX >= (Int_t) fWidth ||
181 event->fY < 0 || event->fY >= (Int_t) fHeight)
183 if (event->fType == kButtonRelease)
188 TGFrame *
f = GetFrameFromPoint(event->fX, event->fY);
191 TranslateCoordinates(f, event->fX, event->fY, event->fX, event->fY);
192 f->HandleButton(event);
200 fLabel =
new TGLabel(
this, name);
201 fLabel->SetBackgroundColor(GetBackground());
216 TGTextButton *
b =
new TGTextButton(
this,
"Color wheel");
218 b->Connect(
"Clicked()",
"FWColorPopup",
this,
"PopupColorWheel()");
240 for (
UInt_t i = 0;
i < colors.size() / 2;
i++)
244 for (
UInt_t i = colors.size() / 2;
i < colors.size();
i++)
255 for (
UInt_t i = 0;
i < colors.size() / 2;
i++)
261 for (
UInt_t i = colors.size() / 2;
i < colors.size();
i++, ++
index)
276 gVirtualX->GetWindowSize(fParent->GetId(),
rx,
ry, rw, rh);
279 if (x + fWidth > rw) x = rw - fWidth;
281 if (y + fHeight > rh) y = rh - fHeight;
283 MoveResize(x, y, w, h);
289 gVirtualX->GrabPointer(fId, kButtonPressMask | kButtonReleaseMask | kPointerMotionMask,
kNone,
kNone);
291 gClient->WaitForUnmap(
this);
292 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE);
299 TGColorDialog *cd =
new TGColorDialog(gClient->GetDefaultRoot(),
this, &retc, &pixel, kFALSE);
301 cd->Connect(
"ColorSelected(Pixel_t)",
"FWColorPopup",
this,
"ColorWheelSelected(Pixel_t");
304 fClient->WaitForUnmap(cd);
326 Emit(
"ColorSelected(Color_t)", ci);
334 TGColorSelect(p, TColor::Number2Pixel(index), id),
336 fSelectedColor(index),
338 fColorManager(iManager)
340 std::vector<Color_t>
colors;
345 fFireworksPopup->Connect(
"ColorSelected(Color_t)",
"FWColorSelect",
this,
"SetColorByIndex(Color_t)");
357 TGFrame::HandleButton(event);
358 if (!IsEnabled())
return kTRUE;
360 if (event->fCode != kButton1)
return kFALSE;
362 if ((event->fType == kButtonPress) && HasFocus()) WantFocus();
364 if (event->fType == kButtonPress)
369 if (fState != kButtonDown) {
371 SetState(kButtonDown);
376 if (fState != kButtonUp)
381 if ((fPressPos.fX != fX) || (fPressPos.fY != fY))
389 std::vector<Color_t>
colors;
395 gVirtualX->TranslateCoordinates(fId, gClient->GetDefaultRoot()->GetId(), 0, fHeight,
ax, ay, wdummy);
412 SetColor(TColor::Number2Pixel(iColor), kFALSE);
427 Emit(
"ColorChosen(Color_t)", iColor);
virtual Bool_t HandleButton(Event_t *event)
void SetColorByIndex(Color_t iColor)
FWColorPopup * fFireworksPopup
void SetBackgroundToBlack(Bool_t)
void fillLimitedColors(std::vector< Color_t > &cv) const
void ColorChosen(Color_t)
virtual Bool_t HandleButton(Event_t *event)
void ColorSelected(Color_t)
BackgroundColorIndex backgroundColorIndex() const
FWColorSelect(const TGWindow *p, const char *label, Color_t colorIndex, const FWColorManager *, Int_t id)
void ColorChanged(Color_t)
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
const FWColorManager * fColorManager
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Bool_t fBackgroundIsBlack
virtual void AddColor(Color_t color)
void SetSelectedIndex(Int_t i)
void ResetColor(Int_t, Color_t)
FWColorRow(const TGWindow *p=0)
sigc::signal< void > colorsHaveChanged_
std::vector< FWColorFrame * > fCc
Int_t FindColorIndex(Color_t) const
FWColorFrame(const TGWindow *p=0, Color_t ci=0)