aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPComboPopupButton.h
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2013-03-31 23:05:36 +0000
committerrowanbeentje <rowan@beent.je>2013-03-31 23:05:36 +0000
commitcca030a98637bec8e8a731efb7ad15b3f458b115 (patch)
treed2573148088d98d3ab7e765bf8933499169cc119 /Source/SPComboPopupButton.h
parentfb59ce3e1a183c8406912b9b21c5b5621497d54e (diff)
downloadsequelpro-cca030a98637bec8e8a731efb7ad15b3f458b115.tar.gz
sequelpro-cca030a98637bec8e8a731efb7ad15b3f458b115.tar.bz2
sequelpro-cca030a98637bec8e8a731efb7ad15b3f458b115.zip
Combine the "Run All" and "Run Current/Previous/Selection" buttons into a single button with dropdown menu with ability to change the default action:
- Create a new SPComboPopupButton class; this subclasses NSPopupButton to retain the ability to show the popup menu, but only when the right-hand side of the button is pressed, allowing the rest of the button to perform the click action - Combine the previous two "Run" buttons on the Custom Query view into a new SPComboPopupButton - Move the Run menu items from the gear menu into the Run button popup menu so they can be discovered more easily (and the shortcuts seen more easily) - Add a menu item to switch the button's default action, which also swaps all associated shortcuts - Clean up associated logic This implements Issue #1569
Diffstat (limited to 'Source/SPComboPopupButton.h')
-rw-r--r--Source/SPComboPopupButton.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/Source/SPComboPopupButton.h b/Source/SPComboPopupButton.h
new file mode 100644
index 00000000..74b003cf
--- /dev/null
+++ b/Source/SPComboPopupButton.h
@@ -0,0 +1,52 @@
+//
+// $Id$
+//
+// SPComboPopupButton.h
+// sequel-pro
+//
+// Created by Rowan Beentje (rowan.beent.je) on March 22, 2013
+// Copyright (c) 2013 Rowan Beentje. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+// More info at <http://code.google.com/p/sequel-pro/>
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface SPComboPopupButton : NSPopUpButton <NSMenuDelegate> {
+ BOOL menuIsOpen;
+ BOOL shouldDrawNonHighlightState;
+ NSUInteger lineOffset;
+
+ SEL actionSelector;
+ id actionTarget;
+}
+
+@property(readonly, assign) BOOL shouldDrawNonHighlightState;
+@property(readonly, assign) NSUInteger lineOffset;
+
+@end
+
+@interface SPComboPopupButtonCell : NSPopUpButtonCell
+
+@end