iPlug 2: TestDirBrowseControl.h Source File
29 mLabel.SetFormatted(32, "Select a %s file", extension);
39 mUsePlatformMenuButtonRect = mUsePlatformMenuTextRect.GetFromRight(20.).GetPadded(-5.);
46 g.FillRect(COLOR_WHITE, mButtonRect);
47 g.DrawText(mText, mLabel.Get(), mButtonRect);
48 g.FillTriangle(COLOR_GRAY, mArrowRect.L, mArrowRect.T, mArrowRect.R, mArrowRect.T, mArrowRect.MW(), mArrowRect.B);
49 g.DrawText(IText(DEFAULT_TEXT_SIZE, EAlign::Near), "Use platform menu", mUsePlatformMenuTextRect);
50 g.DrawRect(COLOR_BLACK, mUsePlatformMenuButtonRect);
53 g.FillRect(COLOR_BLACK, mUsePlatformMenuButtonRect.GetPadded(-2));
64 mSelectedItemIndex = mItems.Find(pItem);
65 mLabel.Set(pItem->GetText());
75 if (mButtonRect.Contains(x, y))
79 else if (mUsePlatformMenuButtonRect.Contains(x, y))
81 mUsePlatformMenu = !mUsePlatformMenu;
92 void SetPath(const char* path)
100 bool mUsePlatformMenu = true;
101 IRECT mButtonRect;
102 IRECT mArrowRect;
103 IRECT mUsePlatformMenuTextRect;
104 IRECT mUsePlatformMenuButtonRect;
This file contains the base IControl implementation, along with some base classes for specific types ...
Common paths useful for plug-ins.
bool mMouseIsOver
if mGraphics::mHandleMouseOver = true, this will be true when the mouse is over control.
IControl * SetTooltip(const char *str)
Set a tooltip for the control.
virtual void SetDirty(bool triggerAction=true, int valIdx=kNoValIdx)
Mark the control as dirty, i.e.
An abstract IControl base class that you can inherit from in order to make a control that pops up a m...
void CheckSelectedItem()
Check the currently selected menu item.
void SetupMenu()
Call after adding one or more paths, to populate the menu.
void AddPath(const char *path, const char *displayText)
Used to add a path to scan for files.
The lowest level base class of an IGraphics context.
virtual void DrawRect(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0, float thickness=1.f)
Draw a rectangle to the graphics context.
void AttachPopupMenuControl(const IText &text=DEFAULT_TEXT, const IRECT &bounds=IRECT())
Attach a control for pop-up menus, to override platform style menus.
void DrawText(const IText &text, const char *str, const IRECT &bounds, const IBlend *pBlend=0)
Draw some text to the graphics context in a specific rectangle.
void CreatePopupMenu(IControl &control, IPopupMenu &menu, const IRECT &bounds, int valIdx=0)
Shows a pop up/contextual menu in relation to a rectangular region of the graphics context.
virtual void DrawDottedRect(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0, float thickness=1.f, float dashLen=2.f)
Draw a dotted rectangle to the graphics context.
void RemovePopupMenuControl()
Remove the IGraphics popup menu, use platform popup menu if available.
virtual void FillRect(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0)
Fill a rectangular region of the graphics context with a color.
virtual void FillTriangle(const IColor &color, float x1, float y1, float x2, float y2, float x3, float y3, const IBlend *pBlend=0)
Fill a triangle with a color.
Control to test IDirBrowseControlBase.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
void OnPopupMenuSelection(IPopupMenu *pMenu, int valIdx) override
Implement this method to handle popup menu selection after IGraphics::CreatePopupMenu/IControlPromptU...
void OnResize() override
Called when IControl is constructed or resized using SetRect().
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
Used to manage mouse modifiers i.e.
Used to manage a rectangular area, independent of draw class/platform.
IRECT GetFromRight(float amount) const
Get a subrect of this IRECT bounded in X by 'amount' and the right edge.
IRECT GetFromBottom(float amount) const
Get a subrect of this IRECT bounded in Y by 'amount' and the bottom edge.
IRECT GetCentredInside(const IRECT &sr) const
Get a rectangle the size of sr but with the same center point as this rectangle.
bool Contains(const IRECT &rhs) const
Returns true if this IRECT completely contains rhs.
IRECT GetPadded(float padding) const
Get a copy of this IRECT with each value padded by padding N.B.
IText is used to manage font and text/text entry style for a piece of text on the UI,...