mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
NSBox: (re-)implement isOpaque (#254)
This (re-)implements logic where a box is marked as opaque if it is a custom box which is not transparent, but moves the logic to `GSTheme`, allowing themes to override this loggic. This fixes the rendering of custom boxes with a custom fill color; the current implementation would mark them as non-opaque and hence the fill color would not be rendered. - The original implementation (from 1999) always returned `YES` (53bcb50240
) - A more complete implementation was backported from the Testplant branch in 2012 (e85b16bc05
, by @fredkiefer, upstream commit36e77b95f7
) - More recently, the a return value of `NO` was hardcoded (02bc49e2d5
, by @ericwa)
This commit is contained in:
parent
95f302442c
commit
892ed4877e
3 changed files with 15 additions and 12 deletions
|
@ -1339,6 +1339,8 @@ APPKIT_EXPORT_CLASS
|
|||
clipRect: (NSRect)clipRect
|
||||
inView: (NSView *)view;
|
||||
|
||||
- (BOOL) isBoxOpaque: (NSBox *)box;
|
||||
|
||||
- (void) drawBoxInClipRect: (NSRect)clipRect
|
||||
boxType: (NSBoxType)boxType
|
||||
borderType: (NSBorderType)borderType
|
||||
|
|
|
@ -3475,6 +3475,18 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
|
|||
}
|
||||
}
|
||||
|
||||
- (BOOL) isBoxOpaque: (NSBox *)box
|
||||
{
|
||||
if ([box boxType] == NSBoxCustom)
|
||||
{
|
||||
return ![box isTransparent];
|
||||
}
|
||||
else
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) drawBoxInClipRect: (NSRect)clipRect
|
||||
boxType: (NSBoxType)boxType
|
||||
borderType: (NSBorderType)borderType
|
||||
|
|
|
@ -464,18 +464,7 @@
|
|||
|
||||
- (BOOL) isOpaque
|
||||
{
|
||||
// FIXME: Depends on theme; if always returning NO is a performance hit
|
||||
// we can check if GSTheme is going to draw an old-style opaque box
|
||||
// or not.
|
||||
return NO;
|
||||
// if (_box_type == NSBoxCustom)
|
||||
// {
|
||||
// return !_transparent;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return YES;
|
||||
// }
|
||||
return [[GSTheme theme] isBoxOpaque: self];
|
||||
}
|
||||
|
||||
- (NSColor*) fillColor
|
||||
|
|
Loading…
Reference in a new issue