Commit graph

218 commits

Author SHA1 Message Date
Gregory John Casamento
14131287b3 Correct frame 2020-05-08 01:33:19 -04:00
Gregory John Casamento
1e1e1043f8 Add point values 2020-05-06 10:45:07 -04:00
Gregory John Casamento
22c1897eee Fix popup positioning. 2020-05-05 02:14:46 -04:00
Gregory John Casamento
266ec7e430 Implement popUpMenuPositonItem:... dragging, dropdown implementation, menu changes 2020-05-04 09:50:22 -04:00
Sergii Stoian
c0c5cad292 Merge branch 'master' into randr
Conflicts:
	ChangeLog
2020-02-23 03:04:19 +02:00
Sergii Stoian
99e0f4ddda * Source/NSMenu.m (windowDidChangeScreen:): join two if statements. 2020-02-23 01:56:33 +02:00
Sergii Stoian
11ff1789e8 * Source/NSMenu.m (_setGeometry): take into account main screen
origin when calculating horizontal menu postion.
2020-02-20 01:11:33 +02:00
Sergii Stoian
557486906a * Source/NSMenu.m (initWithTitle:): moved observer setup for
window notification to applicationDidFinishLaunching: method.
  (setTornOff:): setup oberver for window notifications if menu is
  torn off, uset observer otherwise.
  (applicationDidFinishLaunching:): setup oberver only for main menu.
  (windowDidChangeScreen:): do not process notifications from menu
  windows. Use -netstedSetFrameOrigin for frame change to take care
  of submenus repositioning.
2020-02-14 14:14:05 +02:00
Sergii Stoian
c1c77cc7c0 * Source/NSMenu.m (windowDidChangeScreen:): simplify calculation of
frame X position.
2020-02-14 12:34:20 +02:00
Sergii Stoian
77778fb2bc * Source/NSMenu.m (windowDidChangeScreen:): fixed formatting. 2020-02-12 12:10:14 +02:00
Sergii Stoian
2a1b9d4d54 * Source/NSWindow.m (sendEvent:): set current screen to ivar and
send WindowDidChangeScreen notification if window was moved to other
  screen.

* Source/NSScreen.m (mainScreen): returns screen of main menu if no
  key window exists. With this implementation default screen (screen at
  index 0 in screens array) should never be returned.

* Source/NSMenu.m (initWithTitle:): observe WindowDidBecomeKey and
  WindowDidChangeScreen notifications.
  (windowDidChangeScreen:): new method to handle observed notification
  added above. Moves menu to screen of key window for both cases: when
  key window moved to or activated on different screen.
2020-02-12 01:46:17 +02:00
fredkiefer
618e31ff42 * Source/NSMenu.m (-update): Restructure by splitting up into two
helper methods.
* Source/NSMenu.m (-performKeyEquivalent:): Use new helper method
to only autoenable menu item with matching key equivalent.
2018-01-14 18:41:23 +01:00
fredkiefer
e3d51643ca Protect against [window screen] returning nil. 2017-10-05 23:05:28 +02:00
Fred Kiefer
753415895b 2017-04-01 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSMenu.m (-displayTransient): Update menu before displaying.
	* Source/NSMenuView.m (-attachSubmenuForItemAtIndex:): Use NSMenu
	display method.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@40431 72102866-910b-0410-8b05-ffd578937521
2017-03-31 22:14:50 +00:00
Fred Kiefer
3a89e9e7c5 * Source/NSMenu.m (-_isVisible, -_isMain): Add two helper
methods. And make sure we update the menu items before display and
	keyEquivalent processing.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@40285 72102866-910b-0410-8b05-ffd578937521
2017-01-08 19:33:32 +00:00
Fred Kiefer
baee6ec03b * Source/NSMenu.m (-update): Update only visible submenus.
* Source/NSMenu.m: Complete switch to NSUInteger.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@40283 72102866-910b-0410-8b05-ffd578937521
2016-12-31 16:03:01 +00:00
Sebastian Reitenbach
18910829e4 return value for NSMenu itemAtIndex change from
id<NSMenuItem> to NSMenuitem* as it is done by Apple too
          fixes warnings in NSApplication.m and NSTextView.m

OK Fred Kiefer



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38568 72102866-910b-0410-8b05-ffd578937521
2015-05-26 17:11:17 +00:00
Fred Kiefer
e40611ea6c * Source/NSMenu.m (-update): Added case to menu autoenabler to
disable supermenus that have empty submenus, when there is no
        validator.
        Patch by Paul Landers <paul.landers@testplant.com>.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38289 72102866-910b-0410-8b05-ffd578937521
2015-01-11 21:56:27 +00:00
Fred Kiefer
77ef14dcd8 * Source/NSBox.m (-calcSizesAllowingNegative): Protect against
_cell being nil.
* Source/NSBox.m (-initWithCoder:): Add a few default values.
* Source/NSMenu.m (-_setGeometry): Protect against _aWindow
  being nil.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38003 72102866-910b-0410-8b05-ffd578937521
2014-07-21 08:04:32 +00:00
Germán Arias
405b577cd1 Use arrow cursor in transient menus.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36875 72102866-910b-0410-8b05-ffd578937521
2013-07-12 05:03:34 +00:00
David Chisnall
15a3aec436 When displaying the horizontal menu, set the title of the main menu to the name
of the application, not the name of the process, if the info bundle contains an
application name.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36060 72102866-910b-0410-8b05-ffd578937521
2013-02-05 12:14:20 +00:00
David Chisnall
40fb48e5de Next bit of NSInteger cleanup for -gui.
Fix all of the current warnings in Gorm so that it can be used to test
NSInteger things.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36039 72102866-910b-0410-8b05-ffd578937521
2013-01-30 12:43:27 +00:00
Wolfgang Lux
1d0294acc2 Revert change from r34642 which has broken OS X compatibility and fix
sender of a pop up button's action when it is sent through one of the
menu items.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34781 72102866-910b-0410-8b05-ffd578937521
2012-02-19 16:22:49 +00:00
Fred Kiefer
462b24489f * Source/NSMenu.m (-setMain:): Rearrange code to avoid duplicate
menu for in-window menu themes.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34687 72102866-910b-0410-8b05-ffd578937521
2012-02-01 09:12:34 +00:00
Fred Kiefer
9d0b8b4dfd * Source/NSMenu.m (-setMain:): Remove the in-window menu when
switching to a theme without that.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34652 72102866-910b-0410-8b05-ffd578937521
2012-01-29 00:43:50 +00:00
Fred Kiefer
899ce772cb * Source/NSMenu.m (-performActionForItemAtIndex:): Check for the
popup button cell and its action, before checking for the item
action. This caused a problem due to NIB decoding changes.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34642 72102866-910b-0410-8b05-ffd578937521
2012-01-26 22:38:50 +00:00
Fred Kiefer
8ad4aa86c4 Replace some occurences of int with NSInteger
and unsigned with NSUInteger. This allows to recompile gui on 
64 bit systems after the change to NSNotFound in base.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34312 72102866-910b-0410-8b05-ffd578937521
2011-12-17 17:16:09 +00:00
Fred Kiefer
9d79d0c978 * Source/NSMenu.m (+initialize): Don't create the default menu
zone as we never use it and a change in base made this an
  expensive operation.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33694 72102866-910b-0410-8b05-ffd578937521
2011-08-04 08:52:42 +00:00
David Chisnall
cebd150ee1 Don't create a zone in GC mode (detected at run time). This avoids a warning
when starting GUI apps in GC mode, but should have no real effect on
functionality.

Note: this zone seems to have been created for OpenStep compatibility, but then
we don't actually use it anywhere.  The Cocoa docs say that this is 'The zone
from which NSMenu objects should be allocated', but we allocate NSMenu objects
from the default malloc zone.  

Fred: I think the correct thing to do here is probably to just return
NSDefaultMallocZone() from +menuZone in all modes.  Can you take a look and
see?



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33150 72102866-910b-0410-8b05-ffd578937521
2011-05-27 14:08:35 +00:00
Fred Kiefer
6c54fd6be5 Remove most uses of the method [NSView -removeSubview:].
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33047 72102866-910b-0410-8b05-ffd578937521
2011-05-15 14:42:08 +00:00
Fred Kiefer
e8745434cd * Source/NSMenu.m (-_organizeMenu): Move some code around to avoid
a compiler warning.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32890 72102866-910b-0410-8b05-ffd578937521
2011-04-18 22:24:08 +00:00
Gregory John Casamento
828bc672f6 Add method to ask if the menu should show the icon. In some themes it
is redundant.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32829 72102866-910b-0410-8b05-ffd578937521
2011-04-10 20:14:53 +00:00
Fred Kiefer
b7d056ae43 Removed dead assignments found by static code analyser.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32551 72102866-910b-0410-8b05-ffd578937521
2011-03-13 15:26:20 +00:00
Wolfgang Lux
92601d85d8 Look up key equivalents in the Services menu only after traversing
rest of the main menu to avoid accidentally shadowing key equivalents
in the application's own menus.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31902 72102866-910b-0410-8b05-ffd578937521
2011-01-17 09:02:30 +00:00
Wolfgang Lux
2583abd450 Various fixes for menus in Macintosh interface style (some apply to
Windows95 style as well).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31800 72102866-910b-0410-8b05-ffd578937521
2010-12-30 19:56:03 +00:00
Gregory John Casamento
cc3ce8896e * Source/GSThemeMenu.m: Added implementation for
updateAllWindowsWithMenu:, updateMenu:forWindow:, altered
	implementation for setMenu:forWindow:, added private method
	_setMenu: to set the current menu on the window.
	* Source/GSWindowDecorationView.m: Changes to layout
	* Source/NSMenu.m: Only call the method updateAllWindowsWithMenu:
	when NSMenuInterfaceStyle = NSWindows95InterfaceStyle.
	* Source/NSMenuView.m: Change to -update so that it does not
	render the top bar of the menu if NSMenuInterfaceStyle =
	NSWindows95InterfaceStyle.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31782 72102866-910b-0410-8b05-ffd578937521
2010-12-27 07:05:38 +00:00
Fred Kiefer
d08b23d9b0 First batch of corrections based on David's static analysis.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31337 72102866-910b-0410-8b05-ffd578937521
2010-09-12 16:34:22 +00:00
Eric Wasylishen
26fcda321b Replace sel_eq with sel_isEqual
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31285 72102866-910b-0410-8b05-ffd578937521
2010-09-09 23:50:38 +00:00
Fred Kiefer
72a86ed519 Add missing #import.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31067 72102866-910b-0410-8b05-ffd578937521
2010-08-02 14:00:24 +00:00
Wolfgang Lux
85c794ab22 While shifting a menu on screen that is partially off screen, correctly
handle the cases where the menu is off screen on the top and the left
side of the screen, respectively. This fixes bug #31415.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31038 72102866-910b-0410-8b05-ffd578937521
2010-07-26 19:16:18 +00:00
Doug Simons
ceb0f17569 further refinements to behavior of performKeyEquivalent: methods
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30828 72102866-910b-0410-8b05-ffd578937521
2010-06-22 22:00:47 +00:00
Wolfgang Lux
c4ad9a9278 Fix previous NSMenu change to ignore shift key except when a function
key is pressed. Change NSButton -performKeyEquivalent: in a similar way.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30720 72102866-910b-0410-8b05-ffd578937521
2010-06-15 03:12:37 +00:00
Doug Simons
901555380c Fix menu key equivalents to only trigger when the exact modifiers are held down
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30626 72102866-910b-0410-8b05-ffd578937521
2010-06-08 21:56:15 +00:00
Fred Kiefer
99e273a57d few compiler warning fixes plus a lot of #import replacement.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30448 72102866-910b-0410-8b05-ffd578937521
2010-05-24 10:48:14 +00:00
Gregory John Casamento
562f545bd3 * Headers/Additions/GNUstepGUI/GSTheme.h: Added method
rightMouseMenu:forEvent: to allow theming of transient and
	context menus.
	* Source/GSThemeMenu.m: Implementation of method 
	rightMouseMenu:forEvent: to allow theming of transient and
	context menus.
	* Source/NSMenu.m: use the theming code implemented above instead
	of rendering the menu directly.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30370 72102866-910b-0410-8b05-ffd578937521
2010-05-12 22:47:10 +00:00
Wolfgang Lux
2d56513a18 Fix a small glitch in the previous commit and make use of the setter
method to initialize the private name attribute of an NSMenu.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30364 72102866-910b-0410-8b05-ffd578937521
2010-05-12 09:15:25 +00:00
Wolfgang Lux
14b0075299 Add a private name attribute to menus to identify special purpose
menus. Fixes a bug where the services, windows, and recent documents
menu were defunct when loading the menu from a .nib file.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30363 72102866-910b-0410-8b05-ffd578937521
2010-05-12 09:02:25 +00:00
Doug Simons
b136536052 Only rebuild in-window menus when needed (significant performance improvement)
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30232 72102866-910b-0410-8b05-ffd578937521
2010-04-24 17:12:35 +00:00
Fred Kiefer
6483053f29 Yet another bit of #include -> #import replacement. Replace includes of Foundation.h.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30034 72102866-910b-0410-8b05-ffd578937521
2010-03-25 09:11:50 +00:00
Doug Simons
ce29b8d726 protect changedMessagesEnabled flag; update menus after modal session, key or main window change
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29891 72102866-910b-0410-8b05-ffd578937521
2010-03-09 23:11:40 +00:00