mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-04 00:10:41 +00:00
return back horizontal menu code
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16396 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6d9afde0d7
commit
1dfaefe6bd
3 changed files with 203 additions and 94 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
||||||
|
2003-04-09 Serg Stoyan <stoyan@hologr.com>
|
||||||
|
|
||||||
|
* Source/NSMenuView.m: return back horizontal menu code.
|
||||||
|
(sizeToFit): ditto.
|
||||||
|
(innerRect): ditto.
|
||||||
|
(rectOfItemAtIndex:): ditto.
|
||||||
|
(locationForSubmenu:): ditto.
|
||||||
|
(setWindowFrameForAttachingToRect:): ditto.
|
||||||
|
(encodeWithCoder:): ditto.
|
||||||
|
(initWithCoder:): ditto.
|
||||||
|
(setHorizontal:): added.
|
||||||
|
(isHorizontal): added.
|
||||||
|
|
||||||
|
* Headers/NSMenuView.h:
|
||||||
|
(setHorizontal:): added.
|
||||||
|
(isHorizontal): added.
|
||||||
|
|
||||||
2003-04-09 00:38 Alexander Malmberg <alexander@malmberg.org>
|
2003-04-09 00:38 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
* Source/NSView.m (-setNeedsDisplay:, -setNeedsDisplayInRect:):
|
* Source/NSView.m (-setNeedsDisplay:, -setNeedsDisplayInRect:):
|
||||||
|
|
|
@ -56,23 +56,24 @@
|
||||||
|
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
<strong>How menus are drawn</strong>
|
<strong>How menus are drawn</strong>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|
||||||
This class implements several menu look and feels at the same time.
|
This class implements several menu look and feels at the same time.
|
||||||
The looks and feels implemented are:
|
The looks and feels implemented are:
|
||||||
<list>
|
<list>
|
||||||
<item>
|
<item>
|
||||||
Ordinary vertically stacked menus with the NeXT submenu positioning
|
Ordinary vertically stacked menus with the NeXT submenu positioning
|
||||||
behavour.
|
behavour.
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
Vertically stacked menus with the WindowMaker submenu placement. This
|
Vertically stacked menus with the WindowMaker submenu placement. This
|
||||||
behaviour is selected by choosing the <strong>GSWindowMakerInterfaceStyle</strong>.
|
behaviour is selected by choosing the
|
||||||
</item>
|
<strong>GSWindowMakerInterfaceStyle</strong>.
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
PopupButtons are actually menus. This class implements also the
|
PopupButtons are actually menus. This class implements also the
|
||||||
behaviour for the NSPopButtons. See for the the class NSPopButton.
|
behaviour for the NSPopButtons. See for the the class NSPopButton.
|
||||||
</item>
|
</item>
|
||||||
</list>
|
</list>
|
||||||
*/
|
*/
|
||||||
@interface NSMenuView : NSView <NSCoding, NSMenuView>
|
@interface NSMenuView : NSView <NSCoding, NSMenuView>
|
||||||
|
@ -86,13 +87,13 @@
|
||||||
float _stateImageWidth;
|
float _stateImageWidth;
|
||||||
float _imageAndTitleOffset;
|
float _imageAndTitleOffset;
|
||||||
float _imageAndTitleWidth;
|
float _imageAndTitleWidth;
|
||||||
float _keyEqOffset;
|
float _keyEqOffset;
|
||||||
float _keyEqWidth;
|
float _keyEqWidth;
|
||||||
BOOL _needsSizing;
|
BOOL _needsSizing;
|
||||||
NSSize _cellSize;
|
NSSize _cellSize;
|
||||||
|
|
||||||
@private
|
@private
|
||||||
id _items_link;
|
id _items_link;
|
||||||
int _leftBorderOffset;
|
int _leftBorderOffset;
|
||||||
id _titleView;
|
id _titleView;
|
||||||
}
|
}
|
||||||
|
@ -127,6 +128,19 @@
|
||||||
*/
|
*/
|
||||||
- (NSMenu *) menu;
|
- (NSMenu *) menu;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets menu orientation. If YES menu items are displayed from left
|
||||||
|
to right, if NO from top to bottom (vertically). By default, menu
|
||||||
|
items are displayed vertically.
|
||||||
|
*/
|
||||||
|
- (void) setHorizontal: (BOOL)flag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns YES if menu items are displayed horizontally, NO if
|
||||||
|
vertically.
|
||||||
|
*/
|
||||||
|
- (BOOL) isHorizontal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the default font to use when drawing the menu text.
|
Sets the default font to use when drawing the menu text.
|
||||||
*/
|
*/
|
||||||
|
@ -198,29 +212,29 @@
|
||||||
/**
|
/**
|
||||||
Marks menu item cell associated with the menu item and menu view as
|
Marks menu item cell associated with the menu item and menu view as
|
||||||
needing to be resized. This method is invoked when
|
needing to be resized. This method is invoked when
|
||||||
NSMenuDidChangeItemNotification received. The notification parameter
|
NSMenuDidChangeItemNotification received. The notification parameter
|
||||||
contains index of changed menu item and can be accessed with
|
contains index of changed menu item and can be accessed with
|
||||||
NSMenuItemIndex key.
|
NSMenuItemIndex key.
|
||||||
*/
|
*/
|
||||||
- (void) itemChanged: (NSNotification *)notification;
|
- (void) itemChanged: (NSNotification *)notification;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates new item cell for the newly created menu item, marks cell and
|
Creates new item cell for the newly created menu item, marks cell and
|
||||||
menu view as needing to be resized. This method is invoked when
|
menu view as needing to be resized. This method is invoked when
|
||||||
NSMenuDidAddItemNotification received. The notification parameter
|
NSMenuDidAddItemNotification received. The notification parameter
|
||||||
contains index of changed menu item and can be accessed with
|
contains index of changed menu item and can be accessed with
|
||||||
NSMenuItemIndex key.
|
NSMenuItemIndex key.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
- (void) itemAdded: (NSNotification *)notification;
|
- (void) itemAdded: (NSNotification *)notification;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Removes cell associated with removed menu item, removes highlighting
|
Removes cell associated with removed menu item, removes highlighting
|
||||||
if removed menu item was highlighted, marks cell and menu view as
|
if removed menu item was highlighted, marks cell and menu view as
|
||||||
needing to be resized. This method is invoked when
|
needing to be resized. This method is invoked when
|
||||||
NSMenuDidRemoveItemNotification received. The notification parameter
|
NSMenuDidRemoveItemNotification received. The notification parameter
|
||||||
contains index of changed menu item and can be accessed with
|
contains index of changed menu item and can be accessed with
|
||||||
NSMenuItemIndex key.
|
NSMenuItemIndex key.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
- (void) itemRemoved: (NSNotification *)notification;
|
- (void) itemRemoved: (NSNotification *)notification;
|
||||||
|
@ -235,7 +249,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Attach submenu if the item at index is a submenu. It will figure out
|
Attach submenu if the item at index is a submenu. It will figure out
|
||||||
if the new submenu should be transient or not.
|
if the new submenu should be transient or not.
|
||||||
*/
|
*/
|
||||||
- (void) attachSubmenuForItemAtIndex: (int)index;
|
- (void) attachSubmenuForItemAtIndex: (int)index;
|
||||||
|
|
||||||
|
@ -245,14 +259,14 @@
|
||||||
/**
|
/**
|
||||||
Adds title view for application menu and submenus, removes title view
|
Adds title view for application menu and submenus, removes title view
|
||||||
if menu is owned by NSPopUpButton, adds close button to title view for
|
if menu is owned by NSPopUpButton, adds close button to title view for
|
||||||
torn off menus and removes it for other type of menu.
|
torn off menus and removes it for other type of menu.
|
||||||
*/
|
*/
|
||||||
- (void) update;
|
- (void) update;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the flag whether layout needs to be resized. Set it to YES if
|
Sets the flag whether layout needs to be resized. Set it to YES if
|
||||||
menu contents changed and layout needs to be recalculated. This method
|
menu contents changed and layout needs to be recalculated. This method
|
||||||
is used internally. Yout should not invoke it directly from applications.
|
is used internally. Yout should not invoke it directly from applications.
|
||||||
*/
|
*/
|
||||||
- (void) setNeedsSizing: (BOOL)flag;
|
- (void) setNeedsSizing: (BOOL)flag;
|
||||||
|
|
||||||
|
@ -283,37 +297,37 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the width of the image and title section. Tis section contains
|
Returns the width of the image and title section. Tis section contains
|
||||||
image and text of menu item.
|
image and text of menu item.
|
||||||
*/
|
*/
|
||||||
- (float) imageAndTitleWidth;
|
- (float) imageAndTitleWidth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the starting position for drawing the key equivalent. Key
|
Returns the starting position for drawing the key equivalent. Key
|
||||||
equivalent can be submenu arrow if menu item has submenu.
|
equivalent can be submenu arrow if menu item has submenu.
|
||||||
*/
|
*/
|
||||||
- (float) keyEquivalentOffset;
|
- (float) keyEquivalentOffset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the width of key equivalent text. Key equivalent can be submenu
|
Returns the width of key equivalent text. Key equivalent can be submenu
|
||||||
arrow if menu item has submenu
|
arrow if menu item has submenu
|
||||||
*/
|
*/
|
||||||
- (float) keyEquivalentWidth;
|
- (float) keyEquivalentWidth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns bounds rectangle of the menu view. It is smaller by 1 pixel
|
Returns bounds rectangle of the menu view. It is smaller by 1 pixel
|
||||||
in width than menu window (dark gray border at left).
|
in width than menu window (dark gray border at left).
|
||||||
*/
|
*/
|
||||||
- (NSRect) innerRect;
|
- (NSRect) innerRect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns frame rectangle of menu item cell. It is smaller by 1 pixel
|
Returns frame rectangle of menu item cell. It is smaller by 1 pixel
|
||||||
in width than menu window (dark gray border).
|
in width than menu window (dark gray border).
|
||||||
*/
|
*/
|
||||||
- (NSRect) rectOfItemAtIndex: (int)index;
|
- (NSRect) rectOfItemAtIndex: (int)index;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the index of the item below point. Returns -1 if mouse is
|
Returns the index of the item below point. Returns -1 if mouse is
|
||||||
not above a menu item.
|
not above a menu item.
|
||||||
*/
|
*/
|
||||||
- (int) indexOfItemAtPoint: (NSPoint)point;
|
- (int) indexOfItemAtPoint: (NSPoint)point;
|
||||||
|
|
||||||
|
@ -330,11 +344,11 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Resize menu view frame to be appropriate in size to attach to screenRect
|
Resize menu view frame to be appropriate in size to attach to screenRect
|
||||||
at preferredEdge. For popup's menu, if selectedItemIndex is other than
|
at preferredEdge. For popup's menu, if selectedItemIndex is other than
|
||||||
-1, position view so selected item covers the NSPopUpButton.
|
-1, position view so selected item covers the NSPopUpButton.
|
||||||
|
|
||||||
<br/><strong>NOTE: preffered edge positioning doesn't implemented
|
<br/><strong>NOTE: preffered edge positioning doesn't implemented
|
||||||
yet!</strong>
|
yet!</strong>
|
||||||
*/
|
*/
|
||||||
- (void) setWindowFrameForAttachingToRect: (NSRect)screenRect
|
- (void) setWindowFrameForAttachingToRect: (NSRect)screenRect
|
||||||
onScreen: (NSScreen *)screen
|
onScreen: (NSScreen *)screen
|
||||||
|
@ -363,38 +377,38 @@
|
||||||
attach / detach submenus.
|
attach / detach submenus.
|
||||||
</item>
|
</item>
|
||||||
<item> The flag justAttachedNewSubmenu is set to YES when a new
|
<item> The flag justAttachedNewSubmenu is set to YES when a new
|
||||||
submenu is attached. The effect is that the
|
submenu is attached. The effect is that the
|
||||||
highlighting / attaching / detaching is supressed
|
highlighting / attaching / detaching is supressed
|
||||||
for this menu. This is done so the user is given
|
for this menu. This is done so the user is given
|
||||||
a change to move the mouse pointer into the newly
|
a change to move the mouse pointer into the newly
|
||||||
attached submenu. Otherwise it would immediately
|
attached submenu. Otherwise it would immediately
|
||||||
be removed as the mouse pointer move over another
|
be removed as the mouse pointer move over another
|
||||||
item.
|
item.
|
||||||
|
|
||||||
The logic for resetting the flag is rather adhoc.
|
The logic for resetting the flag is rather adhoc.
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
<item> the flag subMenusNeedRemoving means that we
|
<item> the flag subMenusNeedRemoving means that we
|
||||||
will remove all the submenus after we are done.
|
will remove all the submenus after we are done.
|
||||||
|
|
||||||
This flag is used to clean up the submenus
|
This flag is used to clean up the submenus
|
||||||
when the user has opened a submenu by clicking
|
when the user has opened a submenu by clicking
|
||||||
and wants to close it again by clicking on the
|
and wants to close it again by clicking on the
|
||||||
hihglighted item.
|
hihglighted item.
|
||||||
</item>
|
</item>
|
||||||
<item> When the user released the mouse this method
|
<item> When the user released the mouse this method
|
||||||
will cleanup all the transient menus.
|
will cleanup all the transient menus.
|
||||||
|
|
||||||
Not only its own, but also its attached menu
|
Not only its own, but also its attached menu
|
||||||
and all its transient super menus.
|
and all its transient super menus.
|
||||||
</item>
|
</item>
|
||||||
<item> The clean up is done BEFORE the action is executed.
|
<item> The clean up is done BEFORE the action is executed.
|
||||||
This is needed otherwise `hiding' the application
|
This is needed otherwise `hiding' the application
|
||||||
leaves a dangling menu. If this is not acceptable,
|
leaves a dangling menu. If this is not acceptable,
|
||||||
there should be another mechanism of handling
|
there should be another mechanism of handling
|
||||||
the hiding. BTW besides the `hiding' the application,
|
the hiding. BTW besides the `hiding' the application,
|
||||||
model panels are also a problem when the menu
|
model panels are also a problem when the menu
|
||||||
is not cleared before executing the action.
|
is not cleared before executing the action.
|
||||||
</item>
|
</item>
|
||||||
</list>
|
</list>
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -216,6 +216,18 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
return _menu;
|
return _menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: horizontal orientation related code shoul be removed
|
||||||
|
- (void) setHorizontal: (BOOL)flag
|
||||||
|
{
|
||||||
|
_horizontal = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: horizontal orientation related code shoul be removed
|
||||||
|
- (BOOL) isHorizontal
|
||||||
|
{
|
||||||
|
return _horizontal;
|
||||||
|
}
|
||||||
|
|
||||||
- (void) setFont: (NSFont*)font
|
- (void) setFont: (NSFont*)font
|
||||||
{
|
{
|
||||||
ASSIGN(_font, font);
|
ASSIGN(_font, font);
|
||||||
|
@ -494,7 +506,7 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned howMany = [_itemCells count];
|
unsigned howMany = [_itemCells count];
|
||||||
unsigned wideTitleView = 1;
|
unsigned wideTitleView = 1;
|
||||||
float neededImageAndTitleWidth = 0.0;
|
float neededImageAndTitleWidth = 0.0;
|
||||||
float neededKeyEquivalentWidth = 0.0;
|
float neededKeyEquivalentWidth = 0.0;
|
||||||
float neededStateImageWidth = 0.0;
|
float neededStateImageWidth = 0.0;
|
||||||
|
@ -633,11 +645,22 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
_keyEqOffset = _cellSize.width - _keyEqWidth - popupImageWidth;
|
_keyEqOffset = _cellSize.width - _keyEqWidth - popupImageWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
[self setFrameSize: NSMakeSize (_cellSize.width + _leftBorderOffset,
|
// FIXME: horizontal orientation related code shoul be removed
|
||||||
(howMany * _cellSize.height)
|
if (_horizontal == NO)
|
||||||
+ menuBarHeight)];
|
{
|
||||||
[_titleView setFrame: NSMakeRect (0, howMany * _cellSize.height,
|
[self setFrameSize: NSMakeSize(_cellSize.width + _leftBorderOffset,
|
||||||
NSWidth (_bounds), menuBarHeight)];
|
(howMany * _cellSize.height)
|
||||||
|
+ menuBarHeight)];
|
||||||
|
[_titleView setFrame: NSMakeRect (0, howMany * _cellSize.height,
|
||||||
|
NSWidth (_bounds), menuBarHeight)];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[self setFrameSize: NSMakeSize((howMany * _cellSize.width),
|
||||||
|
_cellSize.height + _leftBorderOffset)];
|
||||||
|
[_titleView setFrame: NSMakeRect (0, 0,
|
||||||
|
_cellSize.width, _cellSize.height + 1)];
|
||||||
|
}
|
||||||
|
|
||||||
_needsSizing = NO;
|
_needsSizing = NO;
|
||||||
}
|
}
|
||||||
|
@ -692,10 +715,21 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
|
|
||||||
- (NSRect) innerRect
|
- (NSRect) innerRect
|
||||||
{
|
{
|
||||||
return NSMakeRect(_bounds.origin.x + _leftBorderOffset,
|
// FIXME: horizontal orientation related code shoul be removed
|
||||||
_bounds.origin.y,
|
if (_horizontal == NO)
|
||||||
_bounds.size.width - _leftBorderOffset,
|
{
|
||||||
_bounds.size.height);
|
return NSMakeRect (_bounds.origin.x + _leftBorderOffset,
|
||||||
|
_bounds.origin.y,
|
||||||
|
_bounds.size.width - _leftBorderOffset,
|
||||||
|
_bounds.size.height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NSMakeRect (_bounds.origin.x,
|
||||||
|
_bounds.origin.y + _leftBorderOffset,
|
||||||
|
_bounds.size.width,
|
||||||
|
_bounds.size.height - _leftBorderOffset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSRect) rectOfItemAtIndex: (int)index
|
- (NSRect) rectOfItemAtIndex: (int)index
|
||||||
|
@ -710,8 +744,17 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
/* Fiddle with the origin so that the item rect is shifted 1 pixel over
|
/* Fiddle with the origin so that the item rect is shifted 1 pixel over
|
||||||
* so we do not draw on the heavy line at origin.x = 0.
|
* so we do not draw on the heavy line at origin.x = 0.
|
||||||
*/
|
*/
|
||||||
theRect.origin.y = _cellSize.height * ([_itemCells count] - index - 1);
|
// FIXME: horizontal orientation related code shoul be removed
|
||||||
theRect.origin.x = _leftBorderOffset;
|
if (_horizontal == NO)
|
||||||
|
{
|
||||||
|
theRect.origin.y = _cellSize.height * ([_itemCells count] - index - 1);
|
||||||
|
theRect.origin.x = _leftBorderOffset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theRect.origin.x = _cellSize.width * index;
|
||||||
|
theRect.origin.y = 0;
|
||||||
|
}
|
||||||
theRect.size = _cellSize;
|
theRect.size = _cellSize;
|
||||||
|
|
||||||
/* NOTE: This returns the correct NSRect for drawing cells, but nothing
|
/* NOTE: This returns the correct NSRect for drawing cells, but nothing
|
||||||
|
@ -763,22 +806,36 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
else
|
else
|
||||||
submenuFrame = NSZeroRect;
|
submenuFrame = NSZeroRect;
|
||||||
|
|
||||||
if (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil)
|
// FIXME: horizontal orientation related code shoul be removed
|
||||||
== GSWindowMakerInterfaceStyle)
|
if (_horizontal == NO)
|
||||||
{
|
{
|
||||||
NSRect aRect = [self rectOfItemAtIndex:
|
if (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil)
|
||||||
[_menu indexOfItemWithSubmenu: aSubmenu]];
|
== GSWindowMakerInterfaceStyle)
|
||||||
NSPoint subOrigin = [_window convertBaseToScreen:
|
{
|
||||||
NSMakePoint(aRect.origin.x, aRect.origin.y)];
|
NSRect aRect = [self rectOfItemAtIndex:
|
||||||
|
[_menu indexOfItemWithSubmenu: aSubmenu]];
|
||||||
|
NSPoint subOrigin = [_window convertBaseToScreen:
|
||||||
|
NSMakePoint(aRect.origin.x, aRect.origin.y)];
|
||||||
|
|
||||||
return NSMakePoint (NSMaxX(frame),
|
return NSMakePoint (NSMaxX(frame),
|
||||||
subOrigin.y - NSHeight(submenuFrame) - 3 +
|
subOrigin.y - NSHeight(submenuFrame) - 3 +
|
||||||
2*[NSMenuView menuBarHeight]);
|
2*[NSMenuView menuBarHeight]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NSMakePoint(NSMaxX(frame),
|
||||||
|
NSMaxY(frame) - NSHeight(submenuFrame));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return NSMakePoint(NSMaxX(frame),
|
NSRect aRect = [self rectOfItemAtIndex:
|
||||||
NSMaxY(frame) - NSHeight(submenuFrame));
|
[_menu indexOfItemWithSubmenu: aSubmenu]];
|
||||||
|
NSPoint subOrigin = [_window convertBaseToScreen:
|
||||||
|
NSMakePoint(NSMinX(aRect),
|
||||||
|
NSMinY(aRect))];
|
||||||
|
|
||||||
|
return NSMakePoint(subOrigin.x, subOrigin.y - NSHeight(submenuFrame));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -817,17 +874,34 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
{
|
{
|
||||||
float f;
|
float f;
|
||||||
|
|
||||||
f = screenRect.size.height * (items - 1);
|
// FIXME: horizontal orientation related code shoul be removed
|
||||||
screenFrame.size.height += f + _leftBorderOffset;
|
if (_horizontal == NO)
|
||||||
screenFrame.origin.y -= f;
|
{
|
||||||
screenFrame.size.width += _leftBorderOffset;
|
f = screenRect.size.height * (items - 1);
|
||||||
screenFrame.origin.x -= _leftBorderOffset;
|
screenFrame.size.height += f + _leftBorderOffset;
|
||||||
|
screenFrame.origin.y -= f;
|
||||||
|
screenFrame.size.width += _leftBorderOffset;
|
||||||
|
screenFrame.origin.x -= _leftBorderOffset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f = screenRect.size.width * (items - 1);
|
||||||
|
screenFrame.size.width += f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute position for popups, if needed
|
// Compute position for popups, if needed
|
||||||
if (selectedItemIndex != -1)
|
if (selectedItemIndex != -1)
|
||||||
{
|
{
|
||||||
screenFrame.origin.y += screenRect.size.height * selectedItemIndex;
|
// FIXME: horizontal orientation related code shoul be removed
|
||||||
|
if (_horizontal == NO)
|
||||||
|
{
|
||||||
|
screenFrame.origin.y += screenRect.size.height * selectedItemIndex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
screenFrame.origin.x -= screenRect.size.width * selectedItemIndex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the frameRect
|
// Get the frameRect
|
||||||
|
@ -1276,6 +1350,8 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
|
|
||||||
[encoder encodeObject: _itemCells];
|
[encoder encodeObject: _itemCells];
|
||||||
[encoder encodeObject: _font];
|
[encoder encodeObject: _font];
|
||||||
|
// FIXME: horizontal orientation related code shoul be removed
|
||||||
|
[encoder encodeValueOfObjCType: @encode(BOOL) at: &_horizontal];
|
||||||
[encoder encodeValueOfObjCType: @encode(float) at: &_horizontalEdgePad];
|
[encoder encodeValueOfObjCType: @encode(float) at: &_horizontalEdgePad];
|
||||||
[encoder encodeValueOfObjCType: @encode(NSSize) at: &_cellSize];
|
[encoder encodeValueOfObjCType: @encode(NSSize) at: &_cellSize];
|
||||||
}
|
}
|
||||||
|
@ -1290,6 +1366,8 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
withObject: self];
|
withObject: self];
|
||||||
|
|
||||||
[decoder decodeValueOfObjCType: @encode(id) at: &_font];
|
[decoder decodeValueOfObjCType: @encode(id) at: &_font];
|
||||||
|
// FIXME: horizontal orientation related code shoul be removed
|
||||||
|
[decoder decodeValueOfObjCType: @encode(BOOL) at: &_horizontal];
|
||||||
[decoder decodeValueOfObjCType: @encode(float) at: &_horizontalEdgePad];
|
[decoder decodeValueOfObjCType: @encode(float) at: &_horizontalEdgePad];
|
||||||
[decoder decodeValueOfObjCType: @encode(NSSize) at: &_cellSize];
|
[decoder decodeValueOfObjCType: @encode(NSSize) at: &_cellSize];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue