mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-30 10:22:03 +00:00
Merge remote branch 'refs/remotes/cappuccino/master'
This commit is contained in:
commit
b91042eb08
6 files changed
+55
-7
No files matched your search
@@ -480,6 +480,7 @@ CPTexturedBackgroundWindowMask
|
||||
[self close];
|
||||
|
||||
_platformWindow = aPlatformWindow;
|
||||
[_platformWindow setTitle:_title];
|
||||
|
||||
if (wasVisible)
|
||||
[self orderFront:self];
|
||||
@@ -1359,6 +1360,7 @@ CPTexturedBackgroundWindowMask
|
||||
_title = aTitle;
|
||||
|
||||
[_windowView setTitle:aTitle];
|
||||
[_platformWindow setTitle:_title];
|
||||
|
||||
[self _synchronizeMenuBarTitleWithWindowTitle];
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ var PrimaryPlatformWindow = NULL;
|
||||
CPInteger _level;
|
||||
BOOL _hasShadow;
|
||||
unsigned _shadowStyle;
|
||||
CPString _title;
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
DOMWindow _DOMWindow;
|
||||
@@ -258,6 +259,21 @@ var PrimaryPlatformWindow = NULL;
|
||||
return [CPPlatform isBrowser];
|
||||
}
|
||||
|
||||
- (void)setTitle:(CPString)aTitle
|
||||
{
|
||||
_title = aTitle;
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
if (_DOMWindow && _DOMWindow.document)
|
||||
_DOMWindow.document.title = _title;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (CPString)title
|
||||
{
|
||||
return _title;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#if PLATFORM(BROWSER)
|
||||
|
||||
@@ -534,13 +534,14 @@ var ModifierKeyCodes = [
|
||||
if (_DOMWindow)
|
||||
return _DOMWindow.focus();
|
||||
|
||||
_DOMWindow = window.open("", "_blank", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no,left=" + _CGRectGetMinX(_contentRect) + ",top=" + _CGRectGetMinY(_contentRect) + ",width=" + _CGRectGetWidth(_contentRect) + ",height=" + _CGRectGetHeight(_contentRect));
|
||||
_DOMWindow = window.open("about:blank", "_blank", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no,left=" + _CGRectGetMinX(_contentRect) + ",top=" + _CGRectGetMinY(_contentRect) + ",width=" + _CGRectGetWidth(_contentRect) + ",height=" + _CGRectGetHeight(_contentRect));
|
||||
|
||||
[PlatformWindows addObject:self];
|
||||
|
||||
// FIXME: cpSetFrame?
|
||||
_DOMWindow.document.write("<!DOCTYPE html><html lang='en'><head></head><body style='background-color:transparent;'></body></html>");
|
||||
_DOMWindow.document.close();
|
||||
_DOMWindow.document.title = _title;
|
||||
|
||||
if (![CPPlatform isBrowser])
|
||||
{
|
||||
|
||||
@@ -306,12 +306,17 @@ var CPStringRegexSpecialCharacters = [
|
||||
}
|
||||
|
||||
/*!
|
||||
Creates a substring from the beginning of the receiver to the specified index.
|
||||
@param anIndex the last index of the receiver to use for the substring (inclusive)
|
||||
Creates a substring of characters from the receiver, starting at the beginning and up to
|
||||
the given index.
|
||||
|
||||
@param anIndex the index of the receiver where the substring should end (non inclusive)
|
||||
@return the substring
|
||||
*/
|
||||
- (CPString)substringToIndex:(unsigned)anIndex
|
||||
{
|
||||
if (anIndex > length)
|
||||
[CPException raise:CPRangeException reason:"index out of bounds"];
|
||||
|
||||
return substring(0, anIndex);
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,18 @@
|
||||
[self assert:"abcd" equals:["abcd" substringToIndex:4]];
|
||||
[self assert:"abc" equals:["abcd" substringToIndex:3]];
|
||||
[self assert:"" equals:["abcd" substringToIndex:0]];
|
||||
|
||||
var sawException = false;
|
||||
try
|
||||
{
|
||||
[@"abcd" substringToIndex:5];
|
||||
}
|
||||
catch (anException)
|
||||
{
|
||||
sawException = true;
|
||||
[self assert:CPRangeException equals:[anException name]];
|
||||
}
|
||||
[self assertTrue:sawException message:"expected CPRangeException"];
|
||||
}
|
||||
|
||||
- (void)testBoolValue
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
{
|
||||
// This is called when the cib is done loading.
|
||||
// You can implement this method on any object instantiated from a Cib.
|
||||
// It's a useful hook for setting up current UI values, and other things.
|
||||
|
||||
// It's a useful hook for setting up current UI values, and other things.
|
||||
|
||||
// In this case, we want the window from Cib to become our full browser window
|
||||
//[theWindow setFullBridge:YES];
|
||||
|
||||
@@ -40,8 +40,15 @@
|
||||
// [platformWindow orderFront:self];//console.log(CPStringFromRect([theWindow contentRectForFrameRect:[theWindow frame]]));
|
||||
[platformWindow setContentRect:[theWindow contentRectForFrameRect:[theWindow frame]]];
|
||||
|
||||
// [theWindow setTitle:@"My Custom Title"];
|
||||
//[platformWindow orderFront:self];
|
||||
|
||||
// seriously, this test file is dirty :)
|
||||
var slider = [[theWindow contentView] subviews][0];
|
||||
[slider setTarget:self];
|
||||
[slider setAction:@selector(randomTitle:)];
|
||||
[slider setContinuous:NO];
|
||||
|
||||
window.setTimeout(function(){
|
||||
[theWindow orderOut:self];
|
||||
[theWindow setPlatformWindow:platformWindow];
|
||||
@@ -55,9 +62,9 @@ window.setTimeout(function(){
|
||||
window.setTimeout(function(){
|
||||
var view = [[CPView alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 100.0)];
|
||||
[view setBackgroundColor:[CPColor redColor]];
|
||||
|
||||
|
||||
[[theWindow contentView] addSubview:view];},1000);
|
||||
|
||||
|
||||
}, 1000);
|
||||
//window.setTimeout(function() { [platformWindow orderOut:self]; [platformWindow orderFront:self]; }, 2000);
|
||||
|
||||
@@ -75,4 +82,9 @@ window.setTimeout(function(){
|
||||
[platformWindow orderFront:self];
|
||||
}
|
||||
|
||||
- (IBAction)randomTitle:(id)aSender
|
||||
{
|
||||
[theWindow setTitle:@"Window random number " + Math.random(1000)]
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user