void AButton::SetAlternateImages(wxImage up, wxImage over, wxImage down, wxImage dis) { mAltImage[0] = ImageRoll(up); mAltImage[1] = ImageRoll(over); mAltImage[2] = ImageRoll(down); mAltImage[3] = ImageRoll(dis); }
void AButton::SetAlternateImages(unsigned idx, wxImage up, wxImage over, wxImage down, wxImage dis) { if (1 + idx > mImages.size()) mImages.resize(1 + idx); mImages[idx].mArr[0] = ImageRoll(up); mImages[idx].mArr[1] = ImageRoll(over); mImages[idx].mArr[2] = ImageRoll(down); mImages[idx].mArr[3] = ImageRoll(dis); }
ExpandingToolBar::ExpandingToolBar(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size): wxPanelWrapper(parent, id, pos, size), mIsAutoExpanded(false), mIsManualExpanded(false), mIsExpanded(false), mAutoExpand(true), mFirstTime(true), mFrameParent(NULL), mDialogParent(NULL), mAreaParent(NULL), mSavedArrangement(NULL), mDragImage(NULL), mTopLevelParent(NULL) { mMainPanel = safenew wxPanelWrapper(this, -1, wxDefaultPosition, wxSize(1, 1)); mExtraPanel = safenew wxPanelWrapper(this, -1, wxDefaultPosition, wxSize(1, 1)); mGrabber = NULL; ToolBarArea *toolBarParent = dynamic_cast<ToolBarArea *>(GetParent()); if (toolBarParent) mGrabber = safenew ToolBarGrabber(this, -1, this); /// \todo check whether this is a memory leak (and check similar code) wxImage hbar = theTheme.Image(bmpToolBarToggle); wxColour magicColor = wxColour(0, 255, 255); ImageArray fourStates = ImageRoll::SplitV(hbar, magicColor); mToggleButton = new AButton(this, kToggleButtonID, wxDefaultPosition, wxDefaultSize, ImageRoll(ImageRoll::HorizontalRoll, fourStates[0], magicColor), ImageRoll(ImageRoll::HorizontalRoll, fourStates[1], magicColor), ImageRoll(ImageRoll::HorizontalRoll, fourStates[2], magicColor), ImageRoll(ImageRoll::HorizontalRoll, fourStates[3], magicColor), true); mToggleButton->UseDisabledAsDownHiliteImage(true); SetAutoLayout(true); mTimer.SetOwner(this, kTimerID); }
AButton::AButton(wxWindow * parent, wxWindowID id, const wxPoint & pos, const wxSize & size, wxImage up, wxImage over, wxImage down, wxImage dis, bool toggle): wxWindow() { Init(parent, id, pos, size, ImageRoll(up), ImageRoll(over), ImageRoll(down), ImageRoll(dis), toggle); }
void ExpandingToolBar::StartMoving() { if (!mAreaParent) return; int j; mAreaParent->CollapseAll(true); mTimer.Stop(); // This gives time for wx to finish redrawing the window that way. // HACK: why do we need to do it so many times??? for(j=0; j<500; j++) ::wxSafeYield(); wxBitmap toolbarBitmap = GetToolbarBitmap(); msNoAutoExpandStack++; mSavedArrangement = mAreaParent->SaveArrangement(); mAreaParent->RemoveChild(this); mAreaParent->Refresh(true); mTopLevelParent = this; while(!mTopLevelParent->IsTopLevel()) mTopLevelParent = mTopLevelParent->GetParent(); wxPoint hotSpot = ScreenToClient(wxGetMousePosition()); hotSpot -= (ClientToScreen(wxPoint(0, 0)) - mAreaParent->ClientToScreen(wxPoint(0, 0))); mDropTargets = mAreaParent->GetDropTargets(); mDropTarget = kDummyRect; wxColour magicColor = wxColour(0, 255, 255); wxImage tgtImage = theTheme.Image(bmpToolBarTarget); ImageRoll tgtImageRoll = ImageRoll(ImageRoll::VerticalRoll, tgtImage, magicColor); mTargetPanel = safenew ImageRollPanel(mAreaParent, -1, tgtImageRoll, wxDefaultPosition, wxDefaultSize, wxTRANSPARENT_WINDOW); mTargetPanel->SetLogicalFunction(wxXOR); mTargetPanel->SetSize(mDropTarget); // This gives time for wx to finish redrawing the window that way. // HACK: why do we need to do it several times??? for(j=0; j<500; j++) ::wxSafeYield(); mAreaParent->SetCapturedChild(this); mDragImage = new wxDragImage(toolbarBitmap); mDragImage->BeginDrag(hotSpot, mAreaParent, mTopLevelParent); mDragImage->Show(); mDragImage->Move(ScreenToClient(wxGetMousePosition())); }
ToolBarGrabber::ToolBarGrabber(wxWindow *parent, wxWindowID id, ExpandingToolBar *ownerToolbar, const wxPoint& pos, const wxSize& size): wxPanelWrapper(parent, id, pos, size), mOwnerToolBar(ownerToolbar) { wxImage grabberImages = theTheme.Image(bmpToolBarGrabber); wxColour magicColor = wxColour(0, 255, 255); ImageArray images = ImageRoll::SplitH(grabberImages, magicColor); mImageRoll[0] = ImageRoll(ImageRoll::VerticalRoll, images[0], magicColor); mImageRoll[1] = ImageRoll(ImageRoll::VerticalRoll, images[1], magicColor); SetSizeHints(mImageRoll[0].GetMinSize(), mImageRoll[1].GetMaxSize()); mState = 0; }