Added the possibility to customize the title view look and behavior in a theme

with a GSTitleView subclass.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29419 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Quentin Mathe 2010-01-27 11:29:07 +00:00
parent dc80819ab4
commit 84683f1c4d
4 changed files with 26 additions and 3 deletions

View file

@ -1,6 +1,15 @@
2010-01-27 Quentin Mathe <quentin.mathe@gmail.com>
* NSApplication.m (-_postAndSendEvent:): Added.
* Headers/GNUstepGUI/GSTheme.h:
* Source/GSThemeDrawing.m:
(-titleViewClassForMenuView:): Added the possibility to customize the
title view with this new method.
* Source/NSMenuView.m (-update): Modified to loop uk the title view
class through the active theme rather than just using GSTitleView.
2010-01-27 Quentin Mathe <quentin.mathe@gmail.com>
* Source/NSApplication.m (-_postAndSendEvent:): Added.
* Source/GSDragView
(-_sendLocalEvent:action:position:timestamp:toWindow:): Dispatch drag
events -[NSApp _postAndSendEvent:] to match Mac OS X behavior.

View file

@ -839,7 +839,13 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
inView: (NSView *)controlView
state: (GSThemeControlState)state
isHorizontal: (BOOL)isHorizontal;
/**
* Returns the class used to create the title bar in the given menu view.
*
* By default, returns GSTitleView.<br />
* A subclass can be returned to customize the title view look and behavior.
*/
- (Class) titleViewClassForMenuView: (NSMenuView *)aMenuView;
// NSColorWell drawing method
- (NSRect) drawColorWellBorder: (NSColorWell*)well

View file

@ -46,6 +46,7 @@
#import "AppKit/PSOperators.h"
#import "GNUstepGUI/GSToolbarView.h"
#import "GNUstepGUI/GSTitleView.h"
@implementation GSTheme (Drawing)
@ -717,6 +718,11 @@
}
}
- (Class) titleViewClassForMenuView: (NSMenuView *)aMenuView
{
return [GSTitleView class];
}
// NSColorWell drawing method
- (NSRect) drawColorWellBorder: (NSColorWell*)well
withBounds: (NSRect)bounds

View file

@ -42,6 +42,7 @@
#include "AppKit/PSOperators.h"
#include "AppKit/NSImage.h"
#include "GNUstepGUI/GSTheme.h"
#include "GNUstepGUI/GSTitleView.h"
#include <Foundation/Foundation.h>
@ -600,7 +601,8 @@ static NSMapTable *viewInfo = 0;
if (needTitleView == YES && _titleView == nil)
{
_titleView = [[GSTitleView alloc] initWithOwner: _attachedMenu];
Class titleViewClass = [[GSTheme theme] titleViewClassForMenuView: self];
_titleView = [[titleViewClass alloc] initWithOwner: _attachedMenu];
[self addSubview: _titleView];
RELEASE(_titleView);
}