-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
theming does not allow to add padding to the menu #220
Comments
if I modify the drawMenuRect to add padding, it does not fit inside the available space - (void) drawMenuRect: (NSRect)rect
inView: (NSView *)view
isHorizontal: (BOOL)horizontal
itemCells: (NSArray *)itemCells
{
int i = 0;
int howMany = [itemCells count];
NSMenuView *menuView = (NSMenuView *)view;
NSRect bounds = [view bounds];
CGFloat padding = 5.0; // Ajusta aquest valor per controlar el padding
[self drawBackgroundForMenuView: menuView
withFrame: bounds
dirtyRect: rect
horizontal: horizontal];
// Draw the menu cells with padding.
for (i = 0; i < howMany; i++)
{
NSRect aRect;
NSMenuItemCell *aCell;
aRect = [menuView rectOfItemAtIndex: i];
// Ajustar el rectangle per afegir padding
if (horizontal) {
aRect.origin.x += padding;
aRect.size.width -= padding * 2;
} else {
aRect.origin.y += padding;
}
if (NSIntersectsRect(rect, aRect) == YES)
{
aCell = [menuView menuItemCellForItemAtIndex: i];
[aCell drawWithFrame: aRect inView: menuView];
}
}
} |
How does this image relate to the code you are showing here. That's not a theme I recognize. Is the attached image to illustrate what you're trying to achieve? |
I tried to add some distance between the limits of the menu popover and the list of items. |
Yes, this is a real issue. Would it be sufficient for you to just have a way to influence the _leftBorderOffset or do you really need a different offset for all the different borders? |
At least different values for horizontal and vertical panning. But why not use NSEdgeInsets? |
looks like menu size is computed at NSMenuView > sizeToFit, it is not possible from a custom theme to add padding between the limits of the menu pop up and the items
see the attached image
The text was updated successfully, but these errors were encountered: