further development

git-svn-id: http://moon:8086/svn/software/trunk/projects/RBM@17 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2014-10-04 19:09:35 +00:00
parent b403b9776a
commit f62f1283f8
127 changed files with 2350 additions and 1235 deletions
@@ -22,7 +22,7 @@
==============================================================================
*/
MenuBarComponent::MenuBarComponent (MenuBarModel* model_)
MenuBarComponent::MenuBarComponent (MenuBarModel* m)
: model (nullptr),
itemUnderMouse (-1),
currentPopupIndex (-1),
@@ -32,7 +32,7 @@ MenuBarComponent::MenuBarComponent (MenuBarModel* model_)
setWantsKeyboardFocus (false);
setMouseClickGrabsKeyboardFocus (false);
setModel (model_);
setModel (m);
}
MenuBarComponent::~MenuBarComponent()
@@ -284,22 +284,26 @@ void MenuBarComponent::mouseMove (const MouseEvent& e)
bool MenuBarComponent::keyPressed (const KeyPress& key)
{
bool used = false;
const int numMenus = menuNames.size();
const int currentIndex = jlimit (0, menuNames.size() - 1, currentPopupIndex);
if (key.isKeyCode (KeyPress::leftKey))
if (numMenus > 0)
{
showMenu ((currentIndex + numMenus - 1) % numMenus);
used = true;
}
else if (key.isKeyCode (KeyPress::rightKey))
{
showMenu ((currentIndex + 1) % numMenus);
used = true;
const int currentIndex = jlimit (0, numMenus - 1, currentPopupIndex);
if (key.isKeyCode (KeyPress::leftKey))
{
showMenu ((currentIndex + numMenus - 1) % numMenus);
return true;
}
if (key.isKeyCode (KeyPress::rightKey))
{
showMenu ((currentIndex + 1) % numMenus);
return true;
}
}
return used;
return false;
}
void MenuBarComponent::menuBarItemsChanged (MenuBarModel* /*menuBarModel*/)
@@ -40,9 +40,9 @@ public:
//==============================================================================
/** Creates a menu bar.
@param model the model object to use to control this bar. You can
pass 0 into this if you like, and set the model later
using the setModel() method
@param model the model object to use to control this bar. You can
pass nullptr into this if you like, and set the model
later using the setModel() method
*/
MenuBarComponent (MenuBarModel* model);
@@ -57,8 +57,7 @@ public:
*/
void setModel (MenuBarModel* newModel);
/** Returns the current menu bar model being used.
*/
/** Returns the current menu bar model being used. */
MenuBarModel* getModel() const noexcept;
//==============================================================================
@@ -80,8 +80,7 @@ public:
virtual ~Listener() {}
//==============================================================================
/** This callback is made when items are changed in the menu bar model.
*/
/** This callback is made when items are changed in the menu bar model. */
virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
/** This callback is made when an application command is invoked that
@@ -101,7 +100,6 @@ public:
void addListener (Listener* listenerToAdd) noexcept;
/** Removes a listener.
@see addListener
*/
void removeListener (Listener* listenerToRemove) noexcept;
@@ -130,7 +128,7 @@ public:
//==============================================================================
#if JUCE_MAC || DOXYGEN
/** MAC ONLY - Sets the model that is currently being shown as the main
/** OSX ONLY - Sets the model that is currently being shown as the main
menu bar at the top of the screen on the Mac.
You can pass 0 to stop the current model being displayed. Be careful
@@ -151,12 +149,12 @@ public:
const PopupMenu* extraAppleMenuItems = nullptr,
const String& recentItemsMenuName = String::empty);
/** MAC ONLY - Returns the menu model that is currently being shown as
/** OSX ONLY - Returns the menu model that is currently being shown as
the main menu bar.
*/
static MenuBarModel* getMacMainMenu();
/** MAC ONLY - Returns the menu that was last passed as the extraAppleMenuItems
/** OSX ONLY - Returns the menu that was last passed as the extraAppleMenuItems
argument to setMacMainMenu(), or nullptr if none was specified.
*/
static const PopupMenu* getMacExtraAppleItemsMenu();
@@ -164,7 +162,7 @@ public:
//==============================================================================
/** @internal */
void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) override;
void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&) override;
/** @internal */
void applicationCommandListChanged() override;
/** @internal */
@@ -172,7 +170,7 @@ public:
private:
ApplicationCommandManager* manager;
ListenerList <Listener> listeners;
ListenerList<Listener> listeners;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MenuBarModel)
};
@@ -1216,12 +1216,7 @@ public:
void paint (Graphics& g) override
{
g.setFont (getLookAndFeel().getPopupMenuFont().boldened());
g.setColour (findColour (PopupMenu::headerTextColourId));
g.drawFittedText (getName(),
12, 0, getWidth() - 16, proportionOfHeight (0.8f),
Justification::bottomLeft, 1);
getLookAndFeel().drawPopupMenuSectionHeader (g, getLocalBounds(), getName());
}
void getIdealSize (int& idealWidth, int& idealHeight)
@@ -562,6 +562,9 @@ public:
const Drawable* icon,
const Colour* textColour) = 0;
virtual void drawPopupMenuSectionHeader (Graphics&, const Rectangle<int>& area,
const String& sectionName) = 0;
/** Returns the size and style of font to use in popup menus. */
virtual Font getPopupMenuFont() = 0;