Comments (4)
I ended up adding a text field and simply modifying that. I also added a setTitle
method to my application controller.
from inappstorewindow.
Good idea, I'm trying this way.
Strange thing, if you look at the header file it says
/** The title bar view itself. Add subviews to this view that you want to show in the title bar (e.g. buttons, a toolbar, etc.). This view can also be set if you want to use a different styled title bar aside from the default one (textured, etc.). **/
@property (nonatomic, retain) NSView *titleBarView;
So it seems that the default title should work.
Looking at the code you can found the title setter
- (void)setTitle:(NSString*)title
{
self.windowMenuTitle = title;
if ( ![self isExcludedFromWindowsMenu] )
[NSApp changeWindowsItem:self title:self.windowMenuTitle filename:NO];
}
The problem is the
[NSApp changeWindowsItem:aWindow title:[titleView stringValue] filename:NO];
Now if you look at Chromium it does something similar
http://src.chromium.org/svn/trunk/src/chrome/browser/ui/cocoa/fullscreen_window.mm
Since there's no reason the api is not working properly, there sholud be some drawing issue in the
- (void)drawRect:(NSRect)dirtyRect
from inappstorewindow.
I'm not happy with the solution of subviewing the titleBarView since it needs extra code handling the title bar color changing when going from frontmost to background.
A very basic test is doing something like this
NSSize titleSize=NSMakeSize(120.0,20.0);
NSTextField *titleView = [[NSTextField alloc] initWithFrame:
NSMakeRect(aWindow.titleBarView.frame.size.width/2-titleSize.width/2,
aWindow.titleBarView.frame.size.height/2-titleSize.height/2, titleSize.width, titleSize.height)];
[titleView setBackgroundColor:[NSColor clearColor]];
[titleView setBezeled:NSNoBorder]; // remove the bezeled border
[titleView setEditable:NO];
[titleView setStringValue:@"Window Title"];
[titleView setTextColor:[NSColor grayColor]];
[[aWindow titleBarView] addSubview:titleView];
// handling color control color changes in NSWindow handler?
from inappstorewindow.
There is no title on the window because the title bar view covers the default title bar (including the window title). The text field method is the easiest way to go about doing it. Handling the color change would be simple, just register for notifications for when the window resigns/becomes main and change the color appropriately.
from inappstorewindow.
Related Issues (20)
- when click minButton to hidden the window, then reopen,move mouse to traffic button and remove mouse, the traffic button always show RollOverImage
- Exit full screen mode in Yosemite HOT 7
- dragging to another virtual desktop is not working
- window frame.height grows from start to start if autosave name is not empty, OS X 10.9.3
- README needs update
- setMovable flag doesn't work
- Box behind title Xcode 6.1 GM HOT 2
- Yosemite double click title bar to maximum window not working HOT 1
- Cocoa pod can't find INAppStoreWindow 1.5
- bad window button positioning on Yosemite HOT 4
- TitleTextColor changes only the Window Title !
- bad way to detect yosemite
- crash, creating window from code inherit INAppStoreWindow 10.10.1 HOT 3
- Window widgets are positioned incorrectly in document-based application when showing sheets HOT 2
- Graphite system appearance appears to be ignored
- Where do I start HOT 1
- AppleMiniaturizeOnDoubleClick Isn't working HOT 2
- Window flicker when drag in the original titlebar area and move to top of the screen
- Traffic light buttons HOT 2
- Every Time At the time of Launch : NSWindow warning: adding an unknown subview: HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from inappstorewindow.