mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-09 12:17:13 +00:00
Compare commits
43
Commits
v0.9.1-RC3
...
v0.9.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16a70c5c8e | ||
|
|
b78eddd878 | ||
|
|
203942d123 | ||
|
|
5957e71967 | ||
|
|
fdf47eb84e | ||
|
|
6963b37f61 | ||
|
|
379c5294c2 | ||
|
|
fb27f86126 | ||
|
|
133dd39485 | ||
|
|
d50cbb02e6 | ||
|
|
30695e4110 | ||
|
|
3e79d8324d | ||
|
|
71de04787d | ||
|
|
81332fa57e | ||
|
|
191a02a89b | ||
|
|
f4ae6c450b | ||
|
|
f2c53c9f52 | ||
|
|
090fcab8c6 | ||
|
|
d3836c2a52 | ||
|
|
ea8c29356d | ||
|
|
6a942630e4 | ||
|
|
2aa806e52a | ||
|
|
04f1b61534 | ||
|
|
b6119a763e | ||
|
|
0876fd6db9 | ||
|
|
3d106c0716 | ||
|
|
c390b19d4b | ||
|
|
6a735ecda9 | ||
|
|
aada884cff | ||
|
|
b62789bb18 | ||
|
|
eafec339f1 | ||
|
|
ef326dbbb4 | ||
|
|
4bbbcb15f1 | ||
|
|
92cb69b623 | ||
|
|
18ea086ffc | ||
|
|
40b04b7956 | ||
|
|
38dc125fc2 | ||
|
|
378df68995 | ||
|
|
ec330a1090 | ||
|
|
f07543045a | ||
|
|
235b323658 | ||
|
|
54c3cc0187 | ||
|
|
59cc590b51 |
@@ -94,4 +94,3 @@
|
||||
@import "CPWebView.j"
|
||||
@import "CPWindow.j"
|
||||
@import "CPWindowController.j"
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
@class CPAccordionView
|
||||
|
||||
<p>CPAccordionView provides a container for CPAccordionViewItem objects and manages layout state
|
||||
for all sublayout items.</p>
|
||||
for all sub-layout items.</p>
|
||||
|
||||
<strong>Example</strong><br />
|
||||
<pre>
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* Copyright 2008, Jake MacMullin.
|
||||
*
|
||||
* 11/10/2008 Ross Boucher
|
||||
* - Make it conform to style guidelines, general cleanup and ehancements
|
||||
* - Make it conform to style guidelines, general cleanup and enhancements
|
||||
* 11/10/2010 Antoine Mercadal
|
||||
* - Enhancements, better compliance with Cocoa API
|
||||
*
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
@import <Foundation/CPObject.j>
|
||||
@import <Foundation/CPTimer.j>
|
||||
|
||||
@import "CAMediaTimingFunction.j"
|
||||
|
||||
|
||||
+135
-2
@@ -57,7 +57,7 @@ CPRunContinuesResponse = -1002;
|
||||
@ingroup appkit
|
||||
@class CPApplication
|
||||
|
||||
CPApplication is THE way to start up the Cappucino framework for your application to use.
|
||||
CPApplication is THE way to start up the Cappuccino framework for your application to use.
|
||||
Every GUI application has exactly one instance of CPApplication (or of a custom subclass of
|
||||
CPApplication). Your program's main() function can create that instance by calling the
|
||||
\c CPApplicationMain function. A simple example looks like this:
|
||||
@@ -292,11 +292,21 @@ CPRunContinuesResponse = -1002;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the applications icon image. This image is used in the default "About" window.
|
||||
By default this value is pulled from the CPApplicationIcon key in your info.plist file.
|
||||
|
||||
@param anImage - The image to set.
|
||||
*/
|
||||
- (void)setApplicationIconImage:(CPImage)anImage
|
||||
{
|
||||
_applicationIconImage = anImage;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the application icon image. By default this is pulled from the CPApplicationIcon key of info.plist.
|
||||
@return CPImage - Your application icon image.
|
||||
*/
|
||||
- (CPImage)applicationIconImage
|
||||
{
|
||||
if (_applicationIconImage)
|
||||
@@ -309,11 +319,38 @@ CPRunContinuesResponse = -1002;
|
||||
return _applicationIconImage;
|
||||
}
|
||||
|
||||
/*!
|
||||
Opens the standard about panel with no options.
|
||||
*/
|
||||
- (void)orderFrontStandardAboutPanel:(id)sender
|
||||
{
|
||||
[self orderFrontStandardAboutPanelWithOptions:nil];
|
||||
}
|
||||
|
||||
/*!
|
||||
Opens the standard about panel. This method takes a single argument \c options.
|
||||
Options is a dictionary that can contain any of the following keys:
|
||||
<pre>
|
||||
ApplicationName - The name of your application.
|
||||
ApplicationIcon - Application icon image.
|
||||
Version - The full version of your application
|
||||
ApplicationVersion - The shorter version number of your application.
|
||||
Copyright - Human readable copyright information.
|
||||
</pre>
|
||||
|
||||
If you choose not the include any of the above keys, they will default
|
||||
to the following respective keys in your info.plist file.
|
||||
|
||||
<pre>
|
||||
CPBundleName
|
||||
CPApplicationIcon (through a call to -applicationIconImage, see documentation for that method for more details)
|
||||
CPBundleVersion
|
||||
CPBundleShortVersionString
|
||||
CPHumanReadableCopyright
|
||||
</pre>
|
||||
|
||||
@param options - A dictionary with the aboe listed keys. You can pass nil to default to your plist values.
|
||||
*/
|
||||
- (void)orderFrontStandardAboutPanelWithOptions:(CPDictionary)options
|
||||
{
|
||||
if (!_aboutPanel)
|
||||
@@ -573,6 +610,10 @@ CPRunContinuesResponse = -1002;
|
||||
[[anEvent window] sendEvent:anEvent];
|
||||
}
|
||||
|
||||
/*!
|
||||
If the delegate responds to the given selector it will call the method on the delegate,
|
||||
otherwise the method will be passed to CPResponder.
|
||||
*/
|
||||
- (void)doCommandBySelector:(SEL)aSelector
|
||||
{
|
||||
if ([_delegate respondsToSelector:aSelector])
|
||||
@@ -664,6 +705,10 @@ CPRunContinuesResponse = -1002;
|
||||
[aMenu _setMenuName:@"CPMainMenu"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Opens the shared color panel.
|
||||
@param aSender
|
||||
*/
|
||||
- (void)orderFrontColorPanel:(id)aSender
|
||||
{
|
||||
[[CPColorPanel sharedColorPanel] orderFront:self];
|
||||
@@ -832,16 +877,38 @@ CPRunContinuesResponse = -1002;
|
||||
return nil;
|
||||
}
|
||||
|
||||
/*!
|
||||
Fires a callback function when an event matching a given mask occurs.
|
||||
@param aCallback - A js function to be fired.
|
||||
@prarm aMask - An event mask for the next event.
|
||||
@param anExpiration - The date for which this callback expires (not implemented).
|
||||
@param inMode (not implemented).
|
||||
@param shouldDequeue (not implemented).
|
||||
*/
|
||||
- (void)setCallback:(Function)aCallback forNextEventMatchingMask:(unsigned int)aMask untilDate:(CPDate)anExpiration inMode:(CPString)aMode dequeue:(BOOL)shouldDequeue
|
||||
{
|
||||
_eventListeners.push(_CPEventListenerMake(aMask, aCallback));
|
||||
}
|
||||
|
||||
- (CPEvent)setTarget:(id)aTarget selector:(SEL)aSelector forNextEventMatchingMask:(unsigned int)aMask untilDate:(CPDate)anExpiration inMode:(CPString)aMode dequeue:(BOOL)shouldDequeue
|
||||
/*!
|
||||
Assigns a target and action for the next event matching a given event mask.
|
||||
The callback method called will be passed the CPEvent when it fires.
|
||||
|
||||
@param aTarget - The target object for the callback.
|
||||
@param aSelector - The selector which should be called on the target object.
|
||||
@param aMask - The mask for a given event which should trigger the callback.
|
||||
@param anExpiration - The date for which the callback expires (not implemented).
|
||||
@param aMode (not implemented).
|
||||
@param shouldDequeue (not implemented).
|
||||
*/
|
||||
- (void)setTarget:(id)aTarget selector:(SEL)aSelector forNextEventMatchingMask:(unsigned int)aMask untilDate:(CPDate)anExpiration inMode:(CPString)aMode dequeue:(BOOL)shouldDequeue
|
||||
{
|
||||
_eventListeners.push(_CPEventListenerMake(aMask, function (anEvent) { objj_msgSend(aTarget, aSelector, anEvent); }));
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the last event recieved by your application.
|
||||
*/
|
||||
- (CPEvent)currentEvent
|
||||
{
|
||||
return _currentEvent;
|
||||
@@ -871,6 +938,19 @@ CPRunContinuesResponse = -1002;
|
||||
[aWindow _attachSheet:aSheet modalDelegate:aModalDelegate didEndSelector:aDidEndSelector contextInfo:aContextInfo];
|
||||
}
|
||||
|
||||
/*!
|
||||
Ends a sheet modal.
|
||||
The following are predefined return codes:
|
||||
|
||||
<pre>
|
||||
CPRunStoppedResponse
|
||||
CPRunAbortedResponse
|
||||
CPRunContinuesResponse
|
||||
</pre>
|
||||
|
||||
@param sheet - The window object (sheet) to dismiss.
|
||||
@param returnCode - The return code to send to the delegate. You can use one of the return codes above or a custom value that you define.
|
||||
*/
|
||||
- (void)endSheet:(CPWindow)sheet returnCode:(int)returnCode
|
||||
{
|
||||
var count = [_windows count];
|
||||
@@ -889,11 +969,31 @@ CPRunContinuesResponse = -1002;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Ends a sheet and sends the return code "0".
|
||||
@param sheet - The CPWindow object (sheet) that should be dismissed.
|
||||
*/
|
||||
- (void)endSheet:(CPWindow)sheet
|
||||
{
|
||||
// FIX ME: this is wrong: by Cocoa this should be: CPRunStoppedResponse.
|
||||
[self endSheet:sheet returnCode:0];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns and array of slash seperated arugments to your application.
|
||||
These values are pulled from your window location hash.
|
||||
|
||||
For exampled if your application loaded:
|
||||
<pre>
|
||||
index.html#280north/cappuccino/issues
|
||||
</pre>
|
||||
The follow array would be returned:
|
||||
<pre>
|
||||
["280north", "cappuccino", "issues"]
|
||||
</pre>
|
||||
|
||||
@return CPArray - The array of arguments.
|
||||
*/
|
||||
- (CPArray)arguments
|
||||
{
|
||||
if (_fullArgsString !== window.location.hash)
|
||||
@@ -902,6 +1002,22 @@ CPRunContinuesResponse = -1002;
|
||||
return _args;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the arguments of your application.
|
||||
That is, set the slash seperated values of an array as the window location hash.
|
||||
|
||||
For example if you pass an array:
|
||||
<pre>
|
||||
["280north", "cappuccino", "issues"]
|
||||
</pre>
|
||||
|
||||
The new window location would be
|
||||
<pre>
|
||||
index.html#280north/cappuccino/issues
|
||||
</pre>
|
||||
|
||||
@param args - An array of arguments.
|
||||
*/
|
||||
- (void)setArguments:(CPArray)args
|
||||
{
|
||||
if (!args || args.length == 0)
|
||||
@@ -943,6 +1059,23 @@ CPRunContinuesResponse = -1002;
|
||||
_args = [];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a dictionary of the window location named arguments.
|
||||
For example if your location was:
|
||||
<pre>
|
||||
index.html?owner=280north&repo=cappuccino&type=issues
|
||||
</pre>
|
||||
|
||||
a CPDictionary with the keys:
|
||||
<pre>
|
||||
owner, repo, type
|
||||
</pre>
|
||||
and respective values:
|
||||
<pre>
|
||||
280north, cappuccino, issues
|
||||
</pre>
|
||||
Will be returned.
|
||||
*/
|
||||
- (CPDictionary)namedArguments
|
||||
{
|
||||
return _namedArgs;
|
||||
|
||||
+112
-22
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
/*
|
||||
* CPArrayController.j
|
||||
* AppKit
|
||||
@@ -46,10 +44,12 @@
|
||||
BOOL _selectsInsertedObjects;
|
||||
BOOL _alwaysUsesMultipleValuesMarker;
|
||||
|
||||
id _selectionIndexes;
|
||||
id _sortDescriptors;
|
||||
id _filterPredicate;
|
||||
id _arrangedObjects;
|
||||
BOOL _automaticallyRearrangesObjects; // FIXME: Not in use
|
||||
|
||||
CPIndexSet _selectionIndexes;
|
||||
CPArray _sortDescriptors;
|
||||
CPPredicate _filterPredicate;
|
||||
CPArray _arrangedObjects;
|
||||
}
|
||||
|
||||
+ (void)initialize
|
||||
@@ -116,13 +116,29 @@
|
||||
|
||||
if (self)
|
||||
{
|
||||
_sortDescriptors = [CPArray array];
|
||||
_selectionIndexes = [CPIndexSet indexSet];
|
||||
_preservesSelection = YES;
|
||||
_selectsInsertedObjects = YES;
|
||||
_avoidsEmptySelection = YES;
|
||||
_clearsFilterPredicateOnInsertion = YES;
|
||||
_alwaysUsesMultipleValuesMarker = NO;
|
||||
_automaticallyRearrangesObjects = NO;
|
||||
|
||||
_filterRestrictsInsertion = YES; // FIXME: Not in use
|
||||
|
||||
[self _init];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)_init
|
||||
{
|
||||
_sortDescriptors = [CPArray array];
|
||||
_filterPredicate = nil;
|
||||
_selectionIndexes = [CPIndexSet indexSet];
|
||||
_arrangedObjects = nil;
|
||||
}
|
||||
|
||||
- (void)prepareContent
|
||||
{
|
||||
[self _setContentArray:[[self newObject]]];
|
||||
@@ -156,7 +172,7 @@
|
||||
|
||||
/*!
|
||||
Sets whether the controller will automatically select objects as they are inserted.
|
||||
@return BOOL aFlag - YES if new objects are selected, otherwise NO.
|
||||
@return BOOL - YES if new objects are selected, otherwise NO.
|
||||
*/
|
||||
- (void)setSelectsInsertedObjects:(BOOL)value
|
||||
{
|
||||
@@ -164,7 +180,7 @@
|
||||
}
|
||||
|
||||
/*!
|
||||
@return BOOL aFlag - Returns YES if the controller should try to avoid an empty selection otherwise NO.
|
||||
@return BOOL - YES if the controller should try to avoid an empty selection otherwise NO.
|
||||
*/
|
||||
- (BOOL)avoidsEmptySelection
|
||||
{
|
||||
@@ -173,13 +189,83 @@
|
||||
|
||||
/*!
|
||||
Sets whether the controller should try to avoid an empty selection.
|
||||
@param BOOL aFlag - YES if the reciver should attempt to avoid an empty selection, otherwise NO.
|
||||
@param BOOL aFlag - YES if the receiver should attempt to avoid an empty selection, otherwise NO.
|
||||
*/
|
||||
- (void)setAvoidsEmptySelection:(BOOL)value
|
||||
{
|
||||
_avoidsEmptySelection = value;
|
||||
}
|
||||
|
||||
/*!
|
||||
Whether the receiver will clear its filter predicate when a new object is inserted.
|
||||
|
||||
@return BOOL YES if the receiver clears filter predicates on insert
|
||||
*/
|
||||
- (BOOL)clearsFilterPredicateOnInsertion
|
||||
{
|
||||
return _clearsFilterPredicateOnInsertion;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets whether the receiver should clear its filter predicate when a new object is inserted.
|
||||
|
||||
@param BOOL YES if the receiver should clear filter predicates on insert
|
||||
*/
|
||||
- (void)setClearsFilterPredicateOnInsertion:(BOOL)aFlag
|
||||
{
|
||||
_clearsFilterPredicateOnInsertion = aFlag;
|
||||
}
|
||||
|
||||
/*!
|
||||
Whether the receiver will always return the multiple values marker when multiple
|
||||
items are selected, even if the items have the same value.
|
||||
|
||||
@return BOOL YES if the receiver always uses the multiple values marker
|
||||
*/
|
||||
- (BOOL)alwaysUsesMultipleValuesMarker
|
||||
{
|
||||
return _alwaysUsesMultipleValuesMarker;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets whether the receiver should always return the multiple values marker when multiple
|
||||
items are selected, even if the items have the same value.
|
||||
|
||||
@param BOOL aFlag YES if the receiver should always use the multiple values marker
|
||||
*/
|
||||
- (void)setAlwaysUsesMultipleValuesMarker:(BOOL)aFlag
|
||||
{
|
||||
_alwaysUsesMultipleValuesMarker = aFlag;
|
||||
}
|
||||
|
||||
/*!
|
||||
Whether the receiver will rearrange its contents automatically whenever the sort
|
||||
descriptors or filter predicates are changed.
|
||||
|
||||
NOTE: not yet implemented. Cappuccino always act as if this value was YES.
|
||||
|
||||
@return BOOL YES if the receiver will automatically rearrange its content on new sort
|
||||
descriptors or filter predicates
|
||||
*/
|
||||
- (BOOL)automaticallyRearrangesObjects
|
||||
{
|
||||
return _automaticallyRearrangesObjects;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets whether the receiver should rearrange its contents automatically whenever the sort
|
||||
descriptors or filter predicates are changed.
|
||||
|
||||
NOTE: not yet implemented. Cappuccino always act as if this value was YES.
|
||||
|
||||
@param BOOL YES if the receiver should automatically rearrange its content on new sort
|
||||
descriptors or filter predicates
|
||||
*/
|
||||
- (void)setAutomaticallyRearrangesObjects:(BOOL)aFlag
|
||||
{
|
||||
_automaticallyRearrangesObjects = aFlag;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the controller's content object.
|
||||
|
||||
@@ -220,7 +306,7 @@
|
||||
// We need to be in control of when notifications fire.
|
||||
_contentObject = value;
|
||||
|
||||
if (_clearsFilterPredicateOnInsertion)
|
||||
if (_clearsFilterPredicateOnInsertion && _filterPredicate != nil)
|
||||
[self __setFilterPredicate:nil]; // Causes a _rearrangeObjects.
|
||||
else
|
||||
[self _rearrangeObjects];
|
||||
@@ -252,7 +338,7 @@
|
||||
|
||||
/*!
|
||||
Returns the content array of the controller.
|
||||
@return id the content array of the reciever
|
||||
@return id the content array of the receiver
|
||||
*/
|
||||
- (id)contentArray
|
||||
{
|
||||
@@ -260,7 +346,7 @@
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the content of the reciever as a CPSet.
|
||||
Returns the content of the receiver as a CPSet.
|
||||
|
||||
@return id - the content of the controller as a set.
|
||||
*/
|
||||
@@ -280,7 +366,7 @@
|
||||
var filterPredicate = [self filterPredicate],
|
||||
sortDescriptors = [self sortDescriptors];
|
||||
|
||||
if (filterPredicate && sortDescriptors)
|
||||
if (filterPredicate && [sortDescriptors count] > 0)
|
||||
{
|
||||
var sortedObjects = [objects filteredArrayUsingPredicate:filterPredicate];
|
||||
[sortedObjects sortUsingDescriptors:sortDescriptors];
|
||||
@@ -288,7 +374,7 @@
|
||||
}
|
||||
else if (filterPredicate)
|
||||
return [objects filteredArrayUsingPredicate:filterPredicate];
|
||||
else if (sortDescriptors)
|
||||
else if ([sortDescriptors count] > 0)
|
||||
return [objects sortedArrayUsingDescriptors:sortDescriptors];
|
||||
|
||||
return [objects copy];
|
||||
@@ -338,7 +424,7 @@
|
||||
if (_arrangedObjects === value)
|
||||
return;
|
||||
|
||||
_arrangedObjects = [[_CPObservableArray alloc] initWithArray:value];
|
||||
_arrangedObjects = [[_CPObservableArray alloc] initWithArray:value];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -376,7 +462,7 @@
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the predicate used by the controller to filter the contents of the reciever.
|
||||
Returns the predicate used by the controller to filter the contents of the receiver.
|
||||
If no predicate is set nil is returned.
|
||||
|
||||
@return CPPredicate the predicate used by the controller
|
||||
@@ -434,7 +520,7 @@
|
||||
/*!
|
||||
Sets the selected index
|
||||
|
||||
@param unsided anIndex - the new index to select
|
||||
@param unsigned anIndex - the new index to select
|
||||
@return BOOL - Returns YES if the selection was changed, otherwise NO.
|
||||
*/
|
||||
- (BOOL)setSelectionIndex:(unsigned)index
|
||||
@@ -647,7 +733,7 @@
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds an object at a given index to the reciever's collection.
|
||||
Adds an object at a given index to the receiver's collection.
|
||||
|
||||
@param id anObject - The object to add to the collection.
|
||||
@param int anIndex - The index to insert the object at.
|
||||
@@ -684,7 +770,7 @@
|
||||
}
|
||||
|
||||
/*!
|
||||
Removes a given object from the reciever's collection.
|
||||
Removes a given object from the receiver's collection.
|
||||
|
||||
@param id anObject - The object to remove from the collection.
|
||||
*/
|
||||
@@ -829,7 +915,8 @@ var CPArrayControllerAvoidsEmptySelection = @"CPArrayControllerAvoid
|
||||
CPArrayControllerFilterRestrictsInsertion = @"CPArrayControllerFilterRestrictsInsertion",
|
||||
CPArrayControllerPreservesSelection = @"CPArrayControllerPreservesSelection",
|
||||
CPArrayControllerSelectsInsertedObjects = @"CPArrayControllerSelectsInsertedObjects",
|
||||
CPArrayControllerAlwaysUsesMultipleValuesMarker = @"CPArrayControllerAlwaysUsesMultipleValuesMarker";
|
||||
CPArrayControllerAlwaysUsesMultipleValuesMarker = @"CPArrayControllerAlwaysUsesMultipleValuesMarker",
|
||||
CPArrayControllerAutomaticallyRearrangesObjects = @"CPArrayControllerAutomaticallyRearrangesObjects";
|
||||
|
||||
@implementation CPArrayController (CPCoding)
|
||||
|
||||
@@ -845,6 +932,8 @@ var CPArrayControllerAvoidsEmptySelection = @"CPArrayControllerAvoid
|
||||
_preservesSelection = [aCoder decodeBoolForKey:CPArrayControllerPreservesSelection];
|
||||
_selectsInsertedObjects = [aCoder decodeBoolForKey:CPArrayControllerSelectsInsertedObjects];
|
||||
_alwaysUsesMultipleValuesMarker = [aCoder decodeBoolForKey:CPArrayControllerAlwaysUsesMultipleValuesMarker];
|
||||
_automaticallyRearrangesObjects = [aCoder decodeBoolForKey:CPArrayControllerAutomaticallyRearrangesObjects];
|
||||
_sortDescriptors = [CPArray array];
|
||||
|
||||
if (![self content] && [self automaticallyPreparesContent])
|
||||
[self prepareContent];
|
||||
@@ -865,6 +954,7 @@ var CPArrayControllerAvoidsEmptySelection = @"CPArrayControllerAvoid
|
||||
[aCoder encodeBool:_preservesSelection forKey:CPArrayControllerPreservesSelection];
|
||||
[aCoder encodeBool:_selectsInsertedObjects forKey:CPArrayControllerSelectsInsertedObjects];
|
||||
[aCoder encodeBool:_alwaysUsesMultipleValuesMarker forKey:CPArrayControllerAlwaysUsesMultipleValuesMarker];
|
||||
[aCoder encodeBool:_automaticallyRearrangesObjects forKey:CPArrayControllerAutomaticallyRearrangesObjects];
|
||||
}
|
||||
|
||||
- (void)awakeFromCib
|
||||
|
||||
@@ -38,7 +38,7 @@ var DefaultLineWidth = 1.0;
|
||||
@class CPBezierPath
|
||||
|
||||
A CPBezierPath allows you to create paths for drawing to the screen using a simpler API than CoreGraphics.
|
||||
Paths can form any shape, including regular polgyons like squares and triangles; circles, arcs; or complex
|
||||
Paths can form any shape, including regular polygons like squares and triangles; circles, arcs; or complex
|
||||
line segments.
|
||||
|
||||
A path can be stroked and filled using the relevant method. The currently active fill and stroke color will
|
||||
|
||||
+2
-2
@@ -235,8 +235,8 @@ CPGrooveBorder = 3;
|
||||
switch (_boxType)
|
||||
{
|
||||
case CPBoxSeparator:
|
||||
// NSBox does not include a horitontal flag for the seperator type. We have to determine
|
||||
// the type of seperator to draw by the width and height of the frame.
|
||||
// NSBox does not include a horizontal flag for the separator type. We have to determine
|
||||
// the type of separator to draw by the width and height of the frame.
|
||||
if (CGRectGetWidth(bounds) === 5.0)
|
||||
return [self _drawVerticalSeperatorInRect:bounds];
|
||||
else if (CGRectGetHeight(bounds) === 5.0)
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ var cachedBlackColor,
|
||||
}
|
||||
|
||||
/*!
|
||||
@deprecated in favor of colorWithWhite:apha:
|
||||
@deprecated in favor of colorWithWhite:alpha:
|
||||
|
||||
Creates a new color object with \c white for the RGB components.
|
||||
For the alpha component, a value of 1.0 is opaque, and 0.0 means completely transparent.
|
||||
|
||||
@@ -57,7 +57,7 @@ CPJavascriptRemedialKeySupport = 1 << 16;
|
||||
CPJavaScriptShadowFeature = 1 << 20;
|
||||
|
||||
CPJavaScriptNegativeMouseWheelValues = 1 << 22;
|
||||
CPJavaScriptMouseWheelValues_8_15 = 1 << 23
|
||||
CPJavaScriptMouseWheelValues_8_15 = 1 << 23;
|
||||
|
||||
CPOpacityRequiresFilterFeature = 1 << 24;
|
||||
|
||||
|
||||
+170
-30
@@ -43,21 +43,21 @@ CPLineBreakByTruncatingHead = 3;
|
||||
CPLineBreakByTruncatingTail = 4;
|
||||
CPLineBreakByTruncatingMiddle = 5;
|
||||
|
||||
CPTopVerticalTextAlignment = 1,
|
||||
CPCenterVerticalTextAlignment = 2,
|
||||
CPTopVerticalTextAlignment = 1;
|
||||
CPCenterVerticalTextAlignment = 2;
|
||||
CPBottomVerticalTextAlignment = 3;
|
||||
|
||||
CPScaleProportionally = 0;
|
||||
CPScaleToFit = 1;
|
||||
CPScaleNone = 2;
|
||||
CPScaleProportionally = 0;
|
||||
CPScaleToFit = 1;
|
||||
CPScaleNone = 2;
|
||||
|
||||
CPNoImage = 0;
|
||||
CPImageOnly = 1;
|
||||
CPImageLeft = 2;
|
||||
CPImageRight = 3;
|
||||
CPImageBelow = 4;
|
||||
CPImageAbove = 5;
|
||||
CPImageOverlaps = 6;
|
||||
CPNoImage = 0;
|
||||
CPImageOnly = 1;
|
||||
CPImageLeft = 2;
|
||||
CPImageRight = 3;
|
||||
CPImageBelow = 4;
|
||||
CPImageAbove = 5;
|
||||
CPImageOverlaps = 6;
|
||||
|
||||
CPOnState = 1;
|
||||
CPOffState = 0;
|
||||
@@ -72,7 +72,7 @@ CPControlTextDidBeginEditingNotification = "CPControlTextDidBeginEditingNotif
|
||||
CPControlTextDidChangeNotification = "CPControlTextDidChangeNotification";
|
||||
CPControlTextDidEndEditingNotification = "CPControlTextDidEndEditingNotification";
|
||||
|
||||
var CPControlBlackColor = [CPColor blackColor];
|
||||
var CPControlBlackColor = [CPColor blackColor];
|
||||
|
||||
/*!
|
||||
@ingroup appkit
|
||||
@@ -171,7 +171,8 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the receiver's target action
|
||||
Sets the receiver's target action.
|
||||
|
||||
@param anAction Sets the action message that gets sent to the target.
|
||||
*/
|
||||
- (void)setAction:(SEL)anAction
|
||||
@@ -180,7 +181,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the receiver's target action
|
||||
Returns the receiver's target action.
|
||||
*/
|
||||
- (SEL)action
|
||||
{
|
||||
@@ -189,6 +190,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
|
||||
/*!
|
||||
Sets the receiver's target. The target receives action messages from the receiver.
|
||||
|
||||
@param aTarget the object that will receive the message specified by action
|
||||
*/
|
||||
- (void)setTarget:(id)aTarget
|
||||
@@ -206,6 +208,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
|
||||
/*!
|
||||
Causes \c anAction to be sent to \c anObject.
|
||||
|
||||
@param anAction the action to send
|
||||
@param anObject the object to which the action will be sent
|
||||
*/
|
||||
@@ -226,6 +229,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
|
||||
/*!
|
||||
Sets the tooltip for the receiver.
|
||||
|
||||
@param aToolTip the tooltip
|
||||
*/
|
||||
/*
|
||||
@@ -262,7 +266,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
|
||||
/*!
|
||||
Sets whether the cell can continuously send its action messages.
|
||||
*/
|
||||
*/
|
||||
- (void)setContinuous:(BOOL)flag
|
||||
{
|
||||
// Some subclasses should redefine this with CPLeftMouseDraggedMask
|
||||
@@ -272,6 +276,9 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
_sendActionOn &= ~CPPeriodicMask;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns YES if the receiver tracks the mouse outside the frame, otherwise NO.
|
||||
*/
|
||||
- (BOOL)tracksMouseOutsideOfFrame
|
||||
{
|
||||
return NO;
|
||||
@@ -334,6 +341,11 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Perform a click on the receiver.
|
||||
|
||||
@param sender - The sender object
|
||||
*/
|
||||
- (void)performClick:(id)sender
|
||||
{
|
||||
if (![self isEnabled])
|
||||
@@ -356,11 +368,18 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
Fired when the button timer finished, usually after the user hits enter.
|
||||
*/
|
||||
- (void)unhighlightButtonTimerDidFinish:(id)sender
|
||||
{
|
||||
[self highlight:NO];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the mask of modifier keys held down when the user clicked.
|
||||
*/
|
||||
- (unsigned)mouseDownFlags
|
||||
{
|
||||
return _trackingMouseDownFlags;
|
||||
@@ -411,7 +430,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the receiver's object value
|
||||
Returns the receiver's object value.
|
||||
*/
|
||||
- (id)objectValue
|
||||
{
|
||||
@@ -419,7 +438,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
}
|
||||
|
||||
/*!
|
||||
Set's the receiver's object value
|
||||
Sets the receiver's object value.
|
||||
*/
|
||||
- (void)setObjectValue:(id)anObject
|
||||
{
|
||||
@@ -430,7 +449,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the receiver's float value
|
||||
Returns the receiver's float value.
|
||||
*/
|
||||
- (float)floatValue
|
||||
{
|
||||
@@ -439,7 +458,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the receiver's float value
|
||||
Sets the receiver's float value.
|
||||
*/
|
||||
- (void)setFloatValue:(float)aValue
|
||||
{
|
||||
@@ -447,7 +466,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the receiver's double value
|
||||
Returns the receiver's double value.
|
||||
*/
|
||||
- (double)doubleValue
|
||||
{
|
||||
@@ -456,7 +475,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
}
|
||||
|
||||
/*!
|
||||
Set's the receiver's double value
|
||||
Sets the receiver's double value.
|
||||
*/
|
||||
- (void)setDoubleValue:(double)anObject
|
||||
{
|
||||
@@ -464,7 +483,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the receiver's int value
|
||||
Returns the receiver's int value.
|
||||
*/
|
||||
- (int)intValue
|
||||
{
|
||||
@@ -473,7 +492,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
}
|
||||
|
||||
/*!
|
||||
Set's the receiver's int value
|
||||
Sets the receiver's int value.
|
||||
*/
|
||||
- (void)setIntValue:(int)anObject
|
||||
{
|
||||
@@ -481,7 +500,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the receiver's int value
|
||||
Returns the receiver's int value.
|
||||
*/
|
||||
- (int)integerValue
|
||||
{
|
||||
@@ -490,7 +509,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
}
|
||||
|
||||
/*!
|
||||
Set's the receiver's int value
|
||||
Sets the receiver's int value.
|
||||
*/
|
||||
- (void)setIntegerValue:(int)anObject
|
||||
{
|
||||
@@ -498,7 +517,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the receiver's string value
|
||||
Returns the receiver's string value.
|
||||
*/
|
||||
- (CPString)stringValue
|
||||
{
|
||||
@@ -506,7 +525,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
}
|
||||
|
||||
/*!
|
||||
Set's the receiver's string value
|
||||
Sets the receiver's string value.
|
||||
*/
|
||||
- (void)setStringValue:(CPString)anObject
|
||||
{
|
||||
@@ -582,96 +601,199 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
[[CPNotificationCenter defaultCenter] postNotificationName:CPControlTextDidEndEditingNotification object:self userInfo:[CPDictionary dictionaryWithObject:[note object] forKey:"CPFieldEditor"]];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the text alignment of the control.
|
||||
|
||||
<pre>
|
||||
CPLeftTextAlignment
|
||||
CPCenterTextAlignment
|
||||
CPRightTextAlignment
|
||||
CPJustifiedTextAlignment
|
||||
CPNaturalTextAlignment
|
||||
</pre>
|
||||
*/
|
||||
- (void)setAlignment:(CPTextAlignment)alignment
|
||||
{
|
||||
[self setValue:alignment forThemeAttribute:@"alignment"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the text alignment of the control.
|
||||
*/
|
||||
- (CPTextAlignment)alignment
|
||||
{
|
||||
return [self valueForThemeAttribute:@"alignment"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the vertical text alignment of the control.
|
||||
|
||||
<pre>
|
||||
CPTopVerticalTextAlignment
|
||||
CPCenterVerticalTextAlignment
|
||||
CPBottomVerticalTextAlignment
|
||||
</pre>
|
||||
*/
|
||||
- (void)setVerticalAlignment:(CPTextVerticalAlignment)alignment
|
||||
{
|
||||
[self setValue:alignment forThemeAttribute:@"vertical-alignment"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the vertical text alignment of the receiver.
|
||||
*/
|
||||
- (CPTextVerticalAlignment)verticalAlignment
|
||||
{
|
||||
return [self valueForThemeAttribute:@"vertical-alignment"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the line break mode of the receiver.
|
||||
|
||||
<pre>
|
||||
CPLineBreakByWordWrapping
|
||||
CPLineBreakByCharWrapping
|
||||
CPLineBreakByClipping
|
||||
CPLineBreakByTruncatingHead
|
||||
CPLineBreakByTruncatingTail
|
||||
CPLineBreakByTruncatingMiddle
|
||||
</pre>
|
||||
*/
|
||||
- (void)setLineBreakMode:(CPLineBreakMode)mode
|
||||
{
|
||||
[self setValue:mode forThemeAttribute:@"line-break-mode"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the line break mode of the control.
|
||||
*/
|
||||
- (CPLineBreakMode)lineBreakMode
|
||||
{
|
||||
return [self valueForThemeAttribute:@"line-break-mode"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the text color of the receiver.
|
||||
|
||||
@param aColor - A CPColor object.
|
||||
*/
|
||||
- (void)setTextColor:(CPColor)aColor
|
||||
{
|
||||
[self setValue:aColor forThemeAttribute:@"text-color"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the text color of the receiver.
|
||||
*/
|
||||
- (CPColor)textColor
|
||||
{
|
||||
return [self valueForThemeAttribute:@"text-color"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the shadow color of the text for the receiver.
|
||||
*/
|
||||
- (void)setTextShadowColor:(CPColor)aColor
|
||||
{
|
||||
[self setValue:aColor forThemeAttribute:@"text-shadow-color"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the shadow color of the text for the control.
|
||||
*/
|
||||
- (CPColor)textShadowColor
|
||||
{
|
||||
return [self valueForThemeAttribute:@"text-shadow-color"];
|
||||
}
|
||||
|
||||
- (void)setTextShadowOffset:(float)offset
|
||||
/*!
|
||||
Sets the shadow offset for the text.
|
||||
|
||||
@param offset - a CGSize with the x and y offsets.
|
||||
*/
|
||||
- (void)setTextShadowOffset:(CGSize)offset
|
||||
{
|
||||
[self setValue:offset forThemeAttribute:@"text-shadow-offset"];
|
||||
}
|
||||
|
||||
- (float)textShadowOffset
|
||||
/*!
|
||||
Returns the text shadow offset of the receiver.
|
||||
*/
|
||||
- (CGSize)textShadowOffset
|
||||
{
|
||||
return [self valueForThemeAttribute:@"text-shadow-offset"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the font of the control.
|
||||
*/
|
||||
- (void)setFont:(CPFont)aFont
|
||||
{
|
||||
[self setValue:aFont forThemeAttribute:@"font"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the font of the control.
|
||||
*/
|
||||
- (CPFont)font
|
||||
{
|
||||
return [self valueForThemeAttribute:@"font"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the image position of the control.
|
||||
|
||||
<pre>
|
||||
CPNoImage
|
||||
CPImageOnly
|
||||
CPImageLeft
|
||||
CPImageRight
|
||||
CPImageBelow
|
||||
CPImageAbove
|
||||
CPImageOverlaps
|
||||
</pre>
|
||||
*/
|
||||
- (void)setImagePosition:(CPCellImagePosition)position
|
||||
{
|
||||
[self setValue:position forThemeAttribute:@"image-position"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the image position of the receiver.
|
||||
*/
|
||||
- (CPCellImagePosition)imagePosition
|
||||
{
|
||||
return [self valueForThemeAttribute:@"image-position"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the image scaling of the control.
|
||||
|
||||
<pre>
|
||||
CPScaleProportionally
|
||||
CPScaleToFit
|
||||
CPScaleNone
|
||||
</pre>
|
||||
*/
|
||||
- (void)setImageScaling:(CPImageScaling)scaling
|
||||
{
|
||||
[self setValue:scaling forThemeAttribute:@"image-scaling"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the image scaling of the control.
|
||||
*/
|
||||
- (CPImageScaling)imageScaling
|
||||
{
|
||||
return [self valueForThemeAttribute:@"image-scaling"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the enabled status of the control.
|
||||
Controls that are not enabled can not be used by the user and obtain the CPThemeStateDisabled theme state.
|
||||
|
||||
@param BOOL - YES if the control should be enabled, otherwise NO.
|
||||
*/
|
||||
- (void)setEnabled:(BOOL)isEnabled
|
||||
{
|
||||
if (isEnabled)
|
||||
@@ -680,16 +802,29 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
[self setThemeState:CPThemeStateDisabled];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns YES if the receiver is enabled, otherwise NO.
|
||||
*/
|
||||
- (BOOL)isEnabled
|
||||
{
|
||||
return ![self hasThemeState:CPThemeStateDisabled];
|
||||
}
|
||||
|
||||
/*!
|
||||
Highlights the receiver.
|
||||
|
||||
@param BOOL - YES if the receiver should be highlighted, otherwise NO.
|
||||
*/
|
||||
- (void)highlight:(BOOL)shouldHighlight
|
||||
{
|
||||
[self setHighlighted:shouldHighlight];
|
||||
}
|
||||
|
||||
/*!
|
||||
Highlights the receiver.
|
||||
|
||||
@param BOOL - YES if the receiver should be highlighted, otherwise NO.
|
||||
*/
|
||||
- (void)setHighlighted:(BOOL)isHighlighted
|
||||
{
|
||||
if (isHighlighted)
|
||||
@@ -698,6 +833,9 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
[self unsetThemeState:CPThemeStateHighlighted];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns YES if the control is highlighted, otherwise NO.
|
||||
*/
|
||||
- (BOOL)isHighlighted
|
||||
{
|
||||
return [self hasThemeState:CPThemeStateHighlighted];
|
||||
@@ -721,6 +859,7 @@ var __Deprecated__CPImageViewImageKey = @"CPImageViewImageKey";
|
||||
|
||||
/*
|
||||
Initializes the control by unarchiving it from a coder.
|
||||
|
||||
@param aCoder the coder from which to unarchive the control
|
||||
@return the initialized control
|
||||
*/
|
||||
@@ -744,6 +883,7 @@ var __Deprecated__CPImageViewImageKey = @"CPImageViewImageKey";
|
||||
|
||||
/*
|
||||
Archives the control to the provided coder.
|
||||
|
||||
@param aCoder the coder to which the control will be archived.
|
||||
*/
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
|
||||
+2
-2
@@ -88,7 +88,7 @@ var CPDocumentUntitledCount = 0;
|
||||
@class CPDocument
|
||||
|
||||
CPDocument is used to represent a document/file in a Cappuccino application.
|
||||
In a document-based application, generally multiple documents are open simutaneously
|
||||
In a document-based application, generally multiple documents are open simultaneously
|
||||
(multiple text documents, slide presentations, spreadsheets, etc.), and multiple
|
||||
CPDocuments should be used to represent this.
|
||||
*/
|
||||
@@ -208,7 +208,7 @@ var CPDocumentUntitledCount = 0;
|
||||
throws an exception.
|
||||
@param aType the format of the data
|
||||
@param anError not used
|
||||
@throws CPUnsupportedMethodException if this method hasn't been overriden by the subclass
|
||||
@throws CPUnsupportedMethodException if this method hasn't been overridden by the subclass
|
||||
@return the document data
|
||||
*/
|
||||
- (CPData)dataOfType:(CPString)aType error:({CPError})anError
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
@import <Foundation/CPBundle.j>
|
||||
|
||||
@import "CPDocument.j"
|
||||
@import "CPOpenPanel.j";
|
||||
@import "CPOpenPanel.j"
|
||||
|
||||
|
||||
var CPSharedDocumentController = nil;
|
||||
@@ -177,7 +177,7 @@ var CPSharedDocumentController = nil;
|
||||
@param aType the document type
|
||||
@param aDelegate the delegate to notify
|
||||
@param aSelector the selector to notify with
|
||||
@param aContextInfo the context infomration passed to the delegate
|
||||
@param aContextInfo the context information passed to the delegate
|
||||
*/
|
||||
- (CPDocument)makeDocumentWithContentsOfURL:(CPURL)anAbsoluteURL ofType:(CPString)aType delegate:(id)aDelegate didReadSelector:(SEL)aSelector contextInfo:(id)aContextInfo
|
||||
{
|
||||
|
||||
@@ -28,13 +28,13 @@
|
||||
@import "CPWindow.j"
|
||||
|
||||
|
||||
CPDragOperationNone = 0,
|
||||
CPDragOperationCopy = 1 << 1,
|
||||
CPDragOperationLink = 1 << 1,
|
||||
CPDragOperationGeneric = 1 << 2,
|
||||
CPDragOperationPrivate = 1 << 3,
|
||||
CPDragOperationMove = 1 << 4,
|
||||
CPDragOperationDelete = 1 << 5,
|
||||
CPDragOperationNone = 0;
|
||||
CPDragOperationCopy = 1 << 1;
|
||||
CPDragOperationLink = 1 << 1;
|
||||
CPDragOperationGeneric = 1 << 2;
|
||||
CPDragOperationPrivate = 1 << 3;
|
||||
CPDragOperationMove = 1 << 4;
|
||||
CPDragOperationDelete = 1 << 5;
|
||||
CPDragOperationEvery = -1;
|
||||
|
||||
#define DRAGGING_WINDOW(anObject) ([anObject isKindOfClass:[CPWindow class]] ? anObject : [anObject window])
|
||||
|
||||
+36
-28
@@ -161,21 +161,21 @@ CPEscapeFunctionKey = "\u001B";
|
||||
CPSpaceFunctionKey = "\u0020";
|
||||
|
||||
|
||||
CPDOMEventDoubleClick = "dblclick",
|
||||
CPDOMEventMouseDown = "mousedown",
|
||||
CPDOMEventMouseUp = "mouseup",
|
||||
CPDOMEventMouseMoved = "mousemove",
|
||||
CPDOMEventMouseDragged = "mousedrag",
|
||||
CPDOMEventKeyUp = "keyup",
|
||||
CPDOMEventKeyDown = "keydown",
|
||||
CPDOMEventKeyPress = "keypress";
|
||||
CPDOMEventCopy = "copy";
|
||||
CPDOMEventPaste = "paste";
|
||||
CPDOMEventScrollWheel = "mousewheel";
|
||||
CPDOMEventTouchStart = "touchstart";
|
||||
CPDOMEventTouchMove = "touchmove";
|
||||
CPDOMEventTouchEnd = "touchend";
|
||||
CPDOMEventTouchCancel = "touchcancel";
|
||||
CPDOMEventDoubleClick = "dblclick";
|
||||
CPDOMEventMouseDown = "mousedown";
|
||||
CPDOMEventMouseUp = "mouseup";
|
||||
CPDOMEventMouseMoved = "mousemove";
|
||||
CPDOMEventMouseDragged = "mousedrag";
|
||||
CPDOMEventKeyUp = "keyup";
|
||||
CPDOMEventKeyDown = "keydown";
|
||||
CPDOMEventKeyPress = "keypress";
|
||||
CPDOMEventCopy = "copy";
|
||||
CPDOMEventPaste = "paste";
|
||||
CPDOMEventScrollWheel = "mousewheel";
|
||||
CPDOMEventTouchStart = "touchstart";
|
||||
CPDOMEventTouchMove = "touchmove";
|
||||
CPDOMEventTouchEnd = "touchend";
|
||||
CPDOMEventTouchCancel = "touchcancel";
|
||||
|
||||
var _CPEventPeriodicEventPeriod = 0,
|
||||
_CPEventPeriodicEventTimer = nil,
|
||||
@@ -211,6 +211,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
|
||||
/*!
|
||||
Creates a new keyboard event.
|
||||
|
||||
@param anEventType the event type. Must be one of CPKeyDown, CPKeyUp or CPFlagsChanged
|
||||
@param aPoint the location of the cursor in the window specified by \c aWindowNumber
|
||||
@param modifierFlags a bitwise combination of the modifiers specified in the CPEvent globals
|
||||
@@ -235,7 +236,8 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Creates a new mouse event
|
||||
Creates a new mouse event.
|
||||
|
||||
@param anEventType the event type
|
||||
@param aPoint the location of the cursor in the window specified by \c aWindowNumber
|
||||
@param modifierFlags a bitwise combination of the modifiers specified in the CPEvent globals
|
||||
@@ -257,7 +259,8 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Creates a new custom event
|
||||
Creates a new custom event.
|
||||
|
||||
@param anEventType the event type. Must be one of CPAppKitDefined, CPSystemDefined, CPApplicationDefined or CPPeriodic
|
||||
@param aLocation the location of the cursor in the window specified by \c aWindowNumber
|
||||
@param modifierFlags a bitwise combination of the modifiers specified in the CPEvent globals
|
||||
@@ -349,10 +352,10 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
|
||||
/*!
|
||||
Returns the location of the mouse (for mouse events).
|
||||
If this is not a mouse event, it returns \c nil.
|
||||
If \c window returns \c nil, then
|
||||
the mouse coordinates will be based on the screen coordinates.
|
||||
If the receiver is not a mouse event, it returns \c nil.
|
||||
If \c window returns \c nil, then the mouse coordinates will be based on the screen coordinates.
|
||||
Otherwise, the coordinates are relative to the window's coordinates.
|
||||
|
||||
@return the location of the mouse, or \c nil for non-mouse events.
|
||||
*/
|
||||
- (CGPoint)locationInWindow
|
||||
@@ -372,7 +375,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns event information as a bit mask
|
||||
Returns event information as a bit mask.
|
||||
*/
|
||||
- (unsigned)modifierFlags
|
||||
{
|
||||
@@ -380,7 +383,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the time the event occurred
|
||||
Returns the time the event occurred.
|
||||
*/
|
||||
- (CPTimeInterval)timestamp
|
||||
{
|
||||
@@ -396,7 +399,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the event's associated window
|
||||
Returns the event's associated window.
|
||||
*/
|
||||
- (CPWindow)window
|
||||
{
|
||||
@@ -427,7 +430,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the number of clicks that caused this event. (mouse only)
|
||||
Returns the number of clicks that caused this event (mouse only).
|
||||
*/
|
||||
- (int)clickCount
|
||||
{
|
||||
@@ -435,7 +438,8 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the characters associated with this event (keyboard only)
|
||||
Returns the characters associated with this event (keyboard only).
|
||||
|
||||
@throws CPInternalInconsistencyException if this method is called on a non-key event
|
||||
*/
|
||||
- (CPString)characters
|
||||
@@ -445,6 +449,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
|
||||
/*!
|
||||
Returns the character ignoring any modifiers (except shift).
|
||||
|
||||
@throws CPInternalInconsistencyException if this method is called on a non-key event
|
||||
*/
|
||||
- (CPString)charactersIgnoringModifiers
|
||||
@@ -454,6 +459,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
|
||||
/*!
|
||||
Returns \c YES if the keyboard event was caused by the key being held down.
|
||||
|
||||
@throws CPInternalInconsistencyException if this method is called on a non-key event
|
||||
*/
|
||||
- (BOOL)isARepeat
|
||||
@@ -463,6 +469,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
|
||||
/*!
|
||||
Returns the key's key code.
|
||||
|
||||
@throws CPInternalInconsistencyException if this method is called on a non-key event
|
||||
*/
|
||||
- (unsigned short)keyCode
|
||||
@@ -495,7 +502,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
return _DOMEvent;
|
||||
}
|
||||
|
||||
// Getting Scroll Wheel Event Infomration
|
||||
// Getting Scroll Wheel Event Information
|
||||
/*!
|
||||
Returns the change in the x-axis for a mouse event.
|
||||
*/
|
||||
@@ -586,7 +593,8 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Gene rates periodic events every \c aPeriod seconds.
|
||||
Generates periodic events every \c aPeriod seconds.
|
||||
|
||||
@param aDelay the number of seconds before the first event
|
||||
@param aPeriod the length of time in seconds between successive events
|
||||
*/
|
||||
@@ -599,7 +607,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Stops the periodic events from being generated
|
||||
Stops the periodic events from being generated.
|
||||
*/
|
||||
+ (void)stopPeriodicEvents
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
@import "CGContext.j"
|
||||
|
||||
|
||||
var CPGraphicsContextCurrent = nil;
|
||||
var CPGraphicsContextCurrent = nil;
|
||||
|
||||
/*!
|
||||
@ingroup appkit
|
||||
|
||||
@@ -52,7 +52,7 @@ var _CPMenuBarVisible = NO,
|
||||
@class CPMenu
|
||||
|
||||
Menus provide the user with a list of actions and/or submenus. Submenus themselves are full fledged menus
|
||||
and so a heirarchical structure appears.
|
||||
and so a hierarchical structure appears.
|
||||
*/
|
||||
@implementation CPMenu : CPObject
|
||||
{
|
||||
|
||||
@@ -449,7 +449,7 @@ CPOffState
|
||||
return _mixedStateImage;
|
||||
}
|
||||
|
||||
// Managing Subemenus
|
||||
// Managing Submenus
|
||||
/*!
|
||||
Sets the submenu for this item
|
||||
@param aMenu the submenu
|
||||
@@ -648,7 +648,7 @@ CPControlKeyMask
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the title of the menu item and the mnemonic character. The mnemonic chracter should be preceded by an '&'.
|
||||
Sets the title of the menu item and the mnemonic character. The mnemonic character should be preceded by an '&'.
|
||||
@param aTitle the title string with a denoted mnemonic
|
||||
*/
|
||||
- (void)setTitleWithMnemonicLocation:(CPString)aTitle
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
/*!
|
||||
Inits and returns a CPObjectController object with the given content.
|
||||
|
||||
@param id aContent - The object the conroller will use.
|
||||
@param id aContent - The object the controller will use.
|
||||
@return id the CPObjectConroller instance.
|
||||
*/
|
||||
- (id)initWithContent:(id)aContent
|
||||
@@ -152,7 +152,7 @@
|
||||
}
|
||||
|
||||
/*!
|
||||
Overridden by a subclass that require control over the creation of new objects.
|
||||
Overridden by a subclass that require control over the creation of new objects.
|
||||
*/
|
||||
- (void)prepareContent
|
||||
{
|
||||
@@ -209,7 +209,7 @@
|
||||
|
||||
/*!
|
||||
Removes a given object from the controller.
|
||||
@param id anObject - The object to remove from the reciver.
|
||||
@param id anObject - The object to remove from the receiver.
|
||||
*/
|
||||
- (void)removeObject:(id)anObject
|
||||
{
|
||||
@@ -258,7 +258,7 @@
|
||||
|
||||
/*!
|
||||
Sets whether the controller allows for the editing of the content.
|
||||
@param BOOL shouldBeEditable - YES if the content should be editable, otherwise NO.
|
||||
@param BOOL shouldBeEditable - YES if the content should be editable, otherwise NO.
|
||||
*/
|
||||
- (void)setEditable:(BOOL)shouldBeEditable
|
||||
{
|
||||
|
||||
+73
-45
@@ -83,12 +83,16 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
@ingroup appkit
|
||||
@class CPOutlineView
|
||||
|
||||
CPOutlineView is a subclass of CPTableView that inherates the row and column format to display hierarchial data.
|
||||
The outlineview adds the ability to expand and collapse items. This is useful for browsing a tree like structure such as directories or a filesystem.
|
||||
CPOutlineView is a subclass of CPTableView that inherits the row and
|
||||
column format to display hierarchical data. The outlineview adds the
|
||||
ability to expand and collapse items. This is useful for browsing a tree
|
||||
like structure such as directories or a filesystem.
|
||||
|
||||
Like the tableview, an outlineview uses a data source to supply its data. For this reason you must implement a couple data source methods (documented in setDataSource:)
|
||||
Like the tableview, an outlineview uses a data source to supply its data.
|
||||
For this reason you must implement a couple data source methods
|
||||
(documented in setDataSource:).
|
||||
|
||||
Theme states for custom data views are documented in CPTableView
|
||||
Theme states for custom data views are documented in CPTableView.
|
||||
*/
|
||||
@implementation CPOutlineView : CPTableView
|
||||
{
|
||||
@@ -157,8 +161,9 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
}
|
||||
/*!
|
||||
<pre>
|
||||
In addition to standard delegation, the outline view also supports data source delegation. This method sets the data source object.
|
||||
Just like the TableView you have CPTableColumns but instead of rows you deal with items.
|
||||
In addition to standard delegation, the outline view also supports data
|
||||
source delegation. This method sets the data source object. Just like the
|
||||
TableView you have CPTableColumns but instead of rows you deal with items.
|
||||
|
||||
You must implement these data source methods:
|
||||
|
||||
@@ -184,10 +189,11 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
|
||||
Sorting:
|
||||
- (void)outlineView:(CPOutlineView)outlineView sortDescriptorsDidChange:(CPArray)oldDescriptors;
|
||||
The outlineview will call this method if you click the tableheader. You should sort the datasource based off of the new sort descriptors and reload the data
|
||||
The outlineview will call this method if you click the table header. You should sort the datasource based off of the new sort descriptors and reload the data
|
||||
|
||||
Drag and Drop:
|
||||
In order for the outlineview to recieve drops dont forget to first register the tableview for drag types like you do with every other view
|
||||
In order for the outlineview to receive drops don't forget to first
|
||||
register the tableview for drag types like you do with every other view
|
||||
|
||||
- (BOOL)outlineView:(CPOutlineView)outlineView acceptDrop:(id < CPDraggingInfo >)info item:(id)item childIndex:(CPInteger)index;
|
||||
Return YES if the operation was successful otherwise return NO.
|
||||
@@ -195,12 +201,12 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
To get this data use the draggingPasteboard method on the CPDraggingInfo object.
|
||||
|
||||
- (CPDragOperation)outlineView:(CPOutlineView)outlineView validateDrop:(id < CPDraggingInfo >)info proposedItem:(id)item proposedChildIndex:(CPInteger)index;
|
||||
Return the drag operation (move, copy, etc) that should be performaned if a registered drag type is over the tableview
|
||||
Return the drag operation (move, copy, etc) that should be performed if a registered drag type is over the tableview
|
||||
The data source can retarget a drop if you want by calling -(void)setDropItem:(id)anItem dropChildIndex:(int)anIndex;
|
||||
|
||||
- (BOOL)outlineView:(CPOutlineView)outlineView writeItems:(CPArray)items toPasteboard:(CPPasteboard)pboard;
|
||||
Returns YES if the drop operation is allowed otherwise NO.
|
||||
This method is invoked by the outlineview after a drag should begin, but before it is started. If you dont want the drag to being return NO.
|
||||
This method is invoked by the outlineview after a drag should begin, but before it is started. If you don't want the drag to being return NO.
|
||||
If you want the drag to begin you should return YES and place the drag data on the pboard.
|
||||
</pre>
|
||||
*/
|
||||
@@ -259,6 +265,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
|
||||
/*!
|
||||
Returns the datasource object.
|
||||
|
||||
@return id - The data source object
|
||||
*/
|
||||
- (id)dataSource
|
||||
@@ -287,7 +294,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Used to find if an item is already expanded.
|
||||
Used to find if an item is already expanded.
|
||||
|
||||
@param anItem - the item you are interest in.
|
||||
|
||||
@@ -307,7 +314,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Expends a given item.
|
||||
Expands a given item.
|
||||
|
||||
@param anItem - the item to expand.
|
||||
*/
|
||||
@@ -335,8 +342,8 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
return;
|
||||
|
||||
// When shouldExpandChildren is YES, we need to make sure we're collecting
|
||||
// selection notifications so that exactly one IsChanging and one DidChange
|
||||
// is sent as needed, for the totallity of the operation.
|
||||
// selection notifications so that exactly one IsChanging and one
|
||||
// DidChange is sent as needed, for the totality of the operation.
|
||||
var isTopLevel = NO;
|
||||
if (!_coalesceSelectionNotificationState)
|
||||
{
|
||||
@@ -344,7 +351,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
_coalesceSelectionNotificationState = CPOutlineViewCoalesceSelectionNotificationStateOn;
|
||||
}
|
||||
|
||||
// to prevent items which are already expanded from firing notifications
|
||||
// To prevent items which are already expanded from firing notifications.
|
||||
if (!itemInfo.isExpanded)
|
||||
{
|
||||
[self _noteItemWillExpand:anItem];
|
||||
@@ -486,7 +493,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
/*!
|
||||
Returns the item at a given row index. If no item exists nil is returned.
|
||||
|
||||
@param aRow - The rown index you want to find the item at.
|
||||
@param aRow - The row index you want to find the item at.
|
||||
@return id - The item at a given index.
|
||||
*/
|
||||
- (id)itemAtRow:(CPInteger)aRow
|
||||
@@ -514,8 +521,9 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the table column you want to display the disclosure button in.
|
||||
If you do not want an outline column pass nil.
|
||||
Sets the table column you want to display the disclosure button in. If you
|
||||
do not want an outline column pass nil.
|
||||
|
||||
@param aTableColumn - The CPTableColumn you want to use for hierarchical data.
|
||||
*/
|
||||
- (void)setOutlineTableColumn:(CPTableColumn)aTableColumn
|
||||
@@ -540,7 +548,9 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the indentation level of a given item. If the item is nil (the top level root item) CPNotFound is returned. Indentation levels are zero based, thus items that are not indented return 0.
|
||||
Returns the indentation level of a given item. If the item is nil (the top
|
||||
level root item) CPNotFound is returned. Indentation levels are zero
|
||||
based, thus items that are not indented return 0.
|
||||
|
||||
@param anItem - The item you want the indentation level for.
|
||||
@return int - the indentation level of anItem.
|
||||
@@ -559,9 +569,10 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the indentation level for a given row. If the row is invalid CPNotFound is returned. Rows that are nto indented return 0.
|
||||
Returns the indentation level for a given row. If the row is invalid
|
||||
CPNotFound is returned. Rows that are not indented return 0.
|
||||
|
||||
@param aRow - the row of the reciever
|
||||
@param aRow - the row of the receiver
|
||||
@return int - the indentation level of aRow.
|
||||
*/
|
||||
- (CPInteger)levelForRow:(CPInteger)aRow
|
||||
@@ -596,7 +607,9 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the layout behaviour of disclosure button. If you pass NO the disclosure button will always align itself to the left of the outline column.
|
||||
Sets the layout behavior of disclosure button. If you pass NO the
|
||||
disclosure button will always align itself to the left of the outline
|
||||
column.
|
||||
|
||||
@param indentationMarkerShouldFollowDataView - Pass YES if the disclosure control should be indented along with the dataview, otherwise NO.
|
||||
*/
|
||||
@@ -612,9 +625,11 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the layout behaviour of the disclosure buttons.
|
||||
Returns the layout behavior of the disclosure buttons.
|
||||
|
||||
@return BOOL - YES if the disclosure control indents itself with the dataview, otherwise NO if the control is always aligned to the left of the outline column
|
||||
@return BOOL - YES if the disclosure control indents itself with the
|
||||
dataview, otherwise NO if the control is always aligned to the left of
|
||||
the outline column
|
||||
*/
|
||||
- (BOOL)indentationMarkerFollowsDataView
|
||||
{
|
||||
@@ -624,8 +639,9 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
/*!
|
||||
Returns the parent item for a given item. If the item is a top level root object nil is returned.
|
||||
|
||||
@param anItem - The item of the reciver.
|
||||
@return id - The parent item of anItem. If no parent exists (the item is a root item) nil is returned.
|
||||
@param anItem - The item of the receiver.
|
||||
@return id - The parent item of anItem. If no parent exists (the item is a
|
||||
root item) nil is returned.
|
||||
*/
|
||||
- (id)parentForItem:(id)anItem
|
||||
{
|
||||
@@ -649,7 +665,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
/*!
|
||||
@ignore
|
||||
|
||||
Returns the frame of the dataview at the row given for the outline column
|
||||
Returns the frame of the dataview at the row given for the outline column.
|
||||
*/
|
||||
- (CGRect)_frameOfOutlineDataViewAtRow:(CPInteger)aRow
|
||||
{
|
||||
@@ -664,11 +680,11 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the frame of the disclosure button for the outline column.
|
||||
If the item is not expandable a CGZeroRect is returned.
|
||||
Subclasses can return a CGZeroRect to prevent the disclosure control from being displayed.
|
||||
Returns the frame of the disclosure button for the outline column. If the
|
||||
item is not expandable a CGZeroRect is returned. Subclasses can return a
|
||||
CGZeroRect to prevent the disclosure control from being displayed.
|
||||
|
||||
@param aRow - The row of the reciever
|
||||
@param aRow - The row of the receiver
|
||||
@return CGRect - The rect of the disclosure button at aRow.
|
||||
*/
|
||||
- (CGRect)frameOfOutlineDisclosureControlAtRow:(CPInteger)aRow
|
||||
@@ -684,7 +700,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
Select or deselect rows, this is overridden because we need to change the color or the outline control
|
||||
Select or deselect rows, this is overridden because we need to change the color or the outline control.
|
||||
*/
|
||||
- (void)_performSelection:(BOOL)select forRow:(CPInteger)rowIndex context:(id)context
|
||||
{
|
||||
@@ -710,7 +726,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
Called when the user resizes a column in the outlineview.
|
||||
|
||||
- (void)outlineViewItemDidCollapse:(CPNotification)notification;
|
||||
Called when the user collapses an item in teh outlineview.
|
||||
Called when the user collapses an item in the outlineview.
|
||||
|
||||
- (void)outlineViewItemDidExpand:(CPNotification)notification;
|
||||
Called when the user expands an item in the outlineview.
|
||||
@@ -763,7 +779,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
This delegate method will be passed your 'item' object and expects you to return an integer height.
|
||||
NOTE: this should only be implemented if rows will be different heights, if you want to set a height for ALL of your rows see -setRowHeight:
|
||||
|
||||
@param aDelegate - the delegate object you wish to set for the reciever.
|
||||
@param aDelegate - the delegate object you wish to set for the receiver.
|
||||
<pre>
|
||||
*/
|
||||
- (void)setDelegate:(id)aDelegate
|
||||
@@ -937,8 +953,9 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the prototype of the disclosure control. This is used if you want to set a special type of button, instead of the default triangle.
|
||||
The control must implement CPCoding.
|
||||
Sets the prototype of the disclosure control. This is used if you want to
|
||||
set a special type of button, instead of the default triangle. The control
|
||||
must implement CPCoding.
|
||||
|
||||
@param aControl - the control to be used to expand and collapse items.
|
||||
*/
|
||||
@@ -948,7 +965,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
_disclosureControlData = nil;
|
||||
_disclosureControlQueue = [];
|
||||
|
||||
// fIXME: reall?
|
||||
// fIXME: really?
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
@@ -961,9 +978,13 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds a new table column to the reciever. If this is the first column added it will automatically be set to the outline column.
|
||||
Also see -setOutlineTableColumn:
|
||||
Adds a new table column to the receiver. If this is the first column added
|
||||
it will automatically be set to the outline column.
|
||||
|
||||
Also see -setOutlineTableColumn:.
|
||||
|
||||
NOTE: This behavior deviates from cocoa slightly.
|
||||
|
||||
@param CPTableColumn aTableColumn - The table column to add.
|
||||
*/
|
||||
- (void)addTableColumn:(CPTableColumn)aTableColumn
|
||||
@@ -985,7 +1006,8 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
}
|
||||
/*!
|
||||
@ignore
|
||||
We overide this because we need a special behaviour for the outline column
|
||||
We override this because we need a special behavior for the outline
|
||||
column.
|
||||
*/
|
||||
- (CGRect)frameOfDataViewAtColumn:(CPInteger)aColumn row:(CPInteger)aRow
|
||||
{
|
||||
@@ -999,7 +1021,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
we need to offset the dataview and add the dislosure triangle
|
||||
We need to offset the dataview and add the disclosure triangle.
|
||||
*/
|
||||
- (CPView)_dragViewForColumn:(int)theColumnIndex event:(CPEvent)theDragEvent offset:(CPPointPointer)theDragViewOffset
|
||||
{
|
||||
@@ -1059,9 +1081,15 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
|
||||
/*!
|
||||
Retargets the drop item for the outlineview.
|
||||
To specify a drop on theItem, you specify item as theItem and index as CPOutlineViewDropOnItemIndex.
|
||||
To specify a drop between child 1 and 2 of theItem, you specify item as theItem and index as 2.
|
||||
To specify a drop on an item that can't be expanded theItem, you specify item as someOutlineItem and index as CPOutlineViewDropOnItemIndex.
|
||||
|
||||
To specify a drop on theItem, you specify item as theItem and index as
|
||||
CPOutlineViewDropOnItemIndex.
|
||||
|
||||
To specify a drop between child 1 and 2 of theItem, you specify item as
|
||||
theItem and index as 2.
|
||||
|
||||
To specify a drop on an item that can't be expanded theItem, you specify
|
||||
item as someOutlineItem and index as CPOutlineViewDropOnItemIndex.
|
||||
|
||||
@param theItem - The item you want to retarget the drop on.
|
||||
@param theIndex - The index of the child item you want to retarget the drop between. Pass CPOutlineViewDropOnItemIndex if you want to drop on theItem.
|
||||
@@ -1171,7 +1199,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
We need to move the disclosure control too
|
||||
We need to move the disclosure control too.
|
||||
*/
|
||||
- (void)_layoutDataViewsInRows:(CPIndexSet)rows columns:(CPIndexSet)columns
|
||||
{
|
||||
|
||||
+16
-8
@@ -26,7 +26,7 @@
|
||||
@import "CPMenuItem.j"
|
||||
|
||||
|
||||
var VISIBLE_MARGIN = 7.0;
|
||||
var VISIBLE_MARGIN = 7.0;
|
||||
|
||||
CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
|
||||
@@ -54,7 +54,12 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
|
||||
+ (CPSet)keyPathsForValuesAffectingSelectedTag
|
||||
{
|
||||
return [CPSet setWithObject:@"selectedIndex"];
|
||||
return [CPSet setWithObject:@"objectValue"];
|
||||
}
|
||||
|
||||
+ (CPSet)keyPathsForValuesAffectingSelectedItem
|
||||
{
|
||||
return [CPSet setWithObject:@"objectValue"];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -102,6 +107,9 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
|
||||
/*!
|
||||
Specifies whether the object is a pull-down or a pop-up menu.
|
||||
If the button pulls down the menu items represent actions, not states.
|
||||
So the text in the button will NOT change when the user selects something different.
|
||||
|
||||
@param shouldPullDown \c YES makes the pop-up button
|
||||
a pull-down menu. \c NO makes it a pop-up menu.
|
||||
*/
|
||||
@@ -145,7 +153,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
|
||||
/*!
|
||||
Adds a new menu item with the specified title.
|
||||
@param the new menu item's tite
|
||||
@param the new menu item's title
|
||||
*/
|
||||
- (void)addItemWithTitle:(CPString)aTitle
|
||||
{
|
||||
@@ -154,7 +162,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
|
||||
/*!
|
||||
Adds multiple new menu items with the titles specified in the provided array.
|
||||
@param titles an arry of names for the new items
|
||||
@param titles an array of names for the new items
|
||||
*/
|
||||
- (void)addItemsWithTitles:(CPArray)titles
|
||||
{
|
||||
@@ -167,7 +175,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
|
||||
/*!
|
||||
Inserts a new item with the specified title and index location.
|
||||
@param aTitle the new itme's title
|
||||
@param aTitle the new item's title
|
||||
@param anIndex the item's index in the menu
|
||||
*/
|
||||
- (void)insertItemWithTitle:(CPString)aTitle atIndex:(int)anIndex
|
||||
@@ -428,7 +436,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
|
||||
/*!
|
||||
Returns the index of the item with the specified title or CPNotFound.
|
||||
@param aTitle the item's titel
|
||||
@param aTitle the item's title
|
||||
*/
|
||||
- (int)indexOfItemWithTitle:(CPString)aTitle
|
||||
{
|
||||
@@ -470,7 +478,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the preffered edge of the button to display the
|
||||
Sets the preferred edge of the button to display the
|
||||
pop-up when there is a limited amount of screen space.
|
||||
By default, the pop-up should draw on top of the button.
|
||||
*/
|
||||
@@ -733,7 +741,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
|
||||
- (void)rightMouseDown:(CPEvent)anEvent
|
||||
{
|
||||
// Disable standard CPView behaviour which incorrectly displays the menu as a 'context menu'.
|
||||
// Disable standard CPView behavior which incorrectly displays the menu as a 'context menu'.
|
||||
}
|
||||
|
||||
- (void)_popUpItemAction:(id)aSender
|
||||
|
||||
@@ -120,7 +120,7 @@ var CPProgressIndicatorSpinningStyleColors = nil,
|
||||
|
||||
CPProgressIndicatorStyleSizes = [];
|
||||
|
||||
// Bar Sttyle
|
||||
// Bar Style
|
||||
var prefixes = [
|
||||
CPProgressIndicatorClassName + @"BezelBorder" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle],
|
||||
CPProgressIndicatorClassName + @"Bar" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle],
|
||||
@@ -290,7 +290,7 @@ var CPProgressIndicatorSpinningStyleColors = nil,
|
||||
}
|
||||
|
||||
/*
|
||||
Not yet impemented.
|
||||
Not yet implemented.
|
||||
*/
|
||||
- (CPControlTint)controlTint
|
||||
{
|
||||
|
||||
@@ -506,7 +506,7 @@
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets whether the scroll view hides its scoll bars when not needed.
|
||||
Sets whether the scroll view hides its scroll bars when not needed.
|
||||
@param autohidesScrollers \c YES causes the scroll bars
|
||||
to be hidden when not needed.
|
||||
*/
|
||||
@@ -796,7 +796,7 @@
|
||||
|
||||
/*!
|
||||
Sets the vertical page scroll amount.
|
||||
@param aPageScroll the new vertcal page scroll amount
|
||||
@param aPageScroll the new vertical page scroll amount
|
||||
*/
|
||||
- (void)setVerticalPageScroll:(float)aPageScroll
|
||||
{
|
||||
|
||||
@@ -361,9 +361,9 @@ CPSegmentSwitchTrackingMomentary = 2;
|
||||
}
|
||||
|
||||
/*!
|
||||
Enables/diables the specified segment.
|
||||
Enables/disables the specified segment.
|
||||
@param isEnabled \c YES enables the segment
|
||||
@param aSegment the segment to enable/disble
|
||||
@param aSegment the segment to enable/disable
|
||||
@throws CPRangeException if \c aSegment is out of bounds
|
||||
*/
|
||||
- (void)setEnabled:(BOOL)isEnabled forSegment:(unsigned)aSegment
|
||||
|
||||
+1
-1
@@ -384,7 +384,7 @@ CPCircularSlider = 1;
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
shoudl we have _continuous?
|
||||
should we have _continuous?
|
||||
*/
|
||||
- (void)setContinuous:(BOOL)flag
|
||||
{
|
||||
|
||||
+3
-3
@@ -77,7 +77,7 @@ CPSoundPlayBackStatePause = 2;
|
||||
Initialize with the sound contents of the URL represented by aFile.
|
||||
|
||||
@param aFile CPString the path of the sound
|
||||
@param byRef ignored (Cocoa compatibibility)
|
||||
@param byRef ignored (Cocoa compatibility)
|
||||
*/
|
||||
- (id)initWithContentsOfFile:(CPString)aFile byReference:(BOOL)byRef
|
||||
{
|
||||
@@ -94,7 +94,7 @@ CPSoundPlayBackStatePause = 2;
|
||||
Initialize with the sound contents of the file located at aURL.
|
||||
|
||||
@param aURL CPURL containing the URL of the sound
|
||||
@param byRef ignored (Cocoa compatibibility)
|
||||
@param byRef ignored (Cocoa compatibility)
|
||||
*/
|
||||
- (id)initWithContentsOfURL:(CPURL)aURL byReference:(BOOL)byRef
|
||||
{
|
||||
@@ -105,7 +105,7 @@ CPSoundPlayBackStatePause = 2;
|
||||
Initialize with the sound contents of someData.
|
||||
|
||||
@param someData CPData containing the sound
|
||||
@param byRef ignored (Cocoa compatibibility)
|
||||
@param byRef ignored (Cocoa compatibility)
|
||||
*/
|
||||
- (id)initWithData:(CPData)someData
|
||||
{
|
||||
|
||||
+112
-2
@@ -33,6 +33,14 @@ var CPSplitViewHorizontalImage = nil,
|
||||
|
||||
/*!
|
||||
@ingroup appkit
|
||||
@class CPSplitView
|
||||
|
||||
CPSplitView is a view that allows you to stack several subviews vertically or horizontally. The user is given divider to resize the subviews.
|
||||
The divider indices are zero-based. So the divider on the top (or left for vertical dividers) will be index 0.
|
||||
|
||||
CPSplitView can be supplied a delegate to provide control over the resizing of the splitview and subviews. Those methods are documented in setDelegate:
|
||||
|
||||
CPSplitView will add dividers for each subview you add. So just like adding subviews to a CPView you should call addSubview: to add new resizable subviews in your splitview.
|
||||
*/
|
||||
|
||||
@implementation CPSplitView : CPView
|
||||
@@ -96,16 +104,28 @@ var CPSplitViewHorizontalImage = nil,
|
||||
return self;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the thickness of the divider.
|
||||
@return float - the thickness of the divider.
|
||||
*/
|
||||
- (float)dividerThickness
|
||||
{
|
||||
return [self currentValueForThemeAttribute:[self isPaneSplitter] ? @"pane-divider-thickness" : @"divider-thickness"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns YES if the dividers are vertical, otherwise NO.
|
||||
@return YES if vertical, otherwise NO.
|
||||
*/
|
||||
- (BOOL)isVertical
|
||||
{
|
||||
return _isVertical;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets if the splitview dividers are vertical.
|
||||
@param shouldBeVertical - YES if the splitview dividers should be vertical, otherwise NO.
|
||||
*/
|
||||
- (void)setVertical:(BOOL)shouldBeVertical
|
||||
{
|
||||
if (![self _setVertical:shouldBeVertical])
|
||||
@@ -147,11 +167,21 @@ var CPSplitViewHorizontalImage = nil,
|
||||
return changed;
|
||||
}
|
||||
|
||||
/*!
|
||||
Use to find if the divider is a larger pane splitter.
|
||||
|
||||
@return BOOL - YES if the dividers are the larger pane splitters. Otherwise NO.
|
||||
*/
|
||||
- (BOOL)isPaneSplitter
|
||||
{
|
||||
return _isPaneSplitter;
|
||||
}
|
||||
|
||||
/*!
|
||||
Used to set if the split view dividers should be the larger pane splitter.
|
||||
|
||||
@param shouldBePaneSplitter - YES if the dividers should be the thicker pane splitter, otherwise NO.
|
||||
*/
|
||||
- (void)setIsPaneSplitter:(BOOL)shouldBePaneSplitter
|
||||
{
|
||||
if (_isPaneSplitter == shouldBePaneSplitter)
|
||||
@@ -173,11 +203,22 @@ var CPSplitViewHorizontalImage = nil,
|
||||
_needsResizeSubviews = YES;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns YES if the supplied subview is collapsed, otherwise NO.
|
||||
@param aSubview - the subview you are interested in.
|
||||
@return BOOL - YES if the subview is collapsed, otherwise NO.
|
||||
*/
|
||||
- (BOOL)isSubviewCollapsed:(CPView)subview
|
||||
{
|
||||
return [subview frame].size[_sizeComponent] < 1 ? YES : NO;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the CGRect of the divider at a given index.
|
||||
|
||||
@param int - The index of a divider.
|
||||
@return CGRect - The rect of a divider.
|
||||
*/
|
||||
- (CGRect)rectOfDividerAtIndex:(int)aDivider
|
||||
{
|
||||
var frame = [_subviews[aDivider] frame],
|
||||
@@ -191,6 +232,12 @@ var CPSplitViewHorizontalImage = nil,
|
||||
return rect;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the rect of the divider which the user is able to drag to resize.
|
||||
|
||||
@param int - The index of the divider.
|
||||
@return CGRect - The rect the user can drag.
|
||||
*/
|
||||
- (CGRect)effectiveRectOfDividerAtIndex:(int)aDivider
|
||||
{
|
||||
var realRect = [self rectOfDividerAtIndex:aDivider],
|
||||
@@ -212,7 +259,10 @@ var CPSplitViewHorizontalImage = nil,
|
||||
[self drawDividerInRect:[self rectOfDividerAtIndex:count]];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Draws the divider at a given rect.
|
||||
@param aRect - the rect of the divider to draw.
|
||||
*/
|
||||
- (void)drawDividerInRect:(CGRect)aRect
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
@@ -485,6 +535,11 @@ var CPSplitViewHorizontalImage = nil,
|
||||
[[CPCursor arrowCursor] set];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the maximum possible position of a divider at a given index.
|
||||
@param the index of the divider.
|
||||
@return float - the max possible position.
|
||||
*/
|
||||
- (float)maxPossiblePositionOfDividerAtIndex:(int)dividerIndex
|
||||
{
|
||||
var frame = [_subviews[dividerIndex + 1] frame];
|
||||
@@ -495,6 +550,11 @@ var CPSplitViewHorizontalImage = nil,
|
||||
return [self frame].size[_sizeComponent] - [self dividerThickness];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the minimum possible position of a divider at a given index.
|
||||
@param the index of the divider.
|
||||
@return float - the min possible position.
|
||||
*/
|
||||
- (float)minPossiblePositionOfDividerAtIndex:(int)dividerIndex
|
||||
{
|
||||
if (dividerIndex > 0)
|
||||
@@ -535,6 +595,11 @@ var CPSplitViewHorizontalImage = nil,
|
||||
return realPosition;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the position of a divider at a given index.
|
||||
@param position - The float value of the position to place the divider.
|
||||
@param dividerIndex - The index of the divider to position.
|
||||
*/
|
||||
- (void)setPosition:(float)position ofDividerAtIndex:(int)dividerIndex
|
||||
{
|
||||
[self _adjustSubviewsWithCalculatedSize];
|
||||
@@ -644,6 +709,48 @@ var CPSplitViewHorizontalImage = nil,
|
||||
[self _postNotificationDidResize];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the delegate of the receiver.
|
||||
Possible delegate methods to implement are listed below.
|
||||
|
||||
<pre>
|
||||
- (void)splitViewDidResizeSubviews:(CPSplitView)aSplitView;
|
||||
Notifies the delegate when the subviews have resized.
|
||||
|
||||
- (void)splitViewWillResizeSubviews:(CPSplitView)aSplitView;
|
||||
Notifies the delegate when the subviews will be resized.
|
||||
|
||||
- (CGRect)splitView:(CPSplitView)aSplitView effectiveRect:(CGRect)aRect forDrawnRect:(CGRect)aDrawnRect ofDividerAtIndex:(int)aDividerIndex;
|
||||
Lets the delegate specify a different rect for which the user can drag the splitView divider.
|
||||
|
||||
- (CGRect)splitView:(CPSplitView)aSplitView additionalEffectiveRectOfDividerAtIndex:(int)indexOfDivider;
|
||||
Lets the delegate specify an additional rect for which the user can drag the splitview divider.
|
||||
|
||||
- (BOOL)splitView:(CPSplitView)aSplitView canCollapseSubview:(CPView)aSubview;
|
||||
Notifies the delegate that the splitview is about to be collapsed. This usually happens when the user
|
||||
Double clicks on the divider. Return YES if the subview can be collapsed, otherwise NO.
|
||||
|
||||
- (BOOL)splitView:(CPSplitView)aSplitView shouldCollapseSubview:(CPView)aSubview;
|
||||
Notifies the delegate that the splitview is about to be collapsed. This usually happens when the user
|
||||
Double clicks on the divider. Return YES if the subview should be collapsed, otherwise NO.
|
||||
|
||||
- (float)splitView:(CPSplitView)aSpiltView constrainSplitPosition:(float)proposedPosition ofSubviewAt:(int)subviewIndex;
|
||||
Allows the delegate to constrain the subview beings resized. This method is called continuously as the user resizes the divider.
|
||||
For example if the subview needs to have a width which is a multiple of a certain number you could return that multiple with this method.
|
||||
|
||||
- (float)splitView:(CPSplitView)aSplitView constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)subviewIndex;
|
||||
Allows the delegate to constrain the minimum position of a subview.
|
||||
|
||||
- (float)splitView:(CPSplitView)aSplitView constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)subviewIndex;
|
||||
Allows the delegate to constrain the maximum position of a subview.
|
||||
|
||||
- (void)splitView:(CPSplitView)aSplitView resizeSubviewsWithOldSize:(CGSize)oldSize;
|
||||
Allows the splitview to specify a custom resizing behavior. This is called when the splitview is resized.
|
||||
The sum of the views and the sum of the dividers should be equal to the size of the splitview.
|
||||
</pre>
|
||||
|
||||
@param delegate - The delegate of the splitview.
|
||||
*/
|
||||
- (void)setDelegate:(id)delegate
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(splitViewDidResizeSubviews:)])
|
||||
@@ -676,6 +783,9 @@ var CPSplitViewHorizontalImage = nil,
|
||||
|
||||
This method will automatically configure the hasResizeControl and resizeControlIsLeftAligned
|
||||
parameters of the button bar, and will override any currently set values.
|
||||
|
||||
@param CPButtonBar - The supplied button bar.
|
||||
@param unsigned int - The divider index the button bar will be assigned to.
|
||||
*/
|
||||
- (void)setButtonBar:(CPButtonBar)aButtonBar forDividerAtIndex:(unsigned)dividerIndex
|
||||
{
|
||||
@@ -741,7 +851,7 @@ var CPSplitViewDelegateKey = "CPSplitViewDelegateKey",
|
||||
|
||||
_buttonBars = [aCoder decodeObjectForKey:CPSplitViewButtonBarsKey] || [];
|
||||
|
||||
_delegate = [aCoder decodeObjectForKey:CPSplitViewDelegateKey];
|
||||
[self setDelegate:[aCoder decodeObjectForKey:CPSplitViewDelegateKey]];
|
||||
|
||||
_isPaneSplitter = [aCoder decodeBoolForKey:CPSplitViewIsPaneSplitterKey];
|
||||
[self _setVertical:[aCoder decodeBoolForKey:CPSplitViewIsVerticalKey]];
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
}
|
||||
|
||||
/*! set the current value of the stepper
|
||||
@param aValue a float contaning the value
|
||||
@param aValue a float containing the value
|
||||
*/
|
||||
- (void)setDoubleValue:(float)aValue
|
||||
{
|
||||
|
||||
@@ -145,8 +145,8 @@ CPPressedTab = 2;
|
||||
|
||||
// Assigning an Auxiliary View
|
||||
/*!
|
||||
Sets the tab's auxillary view.
|
||||
@param anAuxillaryView the new auxillary view
|
||||
Sets the tab's auxiliary view.
|
||||
@param anAuxiliaryView the new auxiliary view
|
||||
*/
|
||||
- (void)setAuxiliaryView:(CPView)anAuxiliaryView
|
||||
{
|
||||
@@ -154,7 +154,7 @@ CPPressedTab = 2;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the tab's auxillary view
|
||||
Returns the tab's auxiliary view
|
||||
*/
|
||||
- (CPView)auxiliaryView
|
||||
{
|
||||
|
||||
+80
-23
@@ -37,9 +37,12 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
@class CPTableColumn
|
||||
|
||||
A CPTableColumn contains a dataview to display for its column of the CPTableView.
|
||||
A CPTableColumn determines its own size constrains and resizing behaviour.
|
||||
A CPTableColumn determines its own size constrains and resizing behavior.
|
||||
|
||||
The default dataview is a CPTextField but you can set it to any view you'd like. See -setDataView: for documentaion including theme states.
|
||||
The default dataview is a CPTextField but you can set it to any view you'd like. See -setDataView: for documentation including theme states.
|
||||
|
||||
To customize the text of the column header you can simply call setStringValue: on the headerview of a table column.
|
||||
For example: [[myTableColumn headerView] setStringValue:"My Title"];
|
||||
*/
|
||||
@implementation CPTableColumn : CPObject
|
||||
{
|
||||
@@ -62,11 +65,6 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
BOOL _disableResizingPosting @accessors(property=disableResizingPosting);
|
||||
}
|
||||
|
||||
+ (Class)_binderClassForBinding:(CPString)theBinding
|
||||
{
|
||||
return [CPBinder class];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
@@ -197,7 +195,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the minimum width of the column.
|
||||
Sets the minimum width of the column.
|
||||
Default value is 10.
|
||||
*/
|
||||
- (void)setMinWidth:(float)aMinWidth
|
||||
@@ -225,7 +223,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the maximum width of the table column.
|
||||
Sets the maximum width of the table column.
|
||||
Default value is: 1000000
|
||||
*/
|
||||
- (void)setMaxWidth:(float)aMaxWidth
|
||||
@@ -254,8 +252,8 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
|
||||
/*!
|
||||
<pre>
|
||||
Set the resizing mask of the column.
|
||||
By default the column can be resized automatically with the tableview and manaully by the user
|
||||
Set the resizing mask of the column.
|
||||
By default the column can be resized automatically with the tableview and manually by the user
|
||||
|
||||
Possible masking values are:
|
||||
CPTableColumnNoResizing
|
||||
@@ -278,7 +276,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sizes the column to fix the column header text.
|
||||
Sizes the column to fix the column header text.
|
||||
*/
|
||||
- (void)sizeToFit
|
||||
{
|
||||
@@ -296,7 +294,12 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
|
||||
/*!
|
||||
Sets the header view for the column.
|
||||
The headerview handles the display of sort indicators, text, etc
|
||||
The headerview handles the display of sort indicators, text, etc.
|
||||
|
||||
If you do not want a headerview for you table you should call setHeaderView: on your CPTableView instance.
|
||||
Passing nil here will throw an exception.
|
||||
|
||||
In order to customize the text of the column header see - (CPView)headerView;
|
||||
*/
|
||||
- (void)setHeaderView:(CPView)aView
|
||||
{
|
||||
@@ -312,7 +315,10 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the headerview for the column
|
||||
Returns the headerview for the column.
|
||||
|
||||
In order to change the text of the headerview for a column you should call setStringValue: on the headerview.
|
||||
For example: [[myTableColumn headerView] setStringValue:"My Column"];
|
||||
*/
|
||||
- (CPView)headerView
|
||||
{
|
||||
@@ -329,7 +335,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
When you set a dataview and it is added to the tableview the theme state will be set to CPThemeStateTableDataView
|
||||
When the dataview becomes selected the theme state will be set to CPThemeStateSelectedDataView.
|
||||
|
||||
If the dataview shows up in a group row of the tablview the theme state will be set to CPThemeStateGroupRow.
|
||||
If the dataview shows up in a group row of the tableview the theme state will be set to CPThemeStateGroupRow.
|
||||
|
||||
You should overide setThemeState: and unsetThemeState: to handle these theme state changes in your dataview.
|
||||
|
||||
@@ -468,7 +474,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the sort descriptor prototype for the column.
|
||||
Sets the sort descriptor prototype for the column.
|
||||
*/
|
||||
- (void)setSortDescriptorPrototype:(CPSortDescriptor)aSortDescriptor
|
||||
{
|
||||
@@ -484,7 +490,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
If NO the tablecolumn will no longer be visisble in the tableview
|
||||
If NO the tablecolumn will no longer be visible in the tableview
|
||||
If YES the tablecolumn will be visible in the tableview.
|
||||
*/
|
||||
- (void)setHidden:(BOOL)shouldBeHidden
|
||||
@@ -541,7 +547,40 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPTableColumnValueBinder : CPBinder
|
||||
{
|
||||
}
|
||||
|
||||
- (void)setValueFor:(CPString)aBinding
|
||||
{
|
||||
var tableView = [_source tableView],
|
||||
column = [[tableView tableColumns] indexOfObjectIdenticalTo:_source],
|
||||
rowIndexes = [CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, [tableView numberOfRows])],
|
||||
columnIndexes = [CPIndexSet indexSetWithIndex:column];
|
||||
|
||||
[tableView reloadDataForRowIndexes:rowIndexes columnIndexes:columnIndexes];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPTableColumn (Bindings)
|
||||
|
||||
+ (id)_binderClassForBinding:(CPString)aBinding
|
||||
{
|
||||
if (aBinding == CPValueBinding)
|
||||
return [CPTableColumnValueBinder class];
|
||||
|
||||
return [super _binderClassForBinding:aBinding];
|
||||
}
|
||||
|
||||
/*!
|
||||
Binds the receiver to an object.
|
||||
|
||||
@param CPString aBinding - The binding you wish to make. Typically CPValueBinding.
|
||||
@param id anObject - The object to bind the receiver to.
|
||||
@param CPString aKeyPath - The key path you wish to bind the receiver to.
|
||||
@param CPDictionary options - A dictionary of options for the binding. This parameter is optional, pass nil if you do not wish to use it.
|
||||
*/
|
||||
- (void)bind:(CPString)aBinding toObject:(id)anObject withKeyPath:(CPString)aKeyPath options:(CPDictionary)options
|
||||
{
|
||||
[super bind:aBinding toObject:anObject withKeyPath:aKeyPath options:options];
|
||||
@@ -550,6 +589,9 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
[[self tableView] _establishBindingsIfUnbound:anObject];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)prepareDataView:(CPView)aDataView forRow:(unsigned)aRow
|
||||
{
|
||||
var bindingsDictionary = [CPBinder allBindingsForObject:self],
|
||||
@@ -601,11 +643,6 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
// return nil;
|
||||
//}
|
||||
|
||||
- (void)setValue:(CPArray)content
|
||||
{
|
||||
[[self tableView] reloadData];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey",
|
||||
@@ -621,6 +658,9 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey",
|
||||
|
||||
@implementation CPTableColumn (CPCoding)
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super init];
|
||||
@@ -648,6 +688,9 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey",
|
||||
return self;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[aCoder encodeObject:_identifier forKey:CPTableColumnIdentifierKey];
|
||||
@@ -669,31 +712,45 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey",
|
||||
@end
|
||||
|
||||
@implementation CPTableColumn (NSInCompatibility)
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)setHeaderCell:(CPView)aView
|
||||
{
|
||||
[CPException raise:CPUnsupportedMethodException
|
||||
reason:@"setHeaderCell: is not supported. Use -setHeaderView:aView instead."];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (CPView)headerCell
|
||||
{
|
||||
[CPException raise:CPUnsupportedMethodException
|
||||
reason:@"headCell is not supported. Use -headerView instead."];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)setDataCell:(CPView)aView
|
||||
{
|
||||
[CPException raise:CPUnsupportedMethodException
|
||||
reason:@"setDataCell: is not supported. Use -setDataView:aView instead."];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (CPView)dataCell
|
||||
{
|
||||
[CPException raise:CPUnsupportedMethodException
|
||||
reason:@"dataCell is not supported. Use -dataView instead."];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (id)dataCellForRow:(int)row
|
||||
{
|
||||
[CPException raise:CPUnsupportedMethodException
|
||||
|
||||
+75
-32
@@ -147,7 +147,9 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
All delegate and data source methods are documented in the setDataSource: and setDelegate: methods.
|
||||
|
||||
If you want to display something other than just text in the table you should call setDataView: on a CPColumn object. More documentation in that class including theme states.
|
||||
If you want to display something other than just text in the table you should call setDataView: on a CPTableColumn object. More documentation in that class including theme states.
|
||||
|
||||
Note: CPTableView does not contain its own scrollview. You should be sure you place the tableview in a CPScrollView on your own.
|
||||
*/
|
||||
@implementation CPTableView : CPControl
|
||||
{
|
||||
@@ -315,7 +317,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
FIX ME: we have a lot of redundent init stuff in initWithFrame: and initWithCoder: we should move it all into here.
|
||||
FIX ME: we have a lot of redundant init stuff in initWithFrame: and initWithCoder: we should move it all into here.
|
||||
we should do a full audit of all the initializers before 1.0
|
||||
*/
|
||||
- (void)_init
|
||||
@@ -380,14 +382,14 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
/*!
|
||||
<pre>
|
||||
Sets the receiver's data source to a given object.
|
||||
The data source implements various methods for handeling the tableview's data when bindings are not used.
|
||||
The data source implements various methods for handling the tableview's data when bindings are not used.
|
||||
|
||||
Methonds include:
|
||||
Methods include:
|
||||
- (int)numberOfRowsInTableView:(CPTableView)aTableView;
|
||||
Returns the number of rows in the tableview
|
||||
|
||||
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRowIndex;
|
||||
Returns the object value for each dataview. Each dataview will be sent a setObjectValue: method which will contai
|
||||
Returns the object value for each dataview. Each dataview will be sent a setObjectValue: method which will contain
|
||||
the object you return from this datasource method.
|
||||
|
||||
Editing:
|
||||
@@ -399,15 +401,15 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
The tableview will call this method if you click the tableheader. You should sort the datasource based off of the new sort descriptors and reload the data
|
||||
|
||||
Drag and Drop:
|
||||
In order for the tableview to recieve drops dont forget to first register the tableview for drag types like you do with every other view
|
||||
In order for the tableview to receive drops don't forget to first register the tableview for drag types like you do with every other view
|
||||
|
||||
- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(CPDraggingInfo)info proposedRow:(int)row proposedDropOperation:(CPTableViewDropOperation)operation;
|
||||
Return the drag operation (move, copy, etc) that should be performaned if a registered drag type is over the tableview
|
||||
Return the drag operation (move, copy, etc) that should be performed if a registered drag type is over the tableview
|
||||
The data source can retarget a drop if you want by calling -(void)setDropRow:(int)aRow dropOperation:(CPTableViewDropOperation)anOperation;
|
||||
|
||||
- (BOOL)tableView:(CPTableView)aTableView writeRowsWithIndexes:(CPIndexSet)rowIndexes toPasteboard:(CPPasteboard)pboard;
|
||||
Returns YES if the drop operation is allowed otherwise NO.
|
||||
This method is invoked by the tabeview after a drag should begin, but before it is started. If you dont want the drag to being return NO.
|
||||
This method is invoked by the tableview after a drag should begin, but before it is started. If you don't want the drag to being return NO.
|
||||
If you want the drag to begin you should return YES and place the drag data on the pboard.
|
||||
|
||||
- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(CPDraggingInfo)info row:(int)row dropOperation:(CPTableViewDropOperation)operation;
|
||||
@@ -577,6 +579,11 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
_allowsMultipleSelection = !!shouldAllowMultipleSelection;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns YES if the tableview is allowed to have multiple selections, otherwise NO.
|
||||
|
||||
@return BOOL - YES if the tableview is allowed to have multiple selections otherwise NO.
|
||||
*/
|
||||
- (BOOL)allowsMultipleSelection
|
||||
{
|
||||
return _allowsMultipleSelection;
|
||||
@@ -623,7 +630,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
Sets the width and height between dataviews.
|
||||
This value is (3.0, 2.0) by default.
|
||||
|
||||
@param aSize a CGSize object that degined the space between the cells
|
||||
@param aSize a CGSize object that defines the space between the cells
|
||||
*/
|
||||
- (void)setIntercellSpacing:(CGSize)aSize
|
||||
{
|
||||
@@ -702,7 +709,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the colors for the rows as they alternate. The number of colors can be arbitrary. By deafult these colors are white and light blue.
|
||||
Sets the colors for the rows as they alternate. The number of colors can be arbitrary. By default these colors are white and light blue.
|
||||
@param anArray an array of CPColors
|
||||
*/
|
||||
|
||||
@@ -920,7 +927,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
Interally used to set a column that will be dragged
|
||||
Internally used to set a column that will be dragged
|
||||
*/
|
||||
- (void)_setDraggedColumn:(CPTableColumn)aColumn
|
||||
{
|
||||
@@ -1392,7 +1399,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
*/
|
||||
- (void)editColumn:(CPInteger)columnIndex row:(CPInteger)rowIndex withEvent:(CPEvent)theEvent select:(BOOL)flag
|
||||
{
|
||||
// FIX ME: Cocoa documenation says all this should be called in THIS method:
|
||||
// FIX ME: Cocoa documentation says all this should be called in THIS method:
|
||||
// sets up the field editor, and sends selectWithFrame:inView:editor:delegate:start:length: and editWithFrame:inView:editor:delegate:event: to the field editor's NSCell object with the NSTableView as the text delegate.
|
||||
|
||||
if (![self isRowSelected:rowIndex])
|
||||
@@ -1404,6 +1411,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
// TODO Do something with flag.
|
||||
|
||||
_editingCellIndex = CGPointMake(columnIndex, rowIndex);
|
||||
_editingCellIndex._shouldSelect = flag;
|
||||
|
||||
[self reloadDataForRowIndexes:[CPIndexSet indexSetWithIndex:rowIndex]
|
||||
columnIndexes:[CPIndexSet indexSetWithIndex:columnIndex]];
|
||||
}
|
||||
@@ -1453,7 +1462,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the headerview for the receiver. The headerview contains column headerviews for each table column
|
||||
Returns the headerview for the receiver. The headerview contains column headerviews for each table column.
|
||||
*/
|
||||
- (CPView)headerView
|
||||
{
|
||||
@@ -1462,8 +1471,11 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
|
||||
/*!
|
||||
Sets the headerview for the tableview. This is the container view for the table column header views
|
||||
Sets the headerview for the tableview. This is the container view for the table column header views.
|
||||
This view also handles events for resizing and dragging.
|
||||
|
||||
If you don't want your tableview to have a headerview you should pass nil. (also see setCornerView:)
|
||||
If you're looking to customize the header text of a column see CPTableColumn's -(CPView)headerView; method.
|
||||
*/
|
||||
- (void)setHeaderView:(CPView)aHeaderView
|
||||
{
|
||||
@@ -1907,7 +1919,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
i = 0;
|
||||
|
||||
// find resizable columns
|
||||
// FIX ME: we could cache resizableColumns after this loop and reuse it durring the resize
|
||||
// FIX ME: we could cache resizableColumns after this loop and reuse it during the resize
|
||||
for (; i < count; i++)
|
||||
{
|
||||
var tableColumn = _tableColumns[i];
|
||||
@@ -2273,7 +2285,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
Called when the tableview is about to display a dataview
|
||||
|
||||
- (BOOL)tableView:(CPTableView)tableView isGroupRow:(int)row;
|
||||
Group rows are a way to seperate a groups of data in a tableview. Return YES if the given row is a group row, otherwise NO.
|
||||
Group rows are a way to separate a groups of data in a tableview. Return YES if the given row is a group row, otherwise NO.
|
||||
|
||||
Editing Cells
|
||||
- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex;
|
||||
@@ -2298,7 +2310,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
NOTE: this is only called via user interaction
|
||||
|
||||
- (void)tableViewSelectionIsChanging:(CPNotification)aNotification
|
||||
Inform the delegate that the tableview is in the process of chaning the selection.
|
||||
Inform the delegate that the tableview is in the process of chaining the selection.
|
||||
This usually happens when the user is dragging their mouse across rows.
|
||||
NOTE: this is only called via user interaction
|
||||
|
||||
@@ -2312,7 +2324,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
Return YES if the column at a given index should move to a new column index, otherwise NO.
|
||||
|
||||
- (void)tableView:(CPTableView)tableView didDragTableColumn:(CPTableColumn)tableColumn;
|
||||
Notifies the delegate that the tableview drag occured. This is send on mouse up.
|
||||
Notifies the delegate that the tableview drag occurred. This is send on mouse up.
|
||||
|
||||
- (void)tableViewColumnDidMove:(CPNotification)aNotification;
|
||||
Notifies the delegate that a tablecolumn was moved by the user.
|
||||
@@ -2332,6 +2344,11 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
- (CPMenu)tableView:(CPTableView)aTableView menuForTableColumn:(CPTableColumn)aColumn row:(int)aRow
|
||||
Called when the user right clicks on the tableview. -1 is passed for the row or column if the user doesn't right click on a real row or column
|
||||
Return a CPMenu that should be displayed if the user right clicks. If you do not implement this the tableview will just call super on menuForEvent
|
||||
|
||||
Delete Key
|
||||
- (void)tableViewDeleteKeyPressed:(CPTableView)aTableView;
|
||||
Called when the user presses the delete key. Many times you will want to delete data (or prompt for deletion) when the user hids the delete key.
|
||||
Your delegate can implement this method to avoid subclassing the tableview to add this behaviour.
|
||||
</pre>
|
||||
@param aDelegate the delegate object for the tableview.
|
||||
|
||||
@@ -2673,7 +2690,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
@param dragRows an index set with the dragged row indexes
|
||||
@param theTableColumns an array of the table columns which are being dragged
|
||||
@param dragEvent the event which initiated the drag
|
||||
@param offset a point at wihch to set the drag image to be offset from the cursor
|
||||
@param offset a point at which to set the drag image to be offset from the cursor
|
||||
|
||||
@return CPImage an image to use for the drag feedback
|
||||
*/
|
||||
@@ -2683,12 +2700,14 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
}
|
||||
|
||||
/*!
|
||||
Computes and returns a view to use for dragging
|
||||
Computes and returns a view to use for dragging. By default this is a slightly transparent copy of the dataviews which are being dragged.
|
||||
You can override this in a subclass to show different dragging feedback. Additionally you can return nil from this method and implement:
|
||||
- (CPImage)dragImageForRowsWithIndexes:tableColumns:event:offset: - if you want to return a simple image.
|
||||
|
||||
@param dragRows an index set with the dragged row indexes
|
||||
@param theTableColumns an array of the table columns which are being dragged
|
||||
@param dragEvent the event which initiated the drag
|
||||
@param offset a point at wihch to set the drag image to be offset from the cursor
|
||||
@param offset a point at which to set the drag image to be offset from the cursor
|
||||
|
||||
@return CPView a view used as the dragging feedback
|
||||
*/
|
||||
@@ -2781,12 +2800,12 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the default operation mask for the drag behaviour of the table view.
|
||||
Sets the default operation mask for the drag behavior of the table view.
|
||||
NOTE: isLocal is not implemented.
|
||||
*/
|
||||
- (void)setDraggingSourceOperationMask:(CPDragOperation)mask forLocal:(BOOL)isLocal
|
||||
{
|
||||
//ignoral local for the time being since only one capp app can run at a time...
|
||||
//ignore local for the time being since only one capp app can run at a time...
|
||||
_dragOperationDefaultMask = mask;
|
||||
}
|
||||
|
||||
@@ -2814,6 +2833,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
/*!
|
||||
<pre>
|
||||
Sets the feedback style for when the table is the destination of a drag operation.
|
||||
This style is used to determine how the tableview looks when it is the receiver of a drag and drop operation.
|
||||
|
||||
Can be:
|
||||
CPTableViewDraggingDestinationFeedbackStyleNone
|
||||
CPTableViewDraggingDestinationFeedbackStyleRegular
|
||||
@@ -3167,6 +3188,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
else
|
||||
[dataView unsetThemeState:CPThemeStateSelectedDataView];
|
||||
|
||||
// FIX ME: for performance reasons we might consider diverging from cocoa and moving this to the reloadData method
|
||||
if (_implementedDelegateMethods & CPTableViewDelegate_tableView_isGroupRow_)
|
||||
{
|
||||
if ([_delegate tableView:self isGroupRow:row])
|
||||
@@ -3193,15 +3215,13 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
if (isButton || (_editingCellIndex && _editingCellIndex.x === column && _editingCellIndex.y === row))
|
||||
{
|
||||
if (!isButton)
|
||||
_editingCellIndex = undefined;
|
||||
|
||||
if (isTextField)
|
||||
{
|
||||
[dataView setEditable:YES];
|
||||
[dataView setSendsActionOnEndEditing:YES];
|
||||
[dataView setSelectable:YES];
|
||||
[dataView selectText:nil];
|
||||
[dataView setBezeled:YES];
|
||||
[dataView setDelegate:self];
|
||||
}
|
||||
|
||||
@@ -3259,6 +3279,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
*/
|
||||
- (void)_commitDataViewObjectValue:(id)sender
|
||||
{
|
||||
_editingCellIndex = nil;
|
||||
|
||||
[_dataSource tableView:self setObjectValue:[sender objectValue] forTableColumn:sender.tableViewEditedColumnObj row:sender.tableViewEditedRowIndex];
|
||||
|
||||
if ([sender respondsToSelector:@selector(setEditable:)])
|
||||
@@ -3267,7 +3289,14 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
if ([sender respondsToSelector:@selector(setSelectable:)])
|
||||
[sender setSelectable:NO];
|
||||
|
||||
if ([sender isKindOfClass:[CPTextField class]])
|
||||
[sender setBezeled:NO];
|
||||
|
||||
[self reloadDataForRowIndexes:[CPIndexSet indexSetWithIndex:sender.tableViewEditedRowIndex]
|
||||
columnIndexes:[CPIndexSet indexSetWithIndex:[_tableColumns indexOfObject:sender.tableViewEditedColumnObj]]];
|
||||
|
||||
[[self window] makeFirstResponder:self];
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -3284,6 +3313,11 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
if ([dataView respondsToSelector:@selector(setSelectable:)])
|
||||
[dataView setSelectable:NO];
|
||||
|
||||
if ([dataView isKindOfClass:[CPTextField class]])
|
||||
[dataView setBezeled:NO];
|
||||
|
||||
_editingCellIndex = nil;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -3391,6 +3425,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
/*!
|
||||
Draws the background in a given clip rect.
|
||||
This method should only be overridden if you want something other than a solid color or alternating row colors.
|
||||
NOTE: this method should not be called directly, instead use setNeedsDisplay:
|
||||
*/
|
||||
- (void)drawBackgroundInClipRect:(CGRect)aRect
|
||||
{
|
||||
@@ -3444,6 +3480,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
/*!
|
||||
Draws the grid for the tableview based on the set grid mask in a given clip rect.
|
||||
NOTE: this method should not be called directly, instead use setNeedsDisplay:
|
||||
*/
|
||||
- (void)drawGridInClipRect:(CGRect)aRect
|
||||
{
|
||||
@@ -3519,6 +3556,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
/*!
|
||||
Draws the selection with the set selection highlight style in a given clip rect.
|
||||
You can change the highlight style to a source list style gradient in setSelectionHighlightStyle:
|
||||
NOTE: this method should not be called directly, instead use setNeedsDisplay:
|
||||
*/
|
||||
- (void)highlightSelectionInClipRect:(CGRect)aRect
|
||||
{
|
||||
@@ -3569,7 +3608,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
var normalSelectionHighlightColor = [self selectionHighlightColor];
|
||||
|
||||
// dont do these lookups if there are no group rows
|
||||
// don't do these lookups if there are no group rows
|
||||
if ([_groupRows count])
|
||||
{
|
||||
var topGroupLineColor = [CPColor colorWithCalibratedWhite:212.0 / 255.0 alpha:1.0],
|
||||
@@ -3753,7 +3792,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
*/
|
||||
- (void)drawRow:(CPInteger)row clipRect:(CGRect)rect
|
||||
{
|
||||
// This method does currently nothing in cappuccino. Can be overriden by subclasses.
|
||||
// This method does currently nothing in cappuccino. Can be overridden by subclasses.
|
||||
|
||||
}
|
||||
|
||||
@@ -3841,7 +3880,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
{
|
||||
var row = [self rowAtPoint:aPoint];
|
||||
|
||||
//if the user clicks outside a row then deslect everything
|
||||
//if the user clicks outside a row then deselect everything
|
||||
if (row < 0 && _allowsEmptySelection)
|
||||
[self selectRowIndexes:[CPIndexSet indexSet] byExtendingSelection:NO];
|
||||
|
||||
@@ -3931,7 +3970,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
tableColumns = [_tableColumns objectsAtIndexes:_exposedColumns];
|
||||
|
||||
// We deviate from the default Cocoa implementation here by asking for a view in stead of an image
|
||||
// We support both, but the view prefered over the image because we can mimic the rows we are dragging
|
||||
// We support both, but the view preferred over the image because we can mimic the rows we are dragging
|
||||
// by re-creating the data views for the dragged rows
|
||||
var view = [self dragViewForRowsWithIndexes:_draggedRowIndexes
|
||||
tableColumns:tableColumns
|
||||
@@ -4089,6 +4128,9 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
[self _draggingEnded];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)_draggingEnded
|
||||
{
|
||||
_retargetedDropOperation = nil;
|
||||
@@ -4096,6 +4138,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
_draggedRowIndexes = [CPIndexSet indexSet];
|
||||
[_dropOperationFeedbackView removeFromSuperview];
|
||||
}
|
||||
|
||||
/*
|
||||
@ignore
|
||||
*/
|
||||
@@ -4409,7 +4452,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
var character = [anEvent charactersIgnoringModifiers],
|
||||
modifierFlags = [anEvent modifierFlags];
|
||||
|
||||
// Check for the key events manually, as opossed to waiting for CPWindow to sent the actual actio message
|
||||
// Check for the key events manually, as opposed to waiting for CPWindow to sent the actual action message
|
||||
// in _processKeyboardUIKey:, because we might not want to handle the arrow events.
|
||||
if (character === CPUpArrowFunctionKey || character === CPDownArrowFunctionKey)
|
||||
{
|
||||
@@ -4435,7 +4478,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
Selection behaviour depends on two things:
|
||||
Selection behavior depends on two things:
|
||||
_lastSelectedRow and the anchored selection (the last row selected by itself)
|
||||
*/
|
||||
- (void)_moveSelectionWithEvent:(CPEvent)theEvent upward:(BOOL)shouldGoUpward
|
||||
|
||||
+19
-10
@@ -509,7 +509,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
var contentRect = [self contentRectForBounds:[self bounds]],
|
||||
verticalAlign = [self currentValueForThemeAttribute:"vertical-alignment"];
|
||||
|
||||
switch(verticalAlign)
|
||||
switch (verticalAlign)
|
||||
{
|
||||
case CPTopVerticalTextAlignment:
|
||||
var topPoint = (_CGRectGetMinY(contentRect) + 1) + "px"; // for the same reason we have a -1 for the left, we also have a + 1 here
|
||||
@@ -528,10 +528,10 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
break;
|
||||
}
|
||||
|
||||
element.style.top = topPoint;
|
||||
element.style.top = topPoint;
|
||||
element.style.left = (_CGRectGetMinX(contentRect) - 1) + "px"; // why -1?
|
||||
element.style.width = _CGRectGetWidth(contentRect) + "px";
|
||||
element.style.height = font._lineHeight + "px"; // private ivar for the line height of the DOM text at this particaulr size
|
||||
element.style.height = font._lineHeight + "px"; // private ivar for the line height of the DOM text at this particular size
|
||||
|
||||
_DOMElement.appendChild(element);
|
||||
|
||||
@@ -585,7 +585,9 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
[self _setStringValue:element.value];
|
||||
|
||||
CPTextFieldInputResigning = YES;
|
||||
element.blur();
|
||||
|
||||
if (CPTextFieldInputIsActive)
|
||||
element.blur();
|
||||
|
||||
if (!CPTextFieldInputDidBlur)
|
||||
CPTextFieldBlurFunction();
|
||||
@@ -719,11 +721,11 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
/*!
|
||||
Invoke the action specified by aSelector on the current responder.
|
||||
|
||||
This is implemented by CPResponder and by default it passes any unrecignized
|
||||
actions on to the next responder but text fields appearently aren't supposed
|
||||
|
||||
This is implemented by CPResponder and by default it passes any unrecognized
|
||||
actions on to the next responder but text fields apparently aren't supposed
|
||||
to do that according to this documentation by Apple:
|
||||
|
||||
|
||||
http://developer.apple.com/mac/library/documentation/cocoa/reference/NSTextInputClient_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/NSTextInputClient/doCommandBySelector:
|
||||
*/
|
||||
- (void)doCommandBySelector:(SEL)aSelector
|
||||
@@ -1099,8 +1101,15 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
- (void)deleteBackward:(id)sender
|
||||
{
|
||||
var selectedRange = [self selectedRange],
|
||||
stringValue = [self stringValue],
|
||||
var selectedRange = [self selectedRange];
|
||||
|
||||
if (selectedRange.length < 2)
|
||||
return;
|
||||
|
||||
selectedRange.location += 1;
|
||||
selectedRange.length -= 1;
|
||||
|
||||
var stringValue = [self stringValue],
|
||||
newValue = [stringValue stringByReplacingCharactersInRange:selectedRange withString:""];
|
||||
|
||||
[self setStringValue:newValue];
|
||||
|
||||
@@ -179,7 +179,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
token = [self _inputElement].value;
|
||||
|
||||
// Make sure the user typed an actual token to prevent the previous token from being emptied
|
||||
// If the input area is empty, we want to fallback to the normal behaviour, resigning first responder or select the next or previous key view
|
||||
// If the input area is empty, we want to fallback to the normal behavior, resigning first responder or select the next or previous key view
|
||||
if (!token || token === @"")
|
||||
{
|
||||
if (DOMEvent && DOMEvent.keyCode === CPTabKeyCode)
|
||||
@@ -198,7 +198,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
var objectValue = [self objectValue];
|
||||
|
||||
// Remove the uncompleted token and add the token string.
|
||||
// Explicitely remove the last object because the array contains strings and removeObject uses isEqual to compare objects
|
||||
// Explicitly remove the last object because the array contains strings and removeObject uses isEqual to compare objects
|
||||
if (shouldRemoveLastObject)
|
||||
[objectValue removeObjectAtIndex:_selectedRange.location];
|
||||
|
||||
@@ -455,7 +455,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
- (CPArray)_tokens
|
||||
{
|
||||
// We return super here because objectValue uses this method
|
||||
// If we called self we would loop infinitly
|
||||
// If we called self we would loop infinitely
|
||||
return [super objectValue];
|
||||
}
|
||||
|
||||
@@ -633,7 +633,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
|
||||
CPTokenFieldTextDidChangeValue = [CPTokenFieldInputOwner stringValue];
|
||||
|
||||
// Update the selectedIndex if necesary
|
||||
// Update the selectedIndex if necessary
|
||||
var index = [[CPTokenFieldInputOwner autocompleteView] selectedRow];
|
||||
|
||||
if (aDOMEvent.keyCode === CPUpArrowKeyCode)
|
||||
@@ -665,7 +665,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
aDOMEvent.stopPropagation();
|
||||
aDOMEvent.cancelBubble = true;
|
||||
|
||||
// Only resign first responder if we weren't autocompleting
|
||||
// Only resign first responder if we weren't auto-completing
|
||||
if (![CPTokenFieldInputOwner hasThemeState:CPThemeStateAutoCompleting])
|
||||
{
|
||||
if (aDOMEvent && aDOMEvent.keyCode === CPReturnKeyCode)
|
||||
@@ -1129,7 +1129,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
return [];
|
||||
}
|
||||
|
||||
// // Alows the delegate to provide a string to be displayed as a proxy for the given represented object.
|
||||
// // Allows the delegate to provide a string to be displayed as a proxy for the given represented object.
|
||||
// // If you return nil or do not implement this method, then representedObject is displayed as the string.
|
||||
- (CPString)tokenField:(CPTokenField)tokenField displayStringForRepresentedObject:(id)representedObject
|
||||
{
|
||||
|
||||
+1
-1
@@ -464,7 +464,7 @@ var CPToolbarIdentifierKey = @"CPToolbarIdentifierKey",
|
||||
// Because we don't know if a delegate will be set later (it is optional
|
||||
// as of OS X 10.5), we need to call -_reloadToolbarItems here.
|
||||
// In order to load any toolbar items that may have been configured in the
|
||||
// Cib. Unfortunatelly this means that if there is a delegate
|
||||
// Cib. Unfortunately this means that if there is a delegate
|
||||
// specified, it will be read later and the resulting call to -setDelegate:
|
||||
// will cause -_reloadToolbarItems] to run again :-(
|
||||
// FIXME: Can we make this better?
|
||||
|
||||
+4
-4
@@ -705,7 +705,7 @@ var CPViewFlags = { },
|
||||
Sets the frame size of the receiver to the dimensions and origin of the provided rectangle in the coordinate system
|
||||
of the superview. The method also posts an CPViewFrameDidChangeNotification to the notification
|
||||
center if the receiver is configured to do so. If the frame is the same as the current frame, the method simply
|
||||
returns (and no notificaion is posted).
|
||||
returns (and no notification is posted).
|
||||
@param aFrame the rectangle specifying the new origin and size of the receiver
|
||||
*/
|
||||
- (void)setFrame:(CGRect)aFrame
|
||||
@@ -1735,7 +1735,7 @@ setBoundsOrigin:
|
||||
@param aLocation the lower-left corner coordinate of \c anImage
|
||||
@param mouseOffset the distance from the \c -mouseDown: location and the current location
|
||||
@param anEvent the \c -mouseDown: that triggered the drag
|
||||
@param aPastebaord the pasteboard that holds the drag data
|
||||
@param aPasteboard the pasteboard that holds the drag data
|
||||
@param aSourceObject the drag operation controller
|
||||
@param slideBack Whether the image should 'slide back' if the drag is rejected
|
||||
*/
|
||||
@@ -1750,7 +1750,7 @@ setBoundsOrigin:
|
||||
@param aLocation the top-left corner coordinate of \c aView
|
||||
@param mouseOffset the distance from the \c -mouseDown: location and the current location
|
||||
@param anEvent the \c -mouseDown: that triggered the drag
|
||||
@param aPastebaord the pasteboard that holds the drag data
|
||||
@param aPasteboard the pasteboard that holds the drag data
|
||||
@param aSourceObject the drag operation controller
|
||||
@param slideBack Whether the view should 'slide back' if the drag is rejected
|
||||
*/
|
||||
@@ -2100,7 +2100,7 @@ setBoundsOrigin:
|
||||
|
||||
/*!
|
||||
Scrolls the clip view to a specified point
|
||||
@param the clip view to scoll
|
||||
@param the clip view to scroll
|
||||
@param the point to scroll to
|
||||
*/
|
||||
- (void)scrollClipView:(CPClipView)aClipView toPoint:(CGPoint)aPoint
|
||||
|
||||
@@ -31,11 +31,41 @@ CPViewAnimationEffectKey = @"CPViewAnimationEffectKey";
|
||||
CPViewAnimationFadeInEffect = @"CPViewAnimationFadeInEffect";
|
||||
CPViewAnimationFadeOutEffect = @"CPViewAnimationFadeOutEffect";
|
||||
|
||||
/*!
|
||||
@class CPViewAnimation
|
||||
|
||||
CPViewAnimation is a subclass of CPAnimation that makes it easy to do
|
||||
basic animations on views.
|
||||
*/
|
||||
|
||||
@implementation CPViewAnimation : CPAnimation
|
||||
{
|
||||
CPArray _viewAnimations;
|
||||
}
|
||||
|
||||
/*!
|
||||
Designated initializer.
|
||||
|
||||
This method takes an array of CPDictionaries. Each dictionary should
|
||||
contain values for the following keys:
|
||||
|
||||
<pre>
|
||||
CPViewAnimationTargetKey - (Required) The view to animate.
|
||||
CPViewAnimationStartFrameKey - (Optional) The start frame of the target.
|
||||
CPViewAnimationEndFrameKey - (Optional) The end frame of the target.
|
||||
CPViewAnimationEffectKey - (Optional) a fade effect to use for the animation.
|
||||
</pre>
|
||||
|
||||
For example:
|
||||
<pre>
|
||||
var animation = [CPDictionary dictionaryWithObjects:[myViewToAnimate, aStartFrame, anEndFrame, CPViewAnimationFadeInEffect]
|
||||
forKeys:[CPViewAnimationTargetKey, CPViewAnimationStartFrameKey, CPViewAnimationEndFrameKey, CPViewAnimationEffectKey]];
|
||||
</pre>
|
||||
|
||||
If you pass nil instead of an array of dictionaries you should later call setViewAnimations:.
|
||||
|
||||
@param viewAnimations - An array of CPDictionaries for each animation.
|
||||
*/
|
||||
- (id)initWithViewAnimations:(CPArray)viewAnimations
|
||||
{
|
||||
if (self = [super initWithDuration:0.5 animationCurve:CPAnimationLinear])
|
||||
@@ -181,6 +211,11 @@ CPViewAnimationFadeOutEffect = @"CPViewAnimationFadeOutEffect";
|
||||
return _viewAnimations;
|
||||
}
|
||||
|
||||
/*!
|
||||
Takes an array of CPDictionaries as documented in initWithViewAnimations:.
|
||||
|
||||
@param viewAnimations - An array of dictionaries describing the animation.
|
||||
*/
|
||||
- (void)setViewAnimations:(CPArray)viewAnimations
|
||||
{
|
||||
if (viewAnimations != _viewAnimations)
|
||||
|
||||
+162
-8
@@ -43,6 +43,16 @@ CPWebViewScrollNative = 2;
|
||||
|
||||
/*!
|
||||
@ingroup appkit
|
||||
|
||||
@class CPWebView
|
||||
|
||||
CPWebView is a class which allows you to display arbitrary HTML or embed a
|
||||
webpage inside your application.
|
||||
|
||||
It's important to note that the same origin policy applies to this view.
|
||||
That is, if the web page being displayed is not located in the same origin
|
||||
(protocol, domain, and port) as the application, you will have limited
|
||||
control over the view and no access to its contents.
|
||||
*/
|
||||
|
||||
@implementation CPWebView : CPView
|
||||
@@ -236,6 +246,10 @@ CPWebViewScrollNative = 2;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the scroll mode of the receiver. Valid options are
|
||||
CPWebViewScrollAppKit and CPWebViewScrollNative.
|
||||
*/
|
||||
- (void)setScrollMode:(int)aScrollMode
|
||||
{
|
||||
if (_scrollMode == aScrollMode)
|
||||
@@ -277,11 +291,22 @@ CPWebViewScrollNative = 2;
|
||||
parent.appendChild(_iframe);
|
||||
}
|
||||
|
||||
/*!
|
||||
Loads a string of HTML into the webview.
|
||||
|
||||
@param CPString - The string to load.
|
||||
*/
|
||||
- (void)loadHTMLString:(CPString)aString
|
||||
{
|
||||
[self loadHTMLString:aString baseURL:nil];
|
||||
}
|
||||
|
||||
/*!
|
||||
Loads a string of HTML into the webview.
|
||||
|
||||
@param CPString - The string to load.
|
||||
@param CPURL - The base url of the string. (not implemented)
|
||||
*/
|
||||
- (void)loadHTMLString:(CPString)aString baseURL:(CPURL)URL
|
||||
{
|
||||
// FIXME: do something with baseURL?
|
||||
@@ -365,11 +390,21 @@ CPWebViewScrollNative = 2;
|
||||
[_frameLoadDelegate webView:self didFinishLoadForFrame:nil]; // FIXME: give this a frame somehow?
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the URL of the main frame.
|
||||
|
||||
@return CPString - The URL of the main frame.
|
||||
*/
|
||||
- (CPString)mainFrameURL
|
||||
{
|
||||
return _mainFrameURL;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the URL of the main frame.
|
||||
|
||||
@param CPString - the url to set.
|
||||
*/
|
||||
- (void)setMainFrameURL:(CPString)URLString
|
||||
{
|
||||
if (_mainFrameURL)
|
||||
@@ -380,6 +415,11 @@ CPWebViewScrollNative = 2;
|
||||
[self _loadMainFrameURL];
|
||||
}
|
||||
|
||||
/*!
|
||||
Tells the webview to navigate to the previous page.
|
||||
|
||||
@return BOOL - YES if the receiver was able to go back, otherwise NO.
|
||||
*/
|
||||
- (BOOL)goBack
|
||||
{
|
||||
if (_backwardStack.length > 0)
|
||||
@@ -396,6 +436,11 @@ CPWebViewScrollNative = 2;
|
||||
return NO;
|
||||
}
|
||||
|
||||
/*!
|
||||
Tells the receiver to go forward in page history.
|
||||
|
||||
@return - YES if the receiver was able to go forward, otherwise NO.
|
||||
*/
|
||||
- (BOOL)goForward
|
||||
{
|
||||
if (_forwardStack.length > 0)
|
||||
@@ -412,11 +457,23 @@ CPWebViewScrollNative = 2;
|
||||
return NO;
|
||||
}
|
||||
|
||||
/*!
|
||||
Checks to see if the webview has a history stack you can navigate back
|
||||
through.
|
||||
|
||||
@return BOOL - YES if the receiver can navigate backward through history, otherwise NO.
|
||||
*/
|
||||
- (BOOL)canGoBack
|
||||
{
|
||||
return (_backwardStack.length > 0);
|
||||
}
|
||||
|
||||
/*!
|
||||
Checks to see if the webview has a history stack you can navigate forward
|
||||
through.
|
||||
|
||||
@return BOOL - YES if the receiver can navigate forward through history, otherwise NO.
|
||||
*/
|
||||
- (BOOL)canGoForward
|
||||
{
|
||||
return (_forwardStack.length > 0);
|
||||
@@ -428,16 +485,30 @@ CPWebViewScrollNative = 2;
|
||||
return { back: _backwardStack, forward: _forwardStack };
|
||||
}
|
||||
|
||||
/*!
|
||||
Closes the webview by unloading the webpage. The webview will no longer
|
||||
respond to load requests or delegate methods once this is called.
|
||||
*/
|
||||
- (void)close
|
||||
{
|
||||
_iframe.parentNode.removeChild(_iframe);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the window object of the webview.
|
||||
|
||||
@return DOMWindow - The window object.
|
||||
*/
|
||||
- (DOMWindow)DOMWindow
|
||||
{
|
||||
return (_iframe.contentDocument && _iframe.contentDocument.defaultView) || _iframe.contentWindow;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the root Object of the webview as a CPWebScriptObject.
|
||||
|
||||
@return CPWebScriptObject - the Object of the webview.
|
||||
*/
|
||||
- (CPWebScriptObject)windowScriptObject
|
||||
{
|
||||
var win = [self DOMWindow];
|
||||
@@ -451,17 +522,37 @@ CPWebViewScrollNative = 2;
|
||||
return _wso;
|
||||
}
|
||||
|
||||
/*!
|
||||
Evaluates a javascript string in the webview and returns the result of
|
||||
that evaluation as a string.
|
||||
|
||||
@param script - A string of javascript.
|
||||
@return CPString - The result of the evaluation.
|
||||
*/
|
||||
- (CPString)stringByEvaluatingJavaScriptFromString:(CPString)script
|
||||
{
|
||||
var result = [self objectByEvaluatingJavaScriptFromString:script];
|
||||
return result ? String(result) : nil;
|
||||
}
|
||||
|
||||
/*!
|
||||
Evaluates a string of javascript in the webview and returns the result.
|
||||
|
||||
@param script - A string of javascript.
|
||||
@return JSObject - A JSObject resulting from the evaluation.
|
||||
*/
|
||||
- (JSObject)objectByEvaluatingJavaScriptFromString:(CPString)script
|
||||
{
|
||||
return [[self windowScriptObject] evaluateWebScript:script];
|
||||
}
|
||||
|
||||
/*!
|
||||
Gets the computed style for an element.
|
||||
|
||||
@param DOMElement - An Element.
|
||||
@param pseudoElement - A pseudoElement.
|
||||
@return DOMCSSStyleDeclaration - The computed style for an element.
|
||||
*/
|
||||
- (DOMCSSStyleDeclaration)computedStyleForElement:(DOMElement)element pseudoElement:(CPString)pseudoElement
|
||||
{
|
||||
var win = [[self windowScriptObject] window];
|
||||
@@ -474,47 +565,85 @@ CPWebViewScrollNative = 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
@return BOOL - YES if the webview draws its own background, otherwise NO.
|
||||
*/
|
||||
- (BOOL)drawsBackground
|
||||
{
|
||||
return _iframe.style.backgroundColor != "";
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets whether the webview draws its own background.
|
||||
|
||||
@param BOOL - YES if the webview should draw its background, otherwise NO.
|
||||
*/
|
||||
- (void)setDrawsBackground:(BOOL)drawsBackround
|
||||
{
|
||||
_iframe.style.backgroundColor = drawsBackround ? "white" : "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// IBActions
|
||||
|
||||
- (IBAction)takeStringURLFrom:(id)sender
|
||||
/*!
|
||||
Used with the target/action mechanism to automatically set the webviews
|
||||
mainFrameURL to the senders stringValue.
|
||||
|
||||
@param sender - the sender of the action. Should respond to -stringValue.
|
||||
*/
|
||||
- (@action)takeStringURLFrom:(id)sender
|
||||
{
|
||||
[self setMainFrameURL:[sender stringValue]];
|
||||
}
|
||||
|
||||
- (IBAction)goBack:(id)sender
|
||||
/*!
|
||||
Same as -goBack but takes a sender as a param.
|
||||
|
||||
@param sender - the sender of the action.
|
||||
*/
|
||||
- (@action)goBack:(id)sender
|
||||
{
|
||||
[self goBack];
|
||||
}
|
||||
|
||||
- (IBAction)goForward:(id)sender
|
||||
/*!
|
||||
Same as -goForward but takes a sender as a param.
|
||||
|
||||
@param sender - the sender of the action.
|
||||
*/
|
||||
- (@action)goForward:(id)sender
|
||||
{
|
||||
[self goForward];
|
||||
}
|
||||
|
||||
- (IBAction)stopLoading:(id)sender
|
||||
/*!
|
||||
Stops loading the webview. (not yet implemented)
|
||||
|
||||
@param sender - the sender of the action.
|
||||
*/
|
||||
- (@action)stopLoading:(id)sender
|
||||
{
|
||||
// FIXME: what to do?
|
||||
}
|
||||
|
||||
- (IBAction)reload:(id)sender
|
||||
/*!
|
||||
Reloads the webview.
|
||||
|
||||
@param sender - the sender of the action.
|
||||
*/
|
||||
- (@action)reload:(id)sender
|
||||
{
|
||||
[self _loadMainFrameURL];
|
||||
}
|
||||
|
||||
- (IBAction)print:(id)sender
|
||||
/*!
|
||||
Tells the webview to print. If the webview is unable to print due to
|
||||
browser restrictions the user is alerted to print from the file menu.
|
||||
|
||||
@param sender - the sender of the receiver.
|
||||
*/
|
||||
- (@action)print:(id)sender
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -574,12 +703,19 @@ CPWebViewScrollNative = 2;
|
||||
|
||||
@end
|
||||
|
||||
/*!
|
||||
@class CPWebScriptObject
|
||||
|
||||
A CPWebScriptObject is an Objective-J wrapper around a scripting object.
|
||||
*/
|
||||
@implementation CPWebScriptObject : CPObject
|
||||
{
|
||||
Window _window;
|
||||
}
|
||||
|
||||
/*!
|
||||
Initializes the scripting object with the scripting Window object.
|
||||
*/
|
||||
- (id)initWithWindow:(Window)aWindow
|
||||
{
|
||||
if (self = [super init])
|
||||
@@ -589,6 +725,12 @@ CPWebViewScrollNative = 2;
|
||||
return self;
|
||||
}
|
||||
|
||||
/*!
|
||||
Call a method with arguments on the receiver.
|
||||
|
||||
@param methodName - The method that should be called.
|
||||
@param args - An array of arguments to pass to the method call.
|
||||
*/
|
||||
- (id)callWebScriptMethod:(CPString)methodName withArguments:(CPArray)args
|
||||
{
|
||||
// Would using "with" be better here?
|
||||
@@ -602,15 +744,25 @@ CPWebViewScrollNative = 2;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/*!
|
||||
Evaluates a string of javascript and returns the result.
|
||||
|
||||
@param script - The script to run.
|
||||
@return - The result of the evaluation, which may be 'undefined'.
|
||||
*/
|
||||
- (id)evaluateWebScript:(CPString)script
|
||||
{
|
||||
try {
|
||||
return _window.eval(script);
|
||||
} catch (e) {
|
||||
// FIX ME: if we fail inside here, shouldn't we return an exception?
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the receivers Window object.
|
||||
*/
|
||||
- (Window)window
|
||||
{
|
||||
return _window;
|
||||
@@ -623,6 +775,7 @@ CPWebViewScrollNative = 2;
|
||||
|
||||
/*!
|
||||
Initializes the web view from the data in a coder.
|
||||
|
||||
@param aCoder the coder from which to read the data
|
||||
@return the initialized web view
|
||||
*/
|
||||
@@ -650,6 +803,7 @@ CPWebViewScrollNative = 2;
|
||||
|
||||
/*!
|
||||
Writes out the web view's instance information to a coder.
|
||||
|
||||
@param aCoder the coder to which to write the data
|
||||
*/
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
|
||||
+101
-5
@@ -539,6 +539,12 @@ CPTexturedBackgroundWindowMask
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the receiver as a full platform window. If you pass YES the CPWindow instance will fill the entire browser content area,
|
||||
otherwise the CPWindow will be a window inside of your browser window which the user can drag around, and resize (if you allow).
|
||||
|
||||
@param BOOL - YES if the window should fill the browser window, otherwise NO.
|
||||
*/
|
||||
- (void)setFullPlatformWindow:(BOOL)shouldBeFullPlatformWindow
|
||||
{
|
||||
if (![_platformWindow supportsFullPlatformWindows])
|
||||
@@ -579,6 +585,9 @@ CPTexturedBackgroundWindowMask
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@return BOOL - YES if the CPWindow fills the browser window, otherwise NO.
|
||||
*/
|
||||
- (BOOL)isFullPlatformWindow
|
||||
{
|
||||
return _isFullPlatformWindow;
|
||||
@@ -594,6 +603,18 @@ CPTexturedBackgroundWindowMask
|
||||
|
||||
/*!
|
||||
Returns the frame rectangle used by a window.
|
||||
Style masks include:
|
||||
<pre>
|
||||
CPBorderlessWindowMask
|
||||
CPTitledWindowMask
|
||||
CPClosableWindowMask
|
||||
CPMiniaturizableWindowMask (NOTE: only available in NativeHost)
|
||||
CPResizableWindowMask
|
||||
CPTexturedBackgroundWindowMask
|
||||
CPBorderlessBridgeWindowMask
|
||||
CPHUDBackgroundWindowMask
|
||||
</pre>
|
||||
|
||||
@param aContentRect the content rectangle of the window
|
||||
@param aStyleMask the style mask of the window
|
||||
@return the matching window's frame rectangle
|
||||
@@ -635,7 +656,7 @@ CPTexturedBackgroundWindowMask
|
||||
the resize operation, and redraw itself if necessary.
|
||||
@param aFrame the new size and location for the window
|
||||
@param shouldDisplay whether the window should redraw its views
|
||||
@param shouldAnimate whether the window resize should be animated
|
||||
@param shouldAnimate whether the window resize should be animated.
|
||||
*/
|
||||
- (void)_setClippedFrame:(CGRect)aFrame display:(BOOL)shouldDisplay animate:(BOOL)shouldAnimate
|
||||
{
|
||||
@@ -644,6 +665,13 @@ CPTexturedBackgroundWindowMask
|
||||
[self setFrame:aFrame display:shouldDisplay animate:shouldAnimate];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the frame of the window.
|
||||
|
||||
@param aFrame - A CGRect of the new frame for the receiver.
|
||||
@param shouldDisplay - YES if the window should call setNeedsDisplay otherwise NO.
|
||||
@param shouldAnimate - YES if the window should animate to it's new size and position, otherwise NO.
|
||||
*/
|
||||
- (void)setFrame:(CGRect)aFrame display:(BOOL)shouldDisplay animate:(BOOL)shouldAnimate
|
||||
{
|
||||
aFrame = _CGRectMakeCopy(aFrame);
|
||||
@@ -721,6 +749,11 @@ CPTexturedBackgroundWindowMask
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the window's frame rect.
|
||||
@param aFrame - The new CGRect of the window.
|
||||
@param shouldDisplay - YES if the window should call setNeedsDisplay: otherwise NO.
|
||||
*/
|
||||
- (void)setFrame:(CGRect)aFrame display:(BOOL)shouldDisplay
|
||||
{
|
||||
[self _setClippedFrame:aFrame display:shouldDisplay animate:NO];
|
||||
@@ -728,6 +761,7 @@ CPTexturedBackgroundWindowMask
|
||||
|
||||
/*!
|
||||
Sets the window's frame rectangle
|
||||
@param aFrame - The CGRect of the windows new frame
|
||||
*/
|
||||
- (void)setFrame:(CGRect)aFrame
|
||||
{
|
||||
@@ -1111,6 +1145,17 @@ CPTexturedBackgroundWindowMask
|
||||
[self _updateShadow];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the shadow style of the receiver.
|
||||
Values are:
|
||||
<pre>
|
||||
CPWindowShadowStyleStandard
|
||||
CPWindowShadowStyleMenu
|
||||
CPWindowShadowStylePanel
|
||||
</pre>
|
||||
|
||||
@param aStyle - The new shadow style of the receiver.
|
||||
*/
|
||||
- (void)setShadowStyle:(unsigned)aStyle
|
||||
{
|
||||
_shadowStyle = aStyle;
|
||||
@@ -1631,7 +1676,7 @@ CPTexturedBackgroundWindowMask
|
||||
@param aLocation the lower-left corner coordinate of \c anImage
|
||||
@param mouseOffset the distance from the \c -mouseDown: location and the current location
|
||||
@param anEvent the \c -mouseDown: that triggered the drag
|
||||
@param aPastebaord the pasteboard that holds the drag data
|
||||
@param aPasteboard the pasteboard that holds the drag data
|
||||
@param aSourceObject the drag operation controller
|
||||
@param slideBack Whether the image should 'slide back' if the drag is rejected
|
||||
*/
|
||||
@@ -1668,7 +1713,7 @@ CPTexturedBackgroundWindowMask
|
||||
@param aLocation the lower-left corner coordinate of \c aView
|
||||
@param mouseOffset the distance from the \c -mouseDown: location and the current location
|
||||
@param anEvent the \c -mouseDown: that triggered the drag
|
||||
@param aPastebaord the pasteboard that holds the drag data
|
||||
@param aPasteboard the pasteboard that holds the drag data
|
||||
@param aSourceObject the drag operation controller
|
||||
@param slideBack Whether the view should 'slide back' if the drag is rejected
|
||||
*/
|
||||
@@ -1819,7 +1864,7 @@ CPTexturedBackgroundWindowMask
|
||||
}
|
||||
|
||||
/*!
|
||||
Restores a mimized window to it's original size.
|
||||
Restores a minimized window to it's original size.
|
||||
*/
|
||||
- (void)deminiaturize:(id)sender
|
||||
{
|
||||
@@ -2448,16 +2493,31 @@ CPTexturedBackgroundWindowMask
|
||||
[self makeFirstResponder:[aView previousValidKeyView]];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the default button for the window.
|
||||
Note: this method is deprecated use setDefaultButton: instead.
|
||||
@param aButton - The button that should become default.
|
||||
*/
|
||||
- (void)setDefaultButtonCell:(CPButton)aButton
|
||||
{
|
||||
[self setDefaultButton:aButton];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the default button of the receiver.
|
||||
NOTE: This method is deprecated. Use defaultButton instead.
|
||||
*/
|
||||
- (CPButton)defaultButtonCell
|
||||
{
|
||||
return [self defaultButton];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the default button for the window.
|
||||
This is equivalent to setting the the key equivalent of the button to "return".
|
||||
Additionally this will turn your button blue (with the Aristo theme).
|
||||
@param aButton - The button that should become default.
|
||||
*/
|
||||
- (void)setDefaultButton:(CPButton)aButton
|
||||
{
|
||||
if (_defaultButton === aButton)
|
||||
@@ -2472,26 +2532,43 @@ CPTexturedBackgroundWindowMask
|
||||
[_defaultButton setKeyEquivalent:CPCarriageReturnCharacter];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the default button of the receiver.
|
||||
*/
|
||||
- (CPButton)defaultButton
|
||||
{
|
||||
return _defaultButton;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the default button key equivalent to "return".
|
||||
*/
|
||||
- (void)enableKeyEquivalentForDefaultButton
|
||||
{
|
||||
_defaultButtonEnabled = YES;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the default button key equivalent to "return".
|
||||
NOTE: this method is deprecated. Use enableKeyEquivalentForDefaultButton instead.
|
||||
*/
|
||||
- (void)enableKeyEquivalentForDefaultButtonCell
|
||||
{
|
||||
[self enableKeyEquivalentForDefaultButton];
|
||||
}
|
||||
|
||||
/*!
|
||||
Removes the key equivalent for the default button.
|
||||
*/
|
||||
- (void)disableKeyEquivalentForDefaultButton
|
||||
{
|
||||
_defaultButtonEnabled = NO;
|
||||
}
|
||||
|
||||
/*!
|
||||
Removes the key equivalent for the default button.
|
||||
Note: this method is deprecated. Use disableKeyEquivalentForDefaultButton instead.
|
||||
*/
|
||||
- (void)disableKeyEquivalentForDefaultButtonCell
|
||||
{
|
||||
[self disableKeyEquivalentForDefaultButton];
|
||||
@@ -2603,16 +2680,25 @@ var keyViewComparator = function(lhs, rhs, context)
|
||||
return _autoresizingMask;
|
||||
}
|
||||
|
||||
/*!
|
||||
Converts aPoint from the window coordinate system to the global coordinate system.
|
||||
*/
|
||||
- (CGPoint)convertBaseToGlobal:(CGPoint)aPoint
|
||||
{
|
||||
return [CPPlatform isBrowser] ? [self convertBaseToPlatformWindow:aPoint] : [self convertBaseToScreen:aPoint];
|
||||
}
|
||||
|
||||
/*!
|
||||
Converts aPoint from the global coordinate system to the window coordinate system.
|
||||
*/
|
||||
- (CGPoint)convertGlobalToBase:(CGPoint)aPoint
|
||||
{
|
||||
return [CPPlatform isBrowser] ? [self convertPlatformWindowToBase:aPoint] : [self convertScreenToBase:aPoint];
|
||||
}
|
||||
|
||||
/*!
|
||||
Converts aPoint from the window coordinate system to the coordinate system of the parent platform window.
|
||||
*/
|
||||
- (CGPoint)convertBaseToPlatformWindow:(CGPoint)aPoint
|
||||
{
|
||||
if ([self _sharesChromeWithPlatformWindow])
|
||||
@@ -2623,6 +2709,9 @@ var keyViewComparator = function(lhs, rhs, context)
|
||||
return _CGPointMake(aPoint.x + origin.x, aPoint.y + origin.y);
|
||||
}
|
||||
|
||||
/*!
|
||||
Converts aPoint from the parent platform window coordinate system to the windows coordinate system.
|
||||
*/
|
||||
- (CGPoint)convertPlatformWindowToBase:(CGPoint)aPoint
|
||||
{
|
||||
if ([self _sharesChromeWithPlatformWindow])
|
||||
@@ -2712,12 +2801,19 @@ var keyViewComparator = function(lhs, rhs, context)
|
||||
@end
|
||||
|
||||
@implementation CPWindow (Deprecated)
|
||||
|
||||
/*!
|
||||
Sets the CPWindow to fill the whole browser window.
|
||||
NOTE: this method has been deprecated in favor of setFullPlatformWindow:
|
||||
*/
|
||||
- (void)setFullBridge:(BOOL)shouldBeFullBridge
|
||||
{
|
||||
[self setFullPlatformWindow:shouldBeFullBridge];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns YES if the window fills the full browser window, otherwise NO.
|
||||
NOTE: this method has been deprecated in favor of isFullPlatformWindow.
|
||||
*/
|
||||
- (BOOL)isFullBridge
|
||||
{
|
||||
return [self isFullPlatformWindow];
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
/*!
|
||||
Initializes the controller with a window.
|
||||
@param aWindow the window to control
|
||||
@return the initialzed window controller
|
||||
@return the initialized window controller
|
||||
*/
|
||||
- (id)initWithWindow:(CPWindow)aWindow
|
||||
{
|
||||
@@ -82,7 +82,7 @@
|
||||
}
|
||||
|
||||
/*!
|
||||
Initializes the controller with a Capppuccino Interface Builder name.
|
||||
Initializes the controller with a Cappuccino Interface Builder name.
|
||||
@param aWindowCibName the cib name of the window to control
|
||||
@return the initialized window controller
|
||||
*/
|
||||
|
||||
@@ -12,15 +12,15 @@
|
||||
- (id)initForReadingWithData:(CPData)data bundle:(CPBundle)aBundle awakenCustomResources:(BOOL)shouldAwakenCustomResources
|
||||
{
|
||||
self = [super initForReadingWithData:data];
|
||||
|
||||
|
||||
if (self)
|
||||
{
|
||||
_bundle = aBundle;
|
||||
_awakenCustomResources = shouldAwakenCustomResources;
|
||||
|
||||
|
||||
[self setDelegate:self];
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,19 +5,19 @@
|
||||
@import "CPWindow.j"
|
||||
|
||||
|
||||
var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinSizeKey",
|
||||
_CPCibWindowTemplateMaxSizeKey = @"_CPCibWindowTemplateMaxSizeKey",
|
||||
|
||||
_CPCibWindowTemplateViewClassKey = @"_CPCibWindowTemplateViewClassKey",
|
||||
_CPCibWindowTemplateWindowClassKey = @"_CPCibWindowTemplateWindowClassKey",
|
||||
|
||||
_CPCibWindowTemplateWindowRectKey = @"_CPCibWindowTemplateWindowRectKey",
|
||||
_CPCibWindowTemplateWindowStyleMaskKey = @"_CPCibWindowTempatStyleMaskKey",
|
||||
_CPCibWindowTemplateWindowTitleKey = @"_CPCibWindowTemplateWindowTitleKey",
|
||||
_CPCibWindowTemplateWindowViewKey = @"_CPCibWindowTemplateWindowViewKey",
|
||||
var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinSizeKey",
|
||||
_CPCibWindowTemplateMaxSizeKey = @"_CPCibWindowTemplateMaxSizeKey",
|
||||
|
||||
_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop = @"_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop";
|
||||
_CPCibWindowTemplateWindowIsFullPlatformWindowKey = @"_CPCibWindowTemplateWindowIsFullPlatformWindowKey";
|
||||
_CPCibWindowTemplateViewClassKey = @"_CPCibWindowTemplateViewClassKey",
|
||||
_CPCibWindowTemplateWindowClassKey = @"_CPCibWindowTemplateWindowClassKey",
|
||||
|
||||
_CPCibWindowTemplateWindowRectKey = @"_CPCibWindowTemplateWindowRectKey",
|
||||
_CPCibWindowTemplateWindowStyleMaskKey = @"_CPCibWindowTempatStyleMaskKey",
|
||||
_CPCibWindowTemplateWindowTitleKey = @"_CPCibWindowTemplateWindowTitleKey",
|
||||
_CPCibWindowTemplateWindowViewKey = @"_CPCibWindowTemplateWindowViewKey",
|
||||
|
||||
_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop = @"_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop",
|
||||
_CPCibWindowTemplateWindowIsFullPlatformWindowKey = @"_CPCibWindowTemplateWindowIsFullPlatformWindowKey";
|
||||
|
||||
@implementation _CPCibWindowTemplate : CPObject
|
||||
{
|
||||
@@ -60,27 +60,27 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinS
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
||||
if (self)
|
||||
{
|
||||
if ([aCoder containsValueForKey:_CPCibWindowTemplateMinSizeKey])
|
||||
_minSize = [aCoder decodeSizeForKey:_CPCibWindowTemplateMinSizeKey];
|
||||
if ([aCoder containsValueForKey:_CPCibWindowTemplateMaxSizeKey])
|
||||
_maxSize = [aCoder decodeSizeForKey:_CPCibWindowTemplateMaxSizeKey];
|
||||
|
||||
|
||||
_viewClass = [aCoder decodeObjectForKey:_CPCibWindowTemplateViewClassKey];
|
||||
|
||||
|
||||
_windowClass = [aCoder decodeObjectForKey:_CPCibWindowTemplateWindowClassKey];
|
||||
_windowRect = [aCoder decodeRectForKey:_CPCibWindowTemplateWindowRectKey];
|
||||
_windowStyleMask = [aCoder decodeIntForKey:_CPCibWindowTemplateWindowStyleMaskKey];
|
||||
|
||||
|
||||
_windowTitle = [aCoder decodeObjectForKey:_CPCibWindowTemplateWindowTitleKey];
|
||||
_windowView = [aCoder decodeObjectForKey:_CPCibWindowTemplateWindowViewKey];
|
||||
|
||||
_windowAutorecalculatesKeyViewLoop = !![aCoder decodeObjectForKey:_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop];
|
||||
_windowIsFullPlatformWindow = !![aCoder decodeObjectForKey:_CPCibWindowTemplateWindowIsFullPlatformWindowKey];
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -90,13 +90,13 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinS
|
||||
[aCoder encodeSize:_minSize forKey:_CPCibWindowTemplateMinSizeKey];
|
||||
if (_maxSize)
|
||||
[aCoder encodeSize:_maxSize forKey:_CPCibWindowTemplateMaxSizeKey];
|
||||
|
||||
|
||||
[aCoder encodeObject:_viewClass forKey:_CPCibWindowTemplateViewClassKey];
|
||||
|
||||
|
||||
[aCoder encodeObject:_windowClass forKey:_CPCibWindowTemplateWindowClassKey];
|
||||
[aCoder encodeRect:_windowRect forKey:_CPCibWindowTemplateWindowRectKey];
|
||||
[aCoder encodeInt:_windowStyleMask forKey:_CPCibWindowTemplateWindowStyleMaskKey];
|
||||
|
||||
|
||||
[aCoder encodeObject:_windowTitle forKey:_CPCibWindowTemplateWindowTitleKey];
|
||||
[aCoder encodeObject:_windowView forKey:_CPCibWindowTemplateWindowViewKey];
|
||||
|
||||
@@ -126,13 +126,13 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinS
|
||||
- (id)_cibInstantiate
|
||||
{
|
||||
var windowClass = CPClassFromString([self windowClass]);
|
||||
|
||||
|
||||
/* if (!windowClass)
|
||||
[NSException raise:NSInvalidArgumentException format:@"Unable to locate NSWindow class %@, using NSWindow",_windowClass];
|
||||
class=[NSWindow class];*/
|
||||
|
||||
|
||||
var theWindow = [[windowClass alloc] initWithContentRect:_windowRect styleMask:_windowStyleMask];
|
||||
|
||||
|
||||
if (_minSize)
|
||||
[theWindow setMinSize:_minSize];
|
||||
if (_maxSize)
|
||||
@@ -147,7 +147,7 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinS
|
||||
[theWindow setContentView:_windowView];
|
||||
|
||||
[_windowView setAutoresizesSubviews:YES];
|
||||
|
||||
|
||||
if ([_viewClass isKindOfClass:[CPToolbar class]])
|
||||
{
|
||||
[theWindow setToolbar:_viewClass];
|
||||
|
||||
+148
-148
@@ -64,54 +64,54 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
@implementation CALayer : CPObject
|
||||
{
|
||||
// Modifying the Layer Geometry
|
||||
|
||||
|
||||
CGRect _frame;
|
||||
CGRect _bounds;
|
||||
CGPoint _position;
|
||||
unsigned _zPosition;
|
||||
CGPoint _anchorPoint;
|
||||
|
||||
|
||||
CGAffineTransform _affineTransform;
|
||||
CGAffineTransform _sublayerTransform;
|
||||
CGAffineTransform _sublayerTransformForSublayers;
|
||||
|
||||
|
||||
CGRect _backingStoreFrame;
|
||||
CGRect _standardBackingStoreFrame;
|
||||
|
||||
|
||||
BOOL _hasSublayerTransform;
|
||||
BOOL _hasCustomBackingStoreFrame;
|
||||
|
||||
|
||||
// Style Attributes
|
||||
|
||||
|
||||
float _opacity;
|
||||
BOOL _isHidden;
|
||||
CPColor _backgroundColor;
|
||||
|
||||
|
||||
// Managing Layer Hierarchy
|
||||
|
||||
|
||||
CALayer _superlayer;
|
||||
CPMutableArray _sublayers;
|
||||
|
||||
// Updating Layer Display
|
||||
|
||||
|
||||
unsigned _runLoopUpdateMask;
|
||||
BOOL _needsDisplayOnBoundsChange;
|
||||
|
||||
// Modifying the Delegate
|
||||
|
||||
|
||||
id _delegate;
|
||||
|
||||
|
||||
BOOL _delegateRespondsToDisplayLayerSelector;
|
||||
BOOL _delegateRespondsToDrawLayerInContextSelector;
|
||||
|
||||
|
||||
// DOM Implementation
|
||||
|
||||
|
||||
DOMElement _DOMElement;
|
||||
DOMElement _DOMContentsElement;
|
||||
id _contents;
|
||||
CGContext _context;
|
||||
CPView _owningView;
|
||||
|
||||
|
||||
CGAffineTransform _transformToLayer;
|
||||
CGAffineTransform _transformFromLayer;
|
||||
}
|
||||
@@ -130,14 +130,14 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
||||
if (self)
|
||||
{
|
||||
_frame = CGRectMakeZero();
|
||||
|
||||
|
||||
_backingStoreFrame = CGRectMakeZero();
|
||||
_standardBackingStoreFrame = CGRectMakeZero();
|
||||
|
||||
|
||||
_bounds = CGRectMakeZero();
|
||||
_position = CGPointMakeZero();
|
||||
_zPosition = 0.0;
|
||||
@@ -147,15 +147,15 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
|
||||
_transformToLayer = CGAffineTransformMakeIdentity(); // FIXME? does it matter?
|
||||
_transformFromLayer = CGAffineTransformMakeIdentity();
|
||||
|
||||
|
||||
_opacity = 1.0;
|
||||
_isHidden = NO;
|
||||
_masksToBounds = NO;
|
||||
|
||||
|
||||
_sublayers = [];
|
||||
|
||||
|
||||
_DOMElement = document.createElement("div");
|
||||
|
||||
|
||||
_DOMElement.style.overflow = "visible";
|
||||
_DOMElement.style.position = "absolute";
|
||||
_DOMElement.style.visibility = "visible";
|
||||
@@ -165,7 +165,7 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
_DOMElement.style.width = "0px";
|
||||
_DOMElement.style.height = "0px";
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -182,20 +182,20 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
var oldOrigin = _bounds.origin;
|
||||
|
||||
_bounds = _CGRectMakeCopy(aBounds);
|
||||
|
||||
|
||||
if (_hasSublayerTransform)
|
||||
_CALayerUpdateSublayerTransformForSublayers(self);
|
||||
|
||||
|
||||
// _hasSublayerTransform == true will handle this for us.
|
||||
/*else if (!CGPointEqualToPoint(_bounds.origin, oldOrigin))
|
||||
{
|
||||
var index = _sublayers.length;
|
||||
|
||||
|
||||
// FIXME: This should climb the layer tree down.
|
||||
while (index--)
|
||||
_CALayerRecalculateGeometry(_sublayers[index], CALayerGeometryPositionMask);
|
||||
}*/
|
||||
|
||||
|
||||
_CALayerRecalculateGeometry(self, CALayerGeometryBoundsMask);
|
||||
}
|
||||
|
||||
@@ -215,9 +215,9 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
{
|
||||
if (CGPointEqualToPoint(_position, aPosition))
|
||||
return;
|
||||
|
||||
|
||||
_position = _CGPointMakeCopy(aPosition);
|
||||
|
||||
|
||||
_CALayerRecalculateGeometry(self, CALayerGeometryPositionMask);
|
||||
}
|
||||
|
||||
@@ -237,9 +237,9 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
{
|
||||
if (_zPosition == aZPosition)
|
||||
return;
|
||||
|
||||
|
||||
_zPosition = aZPosition;
|
||||
|
||||
|
||||
[self registerRunLoopUpdateWithMask:CALayerZPositionUpdateMask];
|
||||
}
|
||||
|
||||
@@ -252,18 +252,18 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
anAnchorPoint = _CGPointMakeCopy(anAnchorPoint);
|
||||
anAnchorPoint.x = MIN(1.0, MAX(0.0, anAnchorPoint.x));
|
||||
anAnchorPoint.y = MIN(1.0, MAX(0.0, anAnchorPoint.y));
|
||||
|
||||
|
||||
if (CGPointEqualToPoint(_anchorPoint, anAnchorPoint))
|
||||
return;
|
||||
|
||||
|
||||
_anchorPoint = anAnchorPoint;
|
||||
|
||||
|
||||
if (_hasSublayerTransform)
|
||||
_CALayerUpdateSublayerTransformForSublayers(self);
|
||||
|
||||
if (_owningView)
|
||||
_position = CGPointMake(_CGRectGetWidth(_bounds) * _anchorPoint.x, _CGRectGetHeight(_bounds) * _anchorPoint.y);
|
||||
|
||||
|
||||
_CALayerRecalculateGeometry(self, CALayerGeometryAnchorPointMask);
|
||||
}
|
||||
|
||||
@@ -283,9 +283,9 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
{
|
||||
if (CGAffineTransformEqualToTransform(_affineTransform, anAffineTransform))
|
||||
return;
|
||||
|
||||
|
||||
_affineTransform = _CGAffineTransformMakeCopy(anAffineTransform);
|
||||
|
||||
|
||||
_CALayerRecalculateGeometry(self, CALayerGeometryAffineTransformMask);
|
||||
}
|
||||
|
||||
@@ -307,16 +307,16 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
return;
|
||||
|
||||
var hadSublayerTransform = _hasSublayerTransform;
|
||||
|
||||
|
||||
_sublayerTransform = _CGAffineTransformMakeCopy(anAffineTransform);
|
||||
_hasSublayerTransform = !_CGAffineTransformIsIdentity(_sublayerTransform);
|
||||
|
||||
|
||||
if (_hasSublayerTransform)
|
||||
{
|
||||
_CALayerUpdateSublayerTransformForSublayers(self);
|
||||
|
||||
var index = _sublayers.length;
|
||||
|
||||
|
||||
// FIXME: This should climb the layer tree down.
|
||||
while (index--)
|
||||
_CALayerRecalculateGeometry(_sublayers[index], CALayerGeometryParentSublayerTransformMask);
|
||||
@@ -353,23 +353,23 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
/*!
|
||||
Returns the layer's frame.
|
||||
|
||||
The frame defines the bounding box of the layer: the smallest
|
||||
possible rectangle that could fit this layer after transform
|
||||
The frame defines the bounding box of the layer: the smallest
|
||||
possible rectangle that could fit this layer after transform
|
||||
properties are applied in superlayer coordinates.
|
||||
*/
|
||||
- (CGRect)frame
|
||||
{
|
||||
if (!_frame)
|
||||
_frame = [self convertRect:_bounds toLayer:_superlayer];
|
||||
|
||||
|
||||
return _frame;
|
||||
}
|
||||
|
||||
/*!
|
||||
The Backing Store Frame specifies the frame of the actual backing
|
||||
store used to contain this layer. Naturally, by default it is the
|
||||
same as the frame, however, users can specify their own custom
|
||||
Backing Store Frame in order to speed up certain operations, such as
|
||||
store used to contain this layer. Naturally, by default it is the
|
||||
same as the frame, however, users can specify their own custom
|
||||
Backing Store Frame in order to speed up certain operations, such as
|
||||
live transformation.
|
||||
@return the backing store frame
|
||||
*/
|
||||
@@ -385,7 +385,7 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
- (void)setBackingStoreFrame:(CGRect)aFrame
|
||||
{
|
||||
_hasCustomBackingStoreFrame = (aFrame != nil);
|
||||
|
||||
|
||||
if (aFrame == nil)
|
||||
aFrame = CGRectMakeCopy(_standardBackingStoreFrame);
|
||||
else
|
||||
@@ -393,23 +393,23 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
if (_superlayer)
|
||||
{
|
||||
aFrame = [_superlayer convertRect:aFrame toLayer:nil];
|
||||
|
||||
|
||||
var bounds = [_superlayer bounds],
|
||||
frame = [_superlayer convertRect:bounds toLayer:nil];
|
||||
|
||||
|
||||
aFrame.origin.x -= _CGRectGetMinX(frame);
|
||||
aFrame.origin.y -= _CGRectGetMinY(frame);
|
||||
}
|
||||
else
|
||||
aFrame = CGRectMakeCopy(aFrame);
|
||||
}
|
||||
|
||||
|
||||
if (!CGPointEqualToPoint(_backingStoreFrame.origin, aFrame.origin))
|
||||
[self registerRunLoopUpdateWithMask:CALayerFrameOriginUpdateMask];
|
||||
|
||||
|
||||
if (!CGSizeEqualToSize(_backingStoreFrame.size, aFrame.size))
|
||||
[self registerRunLoopUpdateWithMask:CALayerFrameSizeUpdateMask];
|
||||
|
||||
|
||||
_backingStoreFrame = aFrame;
|
||||
}
|
||||
|
||||
@@ -431,9 +431,9 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
{
|
||||
if (_contents == contents)
|
||||
return;
|
||||
|
||||
|
||||
_contents = contents;
|
||||
|
||||
|
||||
[self composite];
|
||||
}
|
||||
|
||||
@@ -445,26 +445,26 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
{
|
||||
if (USE_BUFFER && !_contents || !_context)
|
||||
return;
|
||||
|
||||
|
||||
CGContextClearRect(_context, _CGRectMake(0.0, 0.0, _CGRectGetWidth(_backingStoreFrame), _CGRectGetHeight(_backingStoreFrame)));
|
||||
|
||||
|
||||
// Recomposite
|
||||
var transform = _transformFromLayer;
|
||||
|
||||
|
||||
if (_superlayer)
|
||||
{
|
||||
var superlayerTransform = _CALayerGetTransform(_superlayer, nil),
|
||||
superlayerOrigin = CGPointApplyAffineTransform(_superlayer._bounds.origin, superlayerTransform);
|
||||
|
||||
|
||||
transform = CGAffineTransformConcat(transform, superlayerTransform);
|
||||
|
||||
|
||||
transform.tx -= superlayerOrigin.x;
|
||||
transform.ty -= superlayerOrigin.y;
|
||||
}
|
||||
|
||||
transform.tx -= _CGRectGetMinX(_backingStoreFrame);
|
||||
transform.ty -= _CGRectGetMinY(_backingStoreFrame);
|
||||
|
||||
|
||||
CGContextSaveGState(_context);
|
||||
CGContextConcatCTM(_context, transform);//_transformFromView);
|
||||
if (USE_BUFFER)
|
||||
@@ -485,18 +485,18 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
if (!_context)
|
||||
{
|
||||
_context = CGBitmapGraphicsContextCreate();
|
||||
|
||||
|
||||
_DOMContentsElement = _context.DOMElement;
|
||||
|
||||
|
||||
_DOMContentsElement.style.zIndex = -100;
|
||||
|
||||
_DOMContentsElement.style.overflow = "hidden";
|
||||
_DOMContentsElement.style.position = "absolute";
|
||||
_DOMContentsElement.style.visibility = "visible";
|
||||
|
||||
|
||||
_DOMContentsElement.width = ROUND(_CGRectGetWidth(_backingStoreFrame));
|
||||
_DOMContentsElement.height = ROUND(_CGRectGetHeight(_backingStoreFrame));
|
||||
|
||||
|
||||
_DOMContentsElement.style.top = "0px";
|
||||
_DOMContentsElement.style.left = "0px";
|
||||
_DOMContentsElement.style.width = ROUND(_CGRectGetWidth(_backingStoreFrame)) + "px";
|
||||
@@ -504,23 +504,23 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
|
||||
_DOMElement.appendChild(_DOMContentsElement);
|
||||
}
|
||||
|
||||
|
||||
if (USE_BUFFER)
|
||||
{
|
||||
if (_delegateRespondsToDisplayLayerSelector)
|
||||
return [_delegate displayInLayer:self];
|
||||
|
||||
|
||||
if (_CGRectGetWidth(_backingStoreFrame) == 0.0 || _CGRectGetHeight(_backingStoreFrame) == 0.0)
|
||||
return;
|
||||
|
||||
|
||||
if (!_contents)
|
||||
_contents = CABackingStoreCreate();
|
||||
|
||||
|
||||
CABackingStoreSetSize(_contents, _bounds.size);
|
||||
|
||||
|
||||
[self drawInContext:CABackingStoreGetContext(_contents)];
|
||||
}
|
||||
|
||||
|
||||
[self composite];
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
CGContextSetFillColor(aContext, _backgroundColor);
|
||||
CGContextFillRect(aContext, _bounds);
|
||||
}
|
||||
|
||||
|
||||
if (_delegateRespondsToDrawLayerInContextSelector)
|
||||
[_delegate drawLayer:self inContext:aContext];
|
||||
}
|
||||
@@ -559,9 +559,9 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
{
|
||||
if (_opacity == anOpacity)
|
||||
return;
|
||||
|
||||
|
||||
_opacity = anOpacity;
|
||||
|
||||
|
||||
_DOMElement.style.opacity = anOpacity;
|
||||
_DOMElement.style.filter = "alpha(opacity=" + anOpacity * 100 + ")";
|
||||
}
|
||||
@@ -600,7 +600,7 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
{
|
||||
if (_masksToBounds == masksToBounds)
|
||||
return;
|
||||
|
||||
|
||||
_masksToBounds = masksToBounds;
|
||||
_DOMElement.style.overflow = _masksToBounds ? "hidden" : "visible";
|
||||
}
|
||||
@@ -612,7 +612,7 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
- (void)setBackgroundColor:(CPColor)aColor
|
||||
{
|
||||
_backgroundColor = aColor;
|
||||
|
||||
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
@@ -665,10 +665,10 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
|
||||
{
|
||||
if (_owningView)
|
||||
[_owningView setLayer:nil];
|
||||
|
||||
|
||||
if (!_superlayer)
|
||||
return;
|
||||
|
||||
|
||||
_superlayer._DOMElement.removeChild(_DOMElement);
|
||||
[_superlayer._sublayers removeObject:self];
|
||||
|
||||
@@ -684,24 +684,24 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
|
||||
{
|
||||
if (!aLayer)
|
||||
return;
|
||||
|
||||
|
||||
var superlayer = [aLayer superlayer];
|
||||
|
||||
|
||||
if (superlayer == self)
|
||||
{
|
||||
var index = [_sublayers indexOfObjectIdenticalTo:aLayer];
|
||||
|
||||
if (index == anIndex)
|
||||
return;
|
||||
|
||||
|
||||
[_sublayers removeObjectAtIndex:index];
|
||||
|
||||
|
||||
if (index < anIndex)
|
||||
--anIndex;
|
||||
}
|
||||
else if (superlayer != nil)
|
||||
[aLayer removeFromSuperlayer];
|
||||
|
||||
|
||||
ADJUST_CONTENTS_ZINDEX(aLayer);
|
||||
|
||||
[_sublayers insertObject:aLayer atIndex:anIndex];
|
||||
@@ -710,9 +710,9 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
|
||||
_DOMElement.appendChild(DOM(aLayer));
|
||||
else
|
||||
_DOMElement.insertBefore(DOM(aLayer), _sublayers[anIndex + 1]._DOMElement);
|
||||
|
||||
|
||||
aLayer._superlayer = self;
|
||||
|
||||
|
||||
if (self != superlayer)
|
||||
_CALayerRecalculateGeometry(aLayer, 0xFFFFFFF);
|
||||
}
|
||||
@@ -726,7 +726,7 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
|
||||
- (void)insertSublayer:(CALayer)aLayer below:(CALayer)aSublayer
|
||||
{
|
||||
var index = aSublayer ? [_sublayers indexOfObjectIdenticalTo:aSublayer] : 0;
|
||||
|
||||
|
||||
[self insertSublayer:aLayer atIndex:index == CPNotFound ? _sublayers.length : index];
|
||||
}
|
||||
|
||||
@@ -754,16 +754,16 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
|
||||
{
|
||||
if (aSublayer == aLayer)
|
||||
return;
|
||||
|
||||
|
||||
// FIXME: EXCEPTION
|
||||
if (aSublayer._superlayer != self)
|
||||
{
|
||||
alert("EXCEPTION");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ADJUST_CONTENTS_ZINDEX(aLayer);
|
||||
|
||||
|
||||
[_sublayers replaceObjectAtIndex:[_sublayers indexOfObjectIdenticalTo:aSublayer] withObject:aLayer];
|
||||
_DOMElement.replaceChild(DOM(aSublayer), DOM(aLayer));
|
||||
}
|
||||
@@ -782,13 +782,13 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
|
||||
|
||||
if (mask & CALayerDOMUpdateMask)
|
||||
_CALayerUpdateDOM(layer, mask);
|
||||
|
||||
|
||||
if (mask & CALayerDisplayUpdateMask)
|
||||
[layer display];
|
||||
|
||||
|
||||
else if (mask & CALayerFrameSizeUpdateMask || mask & CALayerCompositeUpdateMask)
|
||||
[layer composite];
|
||||
|
||||
|
||||
layer._runLoopUpdateMask = 0;
|
||||
}
|
||||
window.loop= false;
|
||||
@@ -803,11 +803,11 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
|
||||
if (CALayerRegisteredRunLoopUpdates == nil)
|
||||
{
|
||||
CALayerRegisteredRunLoopUpdates = {};
|
||||
|
||||
|
||||
[[CPRunLoop currentRunLoop] performSelector:@selector(runLoopUpdateLayers)
|
||||
target:CALayer argument:nil order:0 modes:[CPDefaultRunLoopMode]];
|
||||
}
|
||||
|
||||
|
||||
_runLoopUpdateMask |= anUpdateMask;
|
||||
CALayerRegisteredRunLoopUpdates[[self UID]] = self;
|
||||
}
|
||||
@@ -846,7 +846,7 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
|
||||
}
|
||||
|
||||
/*!
|
||||
Marks the specified rectange as needing to be redrawn.
|
||||
Marks the specified rectangle as needing to be redrawn.
|
||||
@param aRect the area that needs to be redrawn.
|
||||
*/
|
||||
- (void)setNeedsDisplayInRect:(CGRect)aRect
|
||||
@@ -890,8 +890,8 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
|
||||
}
|
||||
|
||||
/*!
|
||||
Converts the rectangle from the receier's coordinate system to the specified layer's coordinate system.
|
||||
@param aRect the rectange to convert
|
||||
Converts the rectangle from the receiver's coordinate system to the specified layer's coordinate system.
|
||||
@param aRect the rectangle to convert
|
||||
@param aLayer the layer coordinate system to convert to
|
||||
@return the converted rectangle
|
||||
*/
|
||||
@@ -919,21 +919,21 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
|
||||
{
|
||||
if (_isHidden)
|
||||
return nil;
|
||||
|
||||
|
||||
var point = CGPointApplyAffineTransform(aPoint, _transformToLayer);
|
||||
//alert(point.x + " " + point.y);
|
||||
|
||||
|
||||
if (!_CGRectContainsPoint(_bounds, point))
|
||||
return nil;
|
||||
|
||||
|
||||
var layer = nil,
|
||||
index = _sublayers.length;
|
||||
|
||||
|
||||
// FIXME: this should take into account zPosition.
|
||||
while (index--)
|
||||
if (layer = [_sublayers[index] hitTest:point])
|
||||
return layer;
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -946,12 +946,12 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
|
||||
{
|
||||
if (_delegate == aDelegate)
|
||||
return;
|
||||
|
||||
|
||||
_delegate = aDelegate;
|
||||
|
||||
|
||||
_delegateRespondsToDisplayLayerSelector = [_delegate respondsToSelector:@selector(displayLayer:)];
|
||||
_delegateRespondsToDrawLayerInContextSelector = [_delegate respondsToSelector:@selector(drawLayer:inContext:)];
|
||||
|
||||
|
||||
if (_delegateRespondsToDisplayLayerSelector || _delegateRespondsToDrawLayerInContextSelector)
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
@@ -968,15 +968,15 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
|
||||
- (void)_setOwningView:(CPView)anOwningView
|
||||
{
|
||||
_owningView = anOwningView;
|
||||
|
||||
|
||||
if (_owningView)
|
||||
{
|
||||
_owningView = anOwningView;
|
||||
|
||||
|
||||
_bounds.size = CGSizeMakeCopy([_owningView bounds].size);
|
||||
_position = CGPointMake(_CGRectGetWidth(_bounds) * _anchorPoint.x, _CGRectGetHeight(_bounds) * _anchorPoint.y);
|
||||
}
|
||||
|
||||
|
||||
_CALayerRecalculateGeometry(self, CALayerGeometryPositionMask | CALayerGeometryBoundsMask);
|
||||
}
|
||||
|
||||
@@ -985,7 +985,7 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
|
||||
{
|
||||
_bounds.size = CGSizeMakeCopy([_owningView bounds].size);
|
||||
_position = CGPointMake(_CGRectGetWidth(_bounds) * _anchorPoint.x, _CGRectGetHeight(_bounds) * _anchorPoint.y);
|
||||
|
||||
|
||||
_CALayerRecalculateGeometry(self, CALayerGeometryPositionMask | CALayerGeometryBoundsMask);
|
||||
}
|
||||
|
||||
@@ -993,20 +993,20 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
|
||||
- (void)_update
|
||||
{
|
||||
window.loop = true;
|
||||
|
||||
|
||||
var mask = _runLoopUpdateMask;
|
||||
|
||||
if (mask & CALayerDOMUpdateMask)
|
||||
_CALayerUpdateDOM(self, mask);
|
||||
|
||||
|
||||
if (mask & CALayerDisplayUpdateMask)
|
||||
[self display];
|
||||
|
||||
|
||||
else if (mask & CALayerFrameSizeUpdateMask || mask & CALayerCompositeUpdateMask)
|
||||
[self composite];
|
||||
|
||||
|
||||
_runLoopUpdateMask = 0;
|
||||
|
||||
|
||||
window.loop = false;
|
||||
}
|
||||
|
||||
@@ -1018,7 +1018,7 @@ function _CALayerUpdateSublayerTransformForSublayers(aLayer)
|
||||
anchorPoint = aLayer._anchorPoint,
|
||||
translateX = _CGRectGetWidth(bounds) * anchorPoint.x,
|
||||
translateY = _CGRectGetHeight(bounds) * anchorPoint.y;
|
||||
|
||||
|
||||
aLayer._sublayerTransformForSublayers = CGAffineTransformConcat(
|
||||
CGAffineTransformMakeTranslation(-translateX, -translateY),
|
||||
CGAffineTransformConcat(aLayer._sublayerTransform,
|
||||
@@ -1028,27 +1028,27 @@ function _CALayerUpdateSublayerTransformForSublayers(aLayer)
|
||||
function _CALayerUpdateDOM(aLayer, aMask)
|
||||
{
|
||||
var DOMElementStyle = aLayer._DOMElement.style;
|
||||
|
||||
|
||||
if (aMask & CALayerZPositionUpdateMask)
|
||||
DOMElementStyle.zIndex = aLayer._zPosition;
|
||||
|
||||
|
||||
var frame = aLayer._backingStoreFrame;
|
||||
|
||||
|
||||
if (aMask & CALayerFrameOriginUpdateMask)
|
||||
{
|
||||
DOMElementStyle.top = ROUND(_CGRectGetMinY(frame)) + "px";
|
||||
DOMElementStyle.left = ROUND(_CGRectGetMinX(frame)) + "px";
|
||||
}
|
||||
|
||||
|
||||
if (aMask & CALayerFrameSizeUpdateMask)
|
||||
{
|
||||
var width = MAX(0.0, ROUND(_CGRectGetWidth(frame))),
|
||||
height = MAX(0.0, ROUND(_CGRectGetHeight(frame))),
|
||||
DOMContentsElement = aLayer._DOMContentsElement;
|
||||
|
||||
|
||||
DOMElementStyle.width = width + "px";
|
||||
DOMElementStyle.height = height + "px";
|
||||
|
||||
|
||||
if (DOMContentsElement)
|
||||
{
|
||||
DOMContentsElement.width = width;
|
||||
@@ -1070,7 +1070,7 @@ function _CALayerRecalculateGeometry(aLayer, aGeometryChange)
|
||||
affineTransform = aLayer._affineTransform,
|
||||
backingStoreFrameSize = _CGSizeMakeCopy(aLayer._backingStoreFrame),
|
||||
hasCustomBackingStoreFrame = aLayer._hasCustomBackingStoreFrame;
|
||||
|
||||
|
||||
// Go to anchor, transform, go back to bounds.
|
||||
aLayer._transformFromLayer = CGAffineTransformConcat(
|
||||
CGAffineTransformMakeTranslation(-width * anchorPoint.x - _CGRectGetMinX(aLayer._bounds), -height * anchorPoint.y - _CGRectGetMinY(aLayer._bounds)),
|
||||
@@ -1082,68 +1082,68 @@ function _CALayerRecalculateGeometry(aLayer, aGeometryChange)
|
||||
// aLayer._transformFromLayer = CGAffineTransformConcat(aLayer._transformFromLayer, superlayer._sublayerTransformForSublayers);
|
||||
_CGAffineTransformConcatTo(aLayer._transformFromLayer, superlayer._sublayerTransformForSublayers, aLayer._transformFromLayer);
|
||||
}
|
||||
|
||||
|
||||
aLayer._transformToLayer = CGAffineTransformInvert(aLayer._transformFromLayer);
|
||||
|
||||
//aLayer._transformFromLayer.tx = ROUND(aLayer._transformFromLayer.tx);
|
||||
//aLayer._transformFromLayer.ty = ROUND(aLayer._transformFromLayer.ty);
|
||||
|
||||
|
||||
aLayer._frame = nil;
|
||||
aLayer._standardBackingStoreFrame = [aLayer convertRect:bounds toLayer:nil];
|
||||
|
||||
|
||||
if (superlayer)
|
||||
{
|
||||
var bounds = [superlayer bounds],
|
||||
frame = [superlayer convertRect:bounds toLayer:nil];
|
||||
|
||||
|
||||
aLayer._standardBackingStoreFrame.origin.x -= _CGRectGetMinX(frame);
|
||||
aLayer._standardBackingStoreFrame.origin.y -= _CGRectGetMinY(frame);
|
||||
}
|
||||
|
||||
// We used to use CGRectIntegral here, but what we actually want, is the largest integral
|
||||
// rect that would ever contain this box, since for any width/height, there are 2 (4)
|
||||
// rect that would ever contain this box, since for any width/height, there are 2 (4)
|
||||
// possible integral rects for it depending on it's position. It's OK that this is sometimes
|
||||
// bigger than the "optimal" bounding integral rect since that doesn't change drawing.
|
||||
|
||||
|
||||
var origin = aLayer._standardBackingStoreFrame.origin,
|
||||
size = aLayer._standardBackingStoreFrame.size;
|
||||
|
||||
|
||||
origin.x = FLOOR(origin.x);
|
||||
origin.y = FLOOR(origin.y);
|
||||
size.width = CEIL(size.width) + 1.0;
|
||||
size.height = CEIL(size.height) + 1.0;
|
||||
|
||||
|
||||
// FIXME: This avoids the central issue that a position change is sometimes a display and sometimes
|
||||
// a div move, and sometimes both.
|
||||
|
||||
|
||||
// Only use this frame if we don't currently have a custom backing store frame.
|
||||
if (!hasCustomBackingStoreFrame)
|
||||
{
|
||||
var backingStoreFrame = CGRectMakeCopy(aLayer._standardBackingStoreFrame);
|
||||
|
||||
// These values get rounded in the DOM, so don't both updating them if they're
|
||||
|
||||
// These values get rounded in the DOM, so don't both updating them if they're
|
||||
// not going to be different after rounding.
|
||||
if (ROUND(_CGRectGetMinX(backingStoreFrame)) != ROUND(_CGRectGetMinX(aLayer._backingStoreFrame)) ||
|
||||
ROUND(_CGRectGetMinY(backingStoreFrame)) != ROUND(_CGRectGetMinY(aLayer._backingStoreFrame)))
|
||||
[aLayer registerRunLoopUpdateWithMask:CALayerFrameOriginUpdateMask];
|
||||
|
||||
|
||||
// Any change in size due to a geometry change is purely due to rounding error.
|
||||
if ((_CGRectGetWidth(backingStoreFrame) != ROUND(_CGRectGetWidth(aLayer._backingStoreFrame)) ||
|
||||
_CGRectGetHeight(backingStoreFrame) != ROUND(_CGRectGetHeight(aLayer._backingStoreFrame))))
|
||||
[aLayer registerRunLoopUpdateWithMask:CALayerFrameSizeUpdateMask];
|
||||
|
||||
|
||||
aLayer._backingStoreFrame = backingStoreFrame;
|
||||
}
|
||||
|
||||
if (aGeometryChange & CALayerGeometryBoundsMask && aLayer._needsDisplayOnBoundsChange)
|
||||
[aLayer setNeedsDisplay];
|
||||
// We need to recomposite if we have a custom backing store frame, OR
|
||||
// We need to recompose if we have a custom backing store frame, OR
|
||||
// If the change is not solely composed of position and anchor points changes.
|
||||
// Anchor point and position changes simply move the object, requiring
|
||||
// Anchor point and position changes simply move the object, requiring
|
||||
// no re-rendering.
|
||||
else if (hasCustomBackingStoreFrame || (aGeometryChange & ~(CALayerGeometryPositionMask | CALayerGeometryAnchorPointMask)))
|
||||
[aLayer setNeedsComposite];
|
||||
|
||||
|
||||
var sublayers = aLayer._sublayers,
|
||||
index = 0,
|
||||
count = sublayers.length;
|
||||
@@ -1155,45 +1155,45 @@ function _CALayerRecalculateGeometry(aLayer, aGeometryChange)
|
||||
function _CALayerGetTransform(fromLayer, toLayer)
|
||||
{
|
||||
var transform = CGAffineTransformMakeIdentity();
|
||||
|
||||
|
||||
if (fromLayer)
|
||||
{
|
||||
var layer = fromLayer;
|
||||
|
||||
// If we have a fromLayer, "climb up" the layer tree until
|
||||
|
||||
// If we have a fromLayer, "climb up" the layer tree until
|
||||
// we hit the root node or we hit the toLayer.
|
||||
while (layer && layer != toLayer)
|
||||
{
|
||||
var transformFromLayer = layer._transformFromLayer;
|
||||
|
||||
|
||||
//transform = CGAffineTransformConcat(transform, layer._transformFromLayer);
|
||||
_CGAffineTransformConcatTo(transform, transformFromLayer, transform);
|
||||
|
||||
|
||||
layer = layer._superlayer;
|
||||
}
|
||||
|
||||
|
||||
// If we hit toLayer, then we're done.
|
||||
if (layer == toLayer)
|
||||
return transform;
|
||||
}
|
||||
|
||||
|
||||
var layers = [],
|
||||
layer = toLayer;
|
||||
|
||||
|
||||
while (layer)
|
||||
{
|
||||
layers.push(layer);
|
||||
layer = layer._superlayer;
|
||||
}
|
||||
|
||||
|
||||
var index = layers.length;
|
||||
|
||||
|
||||
while (index--)
|
||||
{
|
||||
var transformToLayer = layers[index]._transformToLayer;
|
||||
|
||||
|
||||
_CGAffineTransformConcatTo(transform, transformToLayer, transform);
|
||||
}
|
||||
|
||||
|
||||
return transform;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ function CGColorGetConstantColor(aColorName)
|
||||
}
|
||||
|
||||
/*!
|
||||
This function is for source compatability.
|
||||
This function is for source compatibility.
|
||||
*/
|
||||
function CGColorRetain(aColor)
|
||||
{
|
||||
@@ -55,7 +55,7 @@ function CGColorRetain(aColor)
|
||||
}
|
||||
|
||||
/*!
|
||||
This function is for source compatability.
|
||||
This function is for source compatibility.
|
||||
*/
|
||||
function CGColorRelease()
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@ kCGBlendModePlusLighter = 27;
|
||||
*/
|
||||
|
||||
/*!
|
||||
This function is just here for source compatability.
|
||||
This function is just here for source compatibility.
|
||||
It does nothing.
|
||||
@group CGContext
|
||||
*/
|
||||
@@ -88,7 +88,7 @@ function CGContextRelease()
|
||||
}
|
||||
|
||||
/*!
|
||||
This function is just here for source compatability.
|
||||
This function is just here for source compatibility.
|
||||
It does nothing.
|
||||
@param aContext a CGContext
|
||||
@return CGContext the context
|
||||
@@ -466,7 +466,7 @@ function CGContextTranslateCTM(aContext, tx, ty)
|
||||
/*!
|
||||
Sets the current offset, and blur for shadows in core graphics drawing operations
|
||||
@param aContext the CGContext of the shadow
|
||||
@param aSize a CGSize indicating the offset of the shaodw
|
||||
@param aSize a CGSize indicating the offset of the shadow
|
||||
@param aBlur a float indicating the blur radius
|
||||
@return void
|
||||
*/
|
||||
@@ -483,7 +483,7 @@ function CGContextSetShadow(aContext, aSize, aBlur)
|
||||
/*!
|
||||
Sets the current offset, blur, and color for shadows in core graphics drawing operations
|
||||
@param aContext the CGContext of the shadow
|
||||
@param aSize a CGSize indicating the offset of the shaodw
|
||||
@param aSize a CGSize indicating the offset of the shadow
|
||||
@param aBlur a float indicating the blur radius
|
||||
@param aColor a CPColor object indicating the color of the shadow
|
||||
@return void
|
||||
@@ -652,7 +652,7 @@ function CGContextSetStrokeColor(aContext, aColor)
|
||||
Fills a rounded rectangle.
|
||||
@param aContext the CGContext to draw into
|
||||
@param aRect the base rectangle
|
||||
@param aRadius the distance from the rectange corner to the rounded corner
|
||||
@param aRadius the distance from the rectangle corner to the rounded corner
|
||||
@param ne set it to \c YES for a rounded northeast corner
|
||||
@param se set it to \c YES for a rounded southeast corner
|
||||
@param sw set it to \c YES for a rounded southwest corner
|
||||
@@ -671,7 +671,7 @@ function CGContextFillRoundedRectangleInRect(aContext, aRect, aRadius, ne, se, s
|
||||
Strokes a rounded rectangle.
|
||||
@param aContext the CGContext to draw into
|
||||
@param aRect the base rectangle
|
||||
@param aRadius the distance from the rectange corner to the rounded corner
|
||||
@param aRadius the distance from the rectangle corner to the rounded corner
|
||||
@param ne set it to \c YES for a rounded northeast corner
|
||||
@param se set it to \c YES for a rounded southeast corner
|
||||
@param sw set it to \c YES for a rounded southwest corner
|
||||
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 227 B |
Binary file not shown.
|
Before Width: | Height: | Size: 307 B |
Binary file not shown.
|
Before Width: | Height: | Size: 4.0 KiB |
@@ -822,8 +822,12 @@ var themedButtonValues = nil,
|
||||
[@"content-inset", CGInsetMake(0.0, 0.0, 0.0, 5.0), CPThemeStateTableDataView],
|
||||
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:51.0 / 255.0 alpha:1.0], CPThemeStateTableDataView],
|
||||
[@"text-color", [CPColor whiteColor], CPThemeStateTableDataView | CPThemeStateSelectedTableDataView],
|
||||
[@"font", [CPFont boldSystemFontOfSize:12.0], CPThemeStateTableDataView | CPThemeStateSelectedTableDataView],
|
||||
[@"text-color", [CPColor whiteColor], CPThemeStateTableDataView | CPThemeStateSelectedTableDataView],
|
||||
[@"font", [CPFont boldSystemFontOfSize:12.0], CPThemeStateTableDataView | CPThemeStateSelectedTableDataView],
|
||||
[@"text-color", [CPColor blackColor], CPThemeStateTableDataView | CPThemeStateEditing],
|
||||
[@"content-inset", CGInsetMake(7.0, 7.0, 5.0, 8.0), CPThemeStateTableDataView | CPThemeStateEditing],
|
||||
[@"font", [CPFont systemFontOfSize:12.0], CPThemeStateTableDataView | CPThemeStateEditing],
|
||||
[@"bezel-inset", CGInsetMake(-2.0, -2.0, -2.0, -2.0), CPThemeStateTableDataView | CPThemeStateEditing],
|
||||
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:125.0 / 255.0 alpha:1.0], CPThemeStateTableDataView | CPThemeStateGroupRow],
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:1.0 alpha:1.0], CPThemeStateTableDataView | CPThemeStateGroupRow | CPThemeStateSelectedTableDataView],
|
||||
|
||||
@@ -559,7 +559,7 @@ var concat = Array.prototype.concat,
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns true if anArray contains exactly the same objects as the reciever.
|
||||
Returns true if anArray contains exactly the same objects as the receiver.
|
||||
*/
|
||||
- (BOOL)isEqualToArray:(id)anArray
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
@brief A mutable character string with attributes.
|
||||
|
||||
A character string with sets of attributes that apply to single or ranges of
|
||||
characters. The attributes are containted within a CPDictionary class.
|
||||
characters. The attributes are contained within a CPDictionary class.
|
||||
Attributes can be any name/value pair. The data type of the value is not
|
||||
restricted.
|
||||
This class is mutable.
|
||||
@@ -795,11 +795,11 @@
|
||||
|
||||
/*!
|
||||
@class CPMutableAttributedString
|
||||
@ingroup compatability
|
||||
@ingroup compatibility
|
||||
|
||||
This class is just an empty subclass of CPAttributedString.
|
||||
CPAttributedString already implements mutable methods and
|
||||
this class only exists for source compatability.
|
||||
this class only exists for source compatibility.
|
||||
*/
|
||||
@implementation CPMutableAttributedString : CPAttributedString
|
||||
|
||||
|
||||
@@ -231,6 +231,7 @@ var _builtInCharacterSets = {};
|
||||
|
||||
- (BOOL)hasMemberInPlane:(int)plane // TO DO : when inverted
|
||||
{
|
||||
// FIXME: range is undefined... don't know what's supposed to be going on here.
|
||||
// the highest Unicode plane we reach.
|
||||
// (There are 65536 code points in each plane.)
|
||||
var maxPlane = Math.floor((range.start + range.length - 1) / 65536); // FIXME: should iterate _ranges
|
||||
@@ -349,13 +350,13 @@ _CPCharacterSetTrimAtEnd = 1 << 2;
|
||||
@implementation CPString (CPCharacterSetAdditions)
|
||||
|
||||
/*!
|
||||
Tokenizes the receiver string using the charactes
|
||||
Tokenizes the receiver string using the characters
|
||||
in a given set. For example, if the receiver is:
|
||||
\c "Baku baku to jest skład."
|
||||
and the set is [CPCharacterSet whitespaceCharacterSet]
|
||||
the returned array would contain:
|
||||
<pre> ["Baku", "baku", "to", "jest", "", "skład."] </pre>
|
||||
Adjacent occurences of the separator characters produce empty strings in the result.
|
||||
Adjacent occurrences of the separator characters produce empty strings in the result.
|
||||
@author Arkadiusz Młynarczyk <arek@tupux.com>
|
||||
@param A character set containing the characters to use to split the receiver. Must not be nil.
|
||||
@return An CPArray object containing substrings from the receiver that have been divided by characters in separator.
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
|
||||
/*!
|
||||
Called after an object is unarchived in case a different object should be used in place of it.
|
||||
The defaut method returns \c self. Interested subclasses should override this.
|
||||
The default method returns \c self. Interested subclasses should override this.
|
||||
@param aDecoder
|
||||
@return the original object or it's substitute.
|
||||
*/
|
||||
|
||||
+14
-14
@@ -112,8 +112,8 @@ function CPDecimalMakeWithString(string, locale)
|
||||
// (?:[eE]([+\-]?)(\d+))? - optional exponent part plus number in group
|
||||
// group 0: string, 1: sign, 2: integer, 3: decimal, 4: exponent sign, 5: exponent
|
||||
|
||||
// Note: this doesnt accept .01 for example, should it?
|
||||
// If yes simply add '?' after integer part group, ie ([+\-]?)((?:0|[1-9]\d*)?)
|
||||
// Note: this doesn't accept .01 for example, should it?
|
||||
// If yes simply add '?' after integer part group, i.e. ([+\-]?)((?:0|[1-9]\d*)?)
|
||||
var matches = string.match(/^([+\-]?)((?:0|[1-9]\d*))(?:\.(\d*))?(?:[eE]([+\-]?)(\d+))?$/);
|
||||
if (!matches)
|
||||
return CPDecimalMakeNaN();
|
||||
@@ -170,7 +170,7 @@ function CPDecimalMakeWithString(string, locale)
|
||||
|
||||
/*!
|
||||
@ingroup foundation
|
||||
Creates a CPDecimal object from a given matissa and exponent. The sign is taken from the sign of the mantissa. This cant do a full 34 digit mantissa representation as JS's 32 bits or 64bit binary FP numbers cant represent that. So use the CPDecimalMakeWithString if you want longer mantissa.
|
||||
Creates a CPDecimal object from a given mantissa and exponent. The sign is taken from the sign of the mantissa. This cant do a full 34 digit mantissa representation as JS's 32 bits or 64bit binary FP numbers cant represent that. So use the CPDecimalMakeWithString if you want longer mantissa.
|
||||
@param mantissa the mantissa (though see above note)
|
||||
@param exponent the exponent
|
||||
@return A CPDecimal object, or nil on error.
|
||||
@@ -267,7 +267,7 @@ function _CPDecimalMakeMinimum()
|
||||
*/
|
||||
function CPDecimalIsZero(dcm)
|
||||
{
|
||||
// exponent doesnt matter as long as mantissa = 0
|
||||
// exponent doesn't matter as long as mantissa = 0
|
||||
if (!dcm._isNaN)
|
||||
{
|
||||
for (var i = 0; i < dcm._mantissa.length; i++)
|
||||
@@ -288,7 +288,7 @@ function CPDecimalIsZero(dcm)
|
||||
function CPDecimalIsOne(dcm)
|
||||
{
|
||||
CPDecimalCompact(dcm);
|
||||
// exponent doesnt matter as long as mantissa = 0
|
||||
// exponent doesn't matter as long as mantissa = 0
|
||||
if (!dcm._isNaN)
|
||||
{
|
||||
if (dcm._mantissa && (dcm._mantissa.length == 1) && (dcm._mantissa[0] == 1))
|
||||
@@ -354,7 +354,7 @@ function CPDecimalCopy(dcm)
|
||||
|
||||
/*!
|
||||
@ingroup foundation
|
||||
Compare two CPDecimal objects. Order is left to right (ie Ascending would
|
||||
Compare two CPDecimal objects. Order is left to right (i.e. Ascending would
|
||||
mean left is smaller than right operand).
|
||||
@param leftOperand the left CPDecimal
|
||||
@param rightOperand the right CPDecimal
|
||||
@@ -548,7 +548,7 @@ function CPDecimalAdd(result, leftOperand, rightOperand, roundingMode, longMode)
|
||||
|
||||
var normerror = CPDecimalNormalize(n1, n2, roundingMode, longMode);
|
||||
|
||||
// below is equiv of simple compare
|
||||
// below is equiv. of simple compare
|
||||
var comp = 0,
|
||||
ll = n1._mantissa.length,
|
||||
lr = n2._mantissa.length;
|
||||
@@ -804,8 +804,8 @@ function _SimpleDivide(result, leftOperand, rightOperand, roundingMode)
|
||||
// Zeros must be added while enough digits are fetched to do the
|
||||
// subtraction, but first time round this just add zeros at the
|
||||
// start of the number , increases k, and hence reduces
|
||||
// the avaialble precision. To solve this only inc k/add zeros if
|
||||
// this isnt first time round.
|
||||
// the available precision. To solve this only inc k/add zeros if
|
||||
// this isn't first time round.
|
||||
if (!firsttime)
|
||||
{
|
||||
k++;
|
||||
@@ -910,7 +910,7 @@ function CPDecimalDivide(result, leftOperand, rightOperand, roundingMode)
|
||||
return error;
|
||||
}
|
||||
|
||||
// Simple multiply O(n^2) , replace with something faster, likee divide-n-conquer algo?
|
||||
// Simple multiply O(n^2) , replace with something faster, like divide-n-conquer algo?
|
||||
function _SimpleMultiply(result, leftOperand, rightOperand, roundingMode, powerMode)
|
||||
{
|
||||
var error = CPCalculationNoError,
|
||||
@@ -1025,7 +1025,7 @@ function CPDecimalMultiply(result, leftOperand, rightOperand, roundingMode, powe
|
||||
n1._isNegative = NO;
|
||||
n2._isNegative = NO;
|
||||
|
||||
// below is equiv of simple compare
|
||||
// below is equiv. of simple compare
|
||||
var comp = 0,
|
||||
ll = n1._mantissa.length,
|
||||
lr = n2._mantissa.length;
|
||||
@@ -1157,7 +1157,7 @@ function CPDecimalPower(result, dcm, power, roundingMode)
|
||||
/*!
|
||||
@ingroup foundation
|
||||
Normalises 2 CPDecimals. Normalisation is the process of modifying a
|
||||
numbers manitssa to ensure that both CPDecimals have the same exponent.
|
||||
numbers mantissa to ensure that both CPDecimals have the same exponent.
|
||||
@param dcm1 the first CPDecimal
|
||||
@param dcm2 the second CPDecimal
|
||||
@param roundingMode the rounding mode for the operation
|
||||
@@ -1403,7 +1403,7 @@ function CPDecimalCompact(dcm)
|
||||
return;
|
||||
}
|
||||
// leading zeros, when exponent is zero these mean we need to move our decimal point to compact
|
||||
// if exp is zero does it make sense to have them? dont think so so delete them
|
||||
// if exp is zero does it make sense to have them? don't think so so delete them
|
||||
while (dcm._mantissa[0] === 0)
|
||||
{
|
||||
Array.prototype.shift.call(dcm._mantissa);
|
||||
@@ -1416,7 +1416,7 @@ function CPDecimalCompact(dcm)
|
||||
if (dcm._exponent + 1 > CPDecimalMaxExponent)
|
||||
{
|
||||
// TODO: test case for this
|
||||
// overflow if we compact anymore, so dont
|
||||
// overflow if we compact anymore, so don't
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ var CPDefaultDcmHandler = nil;
|
||||
CPDecimalNumberHandler this will throw exceptions accordingly with
|
||||
formatted error messages.
|
||||
@param operation the selector of the method of the operation being
|
||||
performed when the exception occured
|
||||
performed when the exception occurred
|
||||
@param error the actual error type. From the \e
|
||||
CPCalculationError enum: CPCalculationNoError,
|
||||
CPCalculationLossOfPrecision, CPCalculationOverflow,
|
||||
@@ -165,7 +165,7 @@ var CPDefaultDcmHandler = nil;
|
||||
calculation that caused the exception
|
||||
@param rightOperand the CPDecimalNumber right-hand side operand used in the
|
||||
calculation that caused the exception
|
||||
@return if appropriate a CPDecimalNumber is returned (either the maxumum,
|
||||
@return if appropriate a CPDecimalNumber is returned (either the maximum,
|
||||
minimum or NaN values), or nil
|
||||
*/
|
||||
- (CPDecimalNumber)exceptionDuringOperation:(SEL)operation error:(CPCalculationError)error leftOperand:(CPDecimalNumber)leftOperand rightOperand:(CPDecimalNumber)rightOperand
|
||||
@@ -174,12 +174,12 @@ var CPDefaultDcmHandler = nil;
|
||||
{
|
||||
case CPCalculationNoError: break;
|
||||
case CPCalculationOverflow: if (_raiseOnOverflow)
|
||||
[CPException raise:CPDecimalNumberOverflowException reason:("A CPDecimalNumber overflow has occured. (Left operand= '" + [leftOperand descriptionWithLocale:nil] + "' Right operand= '" + [rightOperand descriptionWithLocale:nil] + "' Selector= '" + operation + "')") ];
|
||||
[CPException raise:CPDecimalNumberOverflowException reason:("A CPDecimalNumber overflow has occurred. (Left operand= '" + [leftOperand descriptionWithLocale:nil] + "' Right operand= '" + [rightOperand descriptionWithLocale:nil] + "' Selector= '" + operation + "')") ];
|
||||
else
|
||||
return [CPDecimalNumber notANumber];
|
||||
break;
|
||||
case CPCalculationUnderflow: if (_raiseOnUnderflow)
|
||||
[CPException raise:CPDecimalNumberUnderflowException reason:("A CPDecimalNumber underflow has occured. (Left operand= '" + [leftOperand descriptionWithLocale:nil] + "' Right operand= '" + [rightOperand descriptionWithLocale:nil] + "' Selector= '" + operation + "')") ];
|
||||
[CPException raise:CPDecimalNumberUnderflowException reason:("A CPDecimalNumber underflow has occurred. (Left operand= '" + [leftOperand descriptionWithLocale:nil] + "' Right operand= '" + [rightOperand descriptionWithLocale:nil] + "' Selector= '" + operation + "')") ];
|
||||
else
|
||||
return [CPDecimalNumber notANumber];
|
||||
break;
|
||||
@@ -187,11 +187,11 @@ var CPDefaultDcmHandler = nil;
|
||||
[CPException raise:CPDecimalNumberExactnessException reason:("A CPDecimalNumber has been rounded off during a calculation. (Left operand= '" + [leftOperand descriptionWithLocale:nil] + "' Right operand= '" + [rightOperand descriptionWithLocale:nil] + "' Selector= '" + operation + "')") ];
|
||||
break;
|
||||
case CPCalculationDivideByZero: if (_raiseOnDivideByZero)
|
||||
[CPException raise:CPDecimalNumberDivideByZeroException reason:("A CPDecimalNumber divide by zero has occured. (Left operand= '" + [leftOperand descriptionWithLocale:nil] + "' Right operand= '" + [rightOperand descriptionWithLocale:nil] + "' Selector= '" + operation + "')") ];
|
||||
[CPException raise:CPDecimalNumberDivideByZeroException reason:("A CPDecimalNumber divide by zero has occurred. (Left operand= '" + [leftOperand descriptionWithLocale:nil] + "' Right operand= '" + [rightOperand descriptionWithLocale:nil] + "' Selector= '" + operation + "')") ];
|
||||
else
|
||||
return [CPDecimalNumber notANumber]; // Div by zero returns NaN
|
||||
break;
|
||||
default: [CPException raise:CPInvalidArgumentException reason:("An unknown CPDecimalNumber error has occured. (Left operand= '" + [leftOperand descriptionWithLocale:nil] + "' Right operand= '" + [rightOperand descriptionWithLocale:nil] + "' Selector= '" + operation + "')") ];
|
||||
default: [CPException raise:CPInvalidArgumentException reason:("An unknown CPDecimalNumber error has occurred. (Left operand= '" + [leftOperand descriptionWithLocale:nil] + "' Right operand= '" + [rightOperand descriptionWithLocale:nil] + "' Selector= '" + operation + "')") ];
|
||||
}
|
||||
|
||||
return nil;
|
||||
@@ -249,7 +249,7 @@ var CPDecimalNumberHandlerRoundingModeKey = @"CPDecimalNumberHandlerRoundi
|
||||
@ingroup foundation
|
||||
@brief Decimal floating point number
|
||||
|
||||
This class represents a decimal floating point number and the relavent
|
||||
This class represents a decimal floating point number and the relevant
|
||||
mathematical operations to go with it. It guarantees accuracy up to 38
|
||||
digits in the mantissa/coefficient and can handle numbers in the range:
|
||||
+/- 99999999999999999999999999999999999999 x 10^(127/-128)
|
||||
@@ -457,7 +457,7 @@ var CPDecimalNumberHandlerRoundingModeKey = @"CPDecimalNumberHandlerRoundi
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a new CPDecimalNumer with the maximum permissable decimal number
|
||||
Returns a new CPDecimalNumber with the maximum permissible decimal number
|
||||
value. Note: this is different to the number Cocoa returns. See
|
||||
CPDecimalNumber class description for details.
|
||||
@return a new CPDecimalNumber object
|
||||
@@ -468,7 +468,7 @@ var CPDecimalNumberHandlerRoundingModeKey = @"CPDecimalNumberHandlerRoundi
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a new CPDecimalNumer with the minimum permissable decimal number
|
||||
Returns a new CPDecimalNumber with the minimum permissible decimal number
|
||||
value. Note: this is different to the number Cocoa returns. See
|
||||
CPDecimalNumber class description for details.
|
||||
@return a new CPDecimalNumber object
|
||||
@@ -479,7 +479,7 @@ var CPDecimalNumberHandlerRoundingModeKey = @"CPDecimalNumberHandlerRoundi
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a new CPDecimalNumer initialised to \e NaN.
|
||||
Returns a new CPDecimalNumber initialised to \e NaN.
|
||||
@return a new CPDecimalNumber object
|
||||
*/
|
||||
+ (CPDecimalNumber)notANumber
|
||||
@@ -488,7 +488,7 @@ var CPDecimalNumberHandlerRoundingModeKey = @"CPDecimalNumberHandlerRoundi
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a new CPDecimalNumer initialised to zero (0.0).
|
||||
Returns a new CPDecimalNumber initialised to zero (0.0).
|
||||
@return a new CPDecimalNumber object
|
||||
*/
|
||||
+ (CPDecimalNumber)zero
|
||||
@@ -497,7 +497,7 @@ var CPDecimalNumberHandlerRoundingModeKey = @"CPDecimalNumberHandlerRoundi
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a new CPDecimalNumer initialised to one (1.0).
|
||||
Returns a new CPDecimalNumber initialised to one (1.0).
|
||||
@return a new CPDecimalNumber object
|
||||
*/
|
||||
+ (CPDecimalNumber)one
|
||||
@@ -663,7 +663,7 @@ var CPDecimalNumberHandlerRoundingModeKey = @"CPDecimalNumberHandlerRoundi
|
||||
|
||||
/*!
|
||||
Returns a new CPDecimalNumber object with the result of multiplying the
|
||||
receiver object by (10 ^ \c power). If overflow, underflowor loss of
|
||||
receiver object by (10 ^ \c power). If overflow, underflow or loss of
|
||||
precision occurs then the consequence depends on the CPDecimalNumberHandler
|
||||
object \e behavior.
|
||||
@param power the power of 10 to multiply the receiver by
|
||||
@@ -740,7 +740,7 @@ var CPDecimalNumberHandlerRoundingModeKey = @"CPDecimalNumberHandlerRoundi
|
||||
}
|
||||
|
||||
/*!
|
||||
Compare the reciever CPDecimalNumber to \c aNumber. This is a CPNumber or
|
||||
Compare the receiver CPDecimalNumber to \c aNumber. This is a CPNumber or
|
||||
subclass. Returns \e CPOrderedDescending, \e CPOrderedAscending or
|
||||
\e CPOrderedSame.
|
||||
@param aNumber an object of kind CPNumber to compare against.
|
||||
@@ -755,7 +755,7 @@ var CPDecimalNumberHandlerRoundingModeKey = @"CPDecimalNumberHandlerRoundi
|
||||
}
|
||||
|
||||
/*!
|
||||
The objective C type string. For compatability reasons
|
||||
The objective C type string. For compatibility reasons
|
||||
@return returns a CPString containing "d"
|
||||
*/
|
||||
- (CPString)objCType
|
||||
@@ -924,7 +924,7 @@ var CPDecimalNumberHandlerRoundingModeKey = @"CPDecimalNumberHandlerRoundi
|
||||
|
||||
// CPNumber inherited methods
|
||||
/*!
|
||||
Compare the reciever CPDecimalNumber to \c aNumber and return \e YES if
|
||||
Compare the receiver CPDecimalNumber to \c aNumber and return \e YES if
|
||||
equal.
|
||||
@param aNumber an object of kind CPNumber to compare against.
|
||||
@return a boolean
|
||||
|
||||
@@ -345,7 +345,7 @@
|
||||
@return A new array containing the keys corresponding to all occurrences of anObject in the receiver. If no object matching anObject is found, returns an empty array.
|
||||
|
||||
Each object in the receiver is sent an isEqual: message to determine if it's equal to anObject.
|
||||
If the check for isEqual fails a check is made to see if the two objects are the same object. This provides compatability for JSObjects.
|
||||
If the check for isEqual fails a check is made to see if the two objects are the same object. This provides compatibility for JSObjects.
|
||||
*/
|
||||
- (CPArray)allKeysForObject:(id)anObject
|
||||
{
|
||||
@@ -594,11 +594,11 @@
|
||||
|
||||
/*!
|
||||
@class CPMutableDictionary
|
||||
@ingroup compatability
|
||||
@ingroup compatibility
|
||||
|
||||
This class is just an empty subclass of CPDictionary.
|
||||
CPDictionary already implements mutable methods and
|
||||
this class only exists for source compatability.
|
||||
this class only exists for source compatibility.
|
||||
*/
|
||||
@implementation CPMutableDictionary : CPDictionary
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
this method if you want the dollar signs in displayed strings removed for editing.
|
||||
|
||||
@param anObject the object for which to return an editing string
|
||||
@return CPString object that is used for editing the textual represntation of an object
|
||||
@return CPString object that is used for editing the textual representation of an object
|
||||
*/
|
||||
- (CPString)editingStringForObjectValue:(id)anObject
|
||||
{
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
@param anObject if conversion is successful, upon return contains the object created from the string
|
||||
@param aString the string to parse.
|
||||
@param anError if non-nil, if there is an error durring the conversion, upon return contains an CPString object that describes the problem.
|
||||
@param anError if non-nil, if there is an error during the conversion, upon return contains an CPString object that describes the problem.
|
||||
@return BOOL YES if the conversion from the string to a view content object was successful, otherwise NO.
|
||||
*/
|
||||
- (BOOL)getObjectValue:(id)anObject forString:(CPString)aString errorDescription:(CPString)anError
|
||||
@@ -117,7 +117,7 @@
|
||||
|
||||
@param aPartialString the text currently in the view.
|
||||
@param aNewString if aPartialString needs to be modified, upon return contains the replacement string.
|
||||
@param anError if non-nil, if validation fails contains a CPString object that desibes the problem.
|
||||
@param anError if non-nil, if validation fails contains a CPString object that describes the problem.
|
||||
@return YES if aPartialString is an acceptable value, otherwise NO.
|
||||
*/
|
||||
- (BOOL)isPartialStringValid:(CPString)aPartialString newEditingString:(CPString)aNewString errorDescription:(CPString)anError
|
||||
@@ -141,7 +141,7 @@
|
||||
@param aProposedSelectedRange The selection range that will be used if the string is accepted or replaced.
|
||||
@param originalString The original string, before the proposed change.
|
||||
@param originalSelectedRange The selection range over which the change is to take place.
|
||||
@param error If non-nil, if validation fails contains an CPString object that descibes the problem.
|
||||
@param error If non-nil, if validation fails contains an CPString object that describes the problem.
|
||||
@return YES if aPartialString is acceptable, otherwise NO.
|
||||
|
||||
*/
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
var rangesCount = _ranges.length,
|
||||
otherRanges = anIndexSet._ranges;
|
||||
|
||||
// If we have a discrepency in the number of ranges or the number of indexes,
|
||||
// If we have a discrepancy in the number of ranges or the number of indexes,
|
||||
// simply return NO.
|
||||
if (rangesCount !== otherRanges.length || _count !== anIndexSet._count)
|
||||
return NO;
|
||||
@@ -215,7 +215,7 @@
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns \c YES if the receving index set contains all the indices in the argument.
|
||||
Returns \c YES if the receiving index set contains all the indices in the argument.
|
||||
@param anIndexSet the set of indices to check for in the receiving index set
|
||||
*/
|
||||
- (BOOL)containsIndexes:(CPIndexSet)anIndexSet
|
||||
@@ -836,7 +836,7 @@ var CPIndexSetCountKey = @"CPIndexSetCountKey",
|
||||
/*!
|
||||
Creates a deep copy of the index set. The returned copy
|
||||
is mutable. The reason for the two copy methods is for
|
||||
source compatability with GNUStep code.
|
||||
source compatibility with GNUStep code.
|
||||
@return the index set copy
|
||||
*/
|
||||
- (id)copy
|
||||
@@ -847,7 +847,7 @@ var CPIndexSetCountKey = @"CPIndexSetCountKey",
|
||||
/*!
|
||||
Creates a deep copy of the index set. The returned copy
|
||||
is mutable. The reason for the two copy methods is for
|
||||
source compatability with GNUStep code.
|
||||
source compatibility with GNUStep code.
|
||||
@return the index set copy
|
||||
*/
|
||||
- (id)mutableCopy
|
||||
@@ -859,11 +859,11 @@ var CPIndexSetCountKey = @"CPIndexSetCountKey",
|
||||
|
||||
/*!
|
||||
@class CPMutableIndexSet
|
||||
@ingroup compatability
|
||||
@ingroup compatibility
|
||||
|
||||
This class is an empty of subclass of CPIndexSet.
|
||||
CPIndexSet already implements mutable methods, and
|
||||
this class only exists for source compatability.
|
||||
this class only exists for source compatibility.
|
||||
*/
|
||||
@implementation CPMutableIndexSet : CPIndexSet
|
||||
|
||||
|
||||
@@ -23,10 +23,12 @@
|
||||
@import "CPArray.j"
|
||||
@import "CPDictionary.j"
|
||||
@import "CPException.j"
|
||||
@import "CPIndexSet.j"
|
||||
@import "CPNull.j"
|
||||
@import "CPObject.j"
|
||||
@import "CPSet.j"
|
||||
|
||||
|
||||
CPUndefinedKeyException = @"CPUndefinedKeyException";
|
||||
CPTargetObjectUserInfoKey = @"CPTargetObjectUserInfoKey";
|
||||
CPUnknownUserInfoKey = @"CPUnknownUserInfoKey";
|
||||
|
||||
@@ -773,7 +773,7 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOpti
|
||||
if (setMutationKind)
|
||||
{
|
||||
//old and new values for unordered to-many relationships can only be calculated before
|
||||
//set precalculated hidden new value as soon as "didChangeValue..." is called!
|
||||
//set recalculated hidden new value as soon as "didChangeValue..." is called!
|
||||
var newValue = changes[_CPKeyValueChangeSetMutationNewValueKey];
|
||||
[changes setValue:newValue forKey:CPKeyValueChangeNewKey];
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ var _CPKeyedArchiverStringClass = Nil,
|
||||
|
||||
@delegate -(void)archiverDidFinish:(CPKeyedArchiver)archiver;
|
||||
Called when the archiver finishes encoding.
|
||||
@param archiver the arhiver that finished encoding
|
||||
@param archiver the archiver that finished encoding
|
||||
|
||||
@delegate -(id)archiver:(CPKeyedArchiver)archiver willEncodeObject:(id)object;
|
||||
Called when an object is about to be encoded. Allows the delegate to replace
|
||||
@@ -370,7 +370,7 @@ var _CPKeyedArchiverStringClass = Nil,
|
||||
}
|
||||
|
||||
/*!
|
||||
Encdoes an object
|
||||
Encodes an object
|
||||
@param anObject the object to encode
|
||||
@param aKey the key to associate with the object
|
||||
*/
|
||||
|
||||
@@ -89,7 +89,7 @@ var CPArrayClass = Ni
|
||||
@delegate -(id)unarchiver:(CPKeyedUnarchiver)unarchiver didDecodeObject:(id)object;
|
||||
Called when the unarchiver decodes an object.
|
||||
@param unarchiver the unarchiver doing the decoding
|
||||
@param object the decoded objec
|
||||
@param object the decoded object
|
||||
@return a substitute to use for the decoded object. This can be the same object argument provide,
|
||||
another object or \c nil.
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ var CPNotificationDefaultCenter = nil;
|
||||
Adds an object as an observer. The observer will receive notifications with the specified name
|
||||
and/or containing the specified object (depending on if they are \c nil.
|
||||
@param anObserver the observing object
|
||||
@param aSelector the message sent to the observer when a notification occurrs
|
||||
@param aSelector the message sent to the observer when a notification occurs
|
||||
@param aNotificationName the name of the notification the observer wants to watch
|
||||
@param anObject the object in the notification the observer wants to watch
|
||||
*/
|
||||
|
||||
@@ -30,7 +30,7 @@ var CPNumberUIDs = new CFMutableDictionary();
|
||||
@ingroup foundation
|
||||
@brief A bridged object to native Javascript numbers.
|
||||
|
||||
This class primarily exists for source compatability. The JavaScript
|
||||
This class primarily exists for source compatibility. The JavaScript
|
||||
\c Number type can be changed on the fly based on context,
|
||||
so there is no need to call any of these methods.
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
When you subclass CPObject, most of the time you override one selector - init.
|
||||
It is called for default initialization of custom object. You must call
|
||||
parent class init in your overriden code:
|
||||
parent class init in your overridden code:
|
||||
<pre>- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
@@ -126,7 +126,7 @@ CPLog(@"Got some class: %@", inst);
|
||||
}
|
||||
|
||||
/*!
|
||||
Not necessary to call in Objective-J. Only exists for code compatability.
|
||||
Not necessary to call in Objective-J. Only exists for code compatibility.
|
||||
*/
|
||||
- (void)dealloc
|
||||
{
|
||||
@@ -188,7 +188,7 @@ CPLog(@"Got some class: %@", inst);
|
||||
|
||||
/*!
|
||||
Returns \c YES if the receiver is of the \c aClass class type.
|
||||
@param aClass the class to test the receiper
|
||||
@param aClass the class to test the receiver
|
||||
*/
|
||||
- (BOOL)isMemberOfClass:(Class)aClass
|
||||
{
|
||||
@@ -273,7 +273,7 @@ CPLog(@"Got some class: %@", inst);
|
||||
/*!
|
||||
Returns the method signature for the provided selector.
|
||||
@param aSelector the selector for which to find the method signature
|
||||
@return the selector's methd signature
|
||||
@return the selector's method signature
|
||||
*/
|
||||
- (CPMethodSignature)methodSignatureForSelector:(SEL)aSelector
|
||||
{
|
||||
|
||||
@@ -280,7 +280,7 @@ var cpOperationMainQueue = nil;
|
||||
}
|
||||
|
||||
/*!
|
||||
Convenience method for one system wide singelton queue. Returns the same queue as currentQueue.
|
||||
Convenience method for one system wide singleton queue. Returns the same queue as currentQueue.
|
||||
*/
|
||||
+ (CPOperationQueue)mainQueue
|
||||
{
|
||||
@@ -294,7 +294,7 @@ var cpOperationMainQueue = nil;
|
||||
}
|
||||
|
||||
/*!
|
||||
Convenience method for one system wide singelton queue. Returns the same queue as mainQueue.
|
||||
Convenience method for one system wide singleton queue. Returns the same queue as mainQueue.
|
||||
*/
|
||||
+ (CPOperationQueue)currentQueue
|
||||
{
|
||||
|
||||
@@ -20,8 +20,10 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
@import "CPException.j"
|
||||
@import "CPObject.j"
|
||||
|
||||
|
||||
CPPropertyListUnknownFormat = 0;
|
||||
CPPropertyListOpenStepFormat = kCFPropertyListOpenStepFormat;
|
||||
CPPropertyListXMLFormat_v1_0 = kCFPropertyListXMLFormat_v1_0;
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
// Using sort descriptors
|
||||
/*!
|
||||
Compares two objects.
|
||||
@param lhsObject the left hand side object to compre
|
||||
@param lhsObject the left hand side object to compare
|
||||
@param rhsObject the right hand side object to compare
|
||||
@return the comparison result
|
||||
*/
|
||||
|
||||
@@ -207,8 +207,8 @@ var CPStringRegexSpecialCharacters = [
|
||||
// Combining strings
|
||||
|
||||
/*!
|
||||
Returns a string made by appending to the reciever a string constructed from a given format
|
||||
string and the floowing arguments
|
||||
Returns a string made by appending to the receiver a string constructed from a given format
|
||||
string and the following arguments
|
||||
@param format the format string in printf-style.
|
||||
@return the initialized CPString
|
||||
*/
|
||||
@@ -316,7 +316,7 @@ var CPStringRegexSpecialCharacters = [
|
||||
Finds the range of characters in the receiver where the specified string exists. If the string
|
||||
does not exist in the receiver, the range \c length will be 0.
|
||||
@param aString the string to search for in the receiver
|
||||
@return the range of charactrs in the receiver
|
||||
@return the range of characters in the receiver
|
||||
*/
|
||||
- (CPRange)rangeOfString:(CPString)aString
|
||||
{
|
||||
@@ -392,7 +392,7 @@ var CPStringRegexSpecialCharacters = [
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a new string in which all occurrences of a target string in the reciever are replaced by
|
||||
Returns a new string in which all occurrences of a target string in the receiver are replaced by
|
||||
another given string.
|
||||
@param target The string to replace.
|
||||
@param replacement the string with which to replace the \c target
|
||||
@@ -587,7 +587,7 @@ var CPStringRegexSpecialCharacters = [
|
||||
Returns a string containing characters the receiver and a given string have in common, starting from
|
||||
the beginning of each up to the first characters that aren't equivalent.
|
||||
@param aString the string with which to compare the receiver
|
||||
@param aMask options for comparision
|
||||
@param aMask options for comparison
|
||||
*/
|
||||
- (CPString)commonPrefixWithString:(CPString)aString options:(int)aMask
|
||||
{
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a dictionar of the http header fields
|
||||
Returns a dictionary of the http header fields
|
||||
*/
|
||||
- (CPDictionary)allHTTPHeaderFields
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
/*!
|
||||
@class CPURLResponse
|
||||
@ingroup foundation
|
||||
@brief Protocol agnostic information about a request to a specifc URL.
|
||||
@brief Protocol agnostic information about a request to a specific URL.
|
||||
|
||||
Contains protocol agnostic information about a request to a specific URL.
|
||||
*/
|
||||
|
||||
@@ -76,7 +76,7 @@ var transformerMap = [CPDictionary dictionary];
|
||||
|
||||
- (id)reverseTransformedValue:(id)aValue
|
||||
{
|
||||
if ([[self class] allowsReverseTransformation])
|
||||
if (![[self class] allowsReverseTransformation])
|
||||
{
|
||||
[CPException raise:CPInvalidArgumentException reason:(self + " is not reversible.")];
|
||||
}
|
||||
@@ -91,7 +91,7 @@ var transformerMap = [CPDictionary dictionary];
|
||||
|
||||
@end
|
||||
|
||||
// builtin transformers
|
||||
// built-in transformers
|
||||
|
||||
@implementation CPNegateBooleanTransformer : CPValueTransformer
|
||||
{
|
||||
|
||||
@@ -102,7 +102,7 @@ CPWebDAVManagerNonCollectionResourceType = 0;
|
||||
}
|
||||
|
||||
if (!aBlock)
|
||||
return makeContents(aURL, response);
|
||||
return makeContents(aURL, [self PROPFIND:aURL properties:properties depth:1 block:nil]);
|
||||
|
||||
[self PROPFIND:aURL properties:properties depth:1 block:function(aURL, response)
|
||||
{
|
||||
|
||||
@@ -253,18 +253,24 @@ task ("demos", function()
|
||||
|
||||
// Testing
|
||||
|
||||
task("test", ["CommonJS", "test-only"]);
|
||||
task("test", ["CommonJS", "test-only", "check-missing-imports"]);
|
||||
|
||||
task("test-only", function()
|
||||
{
|
||||
var tests = new FileList('Tests/**/*Test.j');
|
||||
var cmd = ["ojtest"].concat(tests.items());
|
||||
var tests = new FileList('Tests/**/*Test.j'),
|
||||
cmd = ["ojtest"].concat(tests.items()),
|
||||
code = OS.system(serializedENV() + " " + cmd.map(OS.enquote).join(" "));
|
||||
|
||||
var code = OS.system(serializedENV() + " " + cmd.map(OS.enquote).join(" "));
|
||||
if (code !== 0)
|
||||
OS.exit(code);
|
||||
});
|
||||
|
||||
OS.system(serializedENV() + " " + ["js", "Tests/DetectMissingImports.js"].map(OS.enquote).join(" "));
|
||||
task("check-missing-imports", function()
|
||||
{
|
||||
var code = OS.system(serializedENV() + " " + ["js", "Tests/DetectMissingImports.js"].map(OS.enquote).join(" "));
|
||||
|
||||
if (code !== 0)
|
||||
OS.exit(code);
|
||||
});
|
||||
|
||||
task("push-packages", ["push-cappuccino", "push-objective-j"]);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
@import <AppKit/CPArrayController.j>
|
||||
@import <AppKit/CPTextField.j>
|
||||
|
||||
@implementation CPArrayControllerTest : OJTestCase
|
||||
{
|
||||
@@ -190,8 +191,7 @@
|
||||
|
||||
[arrayController setContent:newContent];
|
||||
|
||||
[self assert:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 2)] equals:[arrayController selectionIndexes]
|
||||
message:@"last object cannot be selected"];
|
||||
[self assert:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 2)] equals:[arrayController selectionIndexes] message:@"last object cannot be selected"];
|
||||
}
|
||||
|
||||
- (void)testContentBinding
|
||||
@@ -354,6 +354,16 @@
|
||||
[self assert:@"Building 1" equals:[[self arrayController] valueForKeyPath:@"selection.department.building"]];
|
||||
}
|
||||
|
||||
- (void)testArrangedObjectsNotEmptyAfterSetContentWhenClearsFilterOnInsertionIsTrue
|
||||
{
|
||||
var arrayController = [[CPArrayController alloc] init];
|
||||
[arrayController setFilterPredicate:nil];
|
||||
[arrayController setClearsFilterPredicateOnInsertion:YES];
|
||||
[arrayController setContent:[CPArray arrayWithObject:@"a"]];
|
||||
|
||||
[self assertTrue:[[arrayController arrangedObjects] count] > 0];
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:keyPath
|
||||
ofObject:anActivity
|
||||
change:change
|
||||
|
||||
@@ -83,6 +83,73 @@
|
||||
[self assert:NO equals:[[pullDownButton itemAtIndex:1] isHidden]];
|
||||
}
|
||||
|
||||
- (void)testMenuItemSynchronization
|
||||
{
|
||||
var popUpButton = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 28.0) pullsDown:NO];
|
||||
|
||||
[popUpButton addItemWithTitle:@"zero"];
|
||||
[popUpButton addItemWithTitle:@"one"];
|
||||
[popUpButton addItemWithTitle:@"two"];
|
||||
[popUpButton addItemWithTitle:@"three"];
|
||||
[popUpButton addItemWithTitle:@"four"];
|
||||
[popUpButton addItemWithTitle:@"five"];
|
||||
[popUpButton addItemWithTitle:@"six"];
|
||||
|
||||
[self assert:@"zero" same:[popUpButton title]];
|
||||
|
||||
[[popUpButton itemAtIndex:0] setTitle:@"new title"];
|
||||
|
||||
[self assert:@"new title" same:[popUpButton title]];
|
||||
|
||||
[popUpButton selectItemAtIndex:3];
|
||||
|
||||
[self assert:@"three" same:[popUpButton title]];
|
||||
|
||||
[[popUpButton itemAtIndex:3] setTitle:@"something else"];
|
||||
|
||||
[self assert:@"something else" same:[popUpButton title]];
|
||||
|
||||
[popUpButton selectItemAtIndex:6];
|
||||
|
||||
[self assert:@"six" same:[popUpButton title]];
|
||||
|
||||
[[popUpButton itemAtIndex:6] setTitle:@"another title"];
|
||||
|
||||
[self assert:@"another title" same:[popUpButton title]];
|
||||
|
||||
var popUpButton = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 28.0) pullsDown:YES];
|
||||
|
||||
[popUpButton addItemWithTitle:@"zero"];
|
||||
[popUpButton addItemWithTitle:@"one"];
|
||||
[popUpButton addItemWithTitle:@"two"];
|
||||
[popUpButton addItemWithTitle:@"three"];
|
||||
[popUpButton addItemWithTitle:@"four"];
|
||||
[popUpButton addItemWithTitle:@"five"];
|
||||
[popUpButton addItemWithTitle:@"six"];
|
||||
|
||||
[self assert:@"zero" same:[popUpButton title]];
|
||||
|
||||
[[popUpButton itemAtIndex:0] setTitle:@"new title"];
|
||||
|
||||
[self assert:@"new title" same:[popUpButton title]];
|
||||
|
||||
[popUpButton selectItemAtIndex:3];
|
||||
|
||||
[self assert:@"new title" same:[popUpButton title]];
|
||||
|
||||
[[popUpButton itemAtIndex:3] setTitle:@"something else"];
|
||||
|
||||
[self assert:@"new title" same:[popUpButton title]];
|
||||
|
||||
[popUpButton selectItemAtIndex:6];
|
||||
|
||||
[self assert:@"new title" same:[popUpButton title]];
|
||||
|
||||
[[popUpButton itemAtIndex:6] setTitle:@"another title"];
|
||||
|
||||
[self assert:@"new title" same:[popUpButton title]];
|
||||
}
|
||||
|
||||
- (void)testItemTitles
|
||||
{
|
||||
[self assert:[] equals:[button itemTitles]];
|
||||
|
||||
@@ -5,7 +5,11 @@ var FILE = require("file"),
|
||||
|
||||
var cPreprocessedFileContents = function(aFilePath)
|
||||
{
|
||||
var gcc = OS.popen("gcc -E -x c -P -DPLATFORM_COMMONJS " + OS.enquote(aFilePath), { charset:"UTF-8" }),
|
||||
var INCLUDES = new FileList(FILE.join(FILE.dirname(aFilePath), "**", "*.h")).map(function(aFilename)
|
||||
{
|
||||
return "--include \"" + aFilename + "\"";
|
||||
}).join(" ");
|
||||
var gcc = OS.popen("gcc -E -x c -P -DPLATFORM_COMMONJS " + INCLUDES + " " + OS.enquote(aFilePath), { charset:"UTF-8" }),
|
||||
chunk,
|
||||
fileContents = "";
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
[self assertTrue: [bob valueForKey:@"name"] == @"set_bob" message: "valueForKey:'name' should be 'set_bob', was: "+[bob valueForKey:@"name"]];
|
||||
[self assertTrue: bob.name == @"set_bob" message: "bob.name should be 'set_bob', was: "+bob.name];
|
||||
[self assertTrue: _sawObservation message:"Never recieved an observation"];
|
||||
[self assertTrue: _sawObservation message:"Never received an observation"];
|
||||
}
|
||||
|
||||
- (void)testUnobservedKey
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
|
||||
@implementation MyDict : CPDictionary
|
||||
{
|
||||
int a;
|
||||
}
|
||||
|
||||
+ (id)alloc
|
||||
{
|
||||
return class_createInstance(self);
|
||||
CPString _firstName;
|
||||
}
|
||||
|
||||
- (id)init
|
||||
@@ -15,7 +10,7 @@
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
_a = "Bob";
|
||||
_firstName = "Bob";
|
||||
|
||||
return self;
|
||||
}
|
||||
@@ -27,13 +22,13 @@
|
||||
|
||||
- (CPString)name
|
||||
{
|
||||
return _a;
|
||||
return _firstName;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation TestSubclassableDictionary : OJTestCase
|
||||
@implementation CPSubclassableDictionaryTest : OJTestCase
|
||||
|
||||
- (void)testThatMyDictContainsReplacedNameSelector
|
||||
{
|
||||
@@ -53,7 +48,7 @@
|
||||
{
|
||||
var target = [[CPDictionary alloc] init];
|
||||
|
||||
[OJAssert assert:@"Bob" notEqual:[target name]];
|
||||
[OJAssert assert:NO same:[target respondsToSelector:@selector(name)]];
|
||||
}
|
||||
|
||||
- (void)testThatTollFreeDoesNotHaveNewSelector
|
||||
@@ -63,4 +58,4 @@
|
||||
[OJAssert assertThrows:function() { [target secondaryName]; }];
|
||||
}
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* TableBindings
|
||||
*
|
||||
* Created by You on January 16, 2011.
|
||||
* Copyright 2011, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/CPObject.j>
|
||||
|
||||
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
CPWindow theWindow; //this "outlet" is connected automatically by the Cib
|
||||
CPArrayController arrayController;
|
||||
CPTextField from;
|
||||
CPTextField to;
|
||||
|
||||
CPArray rows @accessors;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
{
|
||||
// This is called when the application is done loading.
|
||||
}
|
||||
|
||||
- (void)awakeFromCib
|
||||
{
|
||||
rows = [CPArray new];
|
||||
|
||||
var path = [[CPBundle mainBundle] pathForResource:@"rows.plist"],
|
||||
request = [CPURLRequest requestWithURL:path],
|
||||
connection = [CPURLConnection connectionWithRequest:request delegate:self];
|
||||
|
||||
[theWindow setFullBridge:YES];
|
||||
}
|
||||
|
||||
- (void)connection:(CPURLConnection)connection didReceiveData:(CPString)dataString
|
||||
{
|
||||
if (!dataString)
|
||||
return;
|
||||
|
||||
var data = [[CPData alloc] initWithRawString:dataString],
|
||||
theRows = [CPPropertyListSerialization propertyListFromData:data format:CPPropertyListXMLFormat_v1_0];
|
||||
|
||||
[self setRows:theRows];
|
||||
}
|
||||
|
||||
- (void)test:(id)sender
|
||||
{
|
||||
var range = CPMakeRange([from intValue], [to intValue]);
|
||||
var indexes = [CPIndexSet indexSetWithIndexesInRange:range];
|
||||
|
||||
[[rows objectsAtIndexes:indexes] setValue:@"b" forKey:@"colTwo"];
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Main cib file base name</key>
|
||||
<string>MainMenu.cib</string>
|
||||
<key>CPBundleName</key>
|
||||
<string>TableBindings</string>
|
||||
<key>CPPrincipalClass</key>
|
||||
<string>CPApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Jakefile
|
||||
* TableBindings
|
||||
*
|
||||
* Created by You on January 16, 2011.
|
||||
* Copyright 2011, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
var ENV = require("system").env,
|
||||
FILE = require("file"),
|
||||
JAKE = require("jake"),
|
||||
task = JAKE.task,
|
||||
FileList = JAKE.FileList,
|
||||
app = require("cappuccino/jake").app,
|
||||
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
|
||||
OS = require("os");
|
||||
|
||||
app ("TableBindings", function(task)
|
||||
{
|
||||
task.setBuildIntermediatesPath(FILE.join("Build", "TableBindings.build", configuration));
|
||||
task.setBuildPath(FILE.join("Build", configuration));
|
||||
|
||||
task.setProductName("TableBindings");
|
||||
task.setIdentifier("com.yourcompany.TableBindings");
|
||||
task.setVersion("1.0");
|
||||
task.setAuthor("Your Company");
|
||||
task.setEmail("feedback @nospam@ yourcompany.com");
|
||||
task.setSummary("TableBindings");
|
||||
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
|
||||
task.setResources(new FileList("Resources/**"));
|
||||
task.setIndexFilePath("index.html");
|
||||
task.setInfoPlistPath("Info.plist");
|
||||
task.setNib2CibFlags("-R Resources/");
|
||||
|
||||
if (configuration === "Debug")
|
||||
task.setCompilerFlags("-DDEBUG -g");
|
||||
else
|
||||
task.setCompilerFlags("-O");
|
||||
});
|
||||
|
||||
task ("default", ["TableBindings"], function()
|
||||
{
|
||||
printResults(configuration);
|
||||
});
|
||||
|
||||
task ("build", ["default"]);
|
||||
|
||||
task ("debug", function()
|
||||
{
|
||||
ENV["CONFIGURATION"] = "Debug";
|
||||
JAKE.subjake(["."], "build", ENV);
|
||||
});
|
||||
|
||||
task ("release", function()
|
||||
{
|
||||
ENV["CONFIGURATION"] = "Release";
|
||||
JAKE.subjake(["."], "build", ENV);
|
||||
});
|
||||
|
||||
task ("run", ["debug"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Debug", "TableBindings", "index.html")]);
|
||||
});
|
||||
|
||||
task ("run-release", ["release"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Release", "TableBindings", "index.html")]);
|
||||
});
|
||||
|
||||
task ("deploy", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Deployment", "TableBindings"));
|
||||
OS.system(["press", "-f", FILE.join("Build", "Release", "TableBindings"), FILE.join("Build", "Deployment", "TableBindings")]);
|
||||
printResults("Deployment")
|
||||
});
|
||||
|
||||
task ("desktop", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Desktop", "TableBindings"));
|
||||
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "TableBindings"), FILE.join("Build", "Desktop", "TableBindings", "TableBindings.app"));
|
||||
printResults("Desktop")
|
||||
});
|
||||
|
||||
task ("run-desktop", ["desktop"], function()
|
||||
{
|
||||
OS.system([FILE.join("Build", "Desktop", "TableBindings", "TableBindings.app", "Contents", "MacOS", "NativeHost"), "-i"]);
|
||||
});
|
||||
|
||||
function printResults(configuration)
|
||||
{
|
||||
print("----------------------------");
|
||||
print(configuration+" app built at path: "+FILE.join("Build", configuration, "TableBindings"));
|
||||
print("----------------------------");
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,103 @@
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<!--
|
||||
index-debug.html
|
||||
TableBindings
|
||||
|
||||
Created by You on January 16, 2011.
|
||||
Copyright 2011, Your Company All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||
|
||||
<title>TableBindings</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
objj_msgSend_reset();
|
||||
|
||||
// DEBUG OPTIONS:
|
||||
|
||||
// Uncomment to enable printing of backtraces on exceptions:
|
||||
//objj_msgSend_decorate(objj_backtrace_decorator);
|
||||
|
||||
// Uncomment to supress exceptions that take place inside a message
|
||||
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
|
||||
|
||||
// Uncomment to enable runtime type checking:
|
||||
//objj_msgSend_decorate(objj_typecheck_decorator);
|
||||
|
||||
// Uncomment (along with both above) to print backtraces on type check errors:
|
||||
//objj_typecheck_prints_backtrace = true;
|
||||
|
||||
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
|
||||
//CPLogUnregister(CPLogDefault);
|
||||
|
||||
// Uncomment to enable a specific logger:
|
||||
//CPLogRegister(CPLogConsole);
|
||||
//CPLogRegister(CPLogPopup);
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
#container {position: absolute; top:50%; left:50%;}
|
||||
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
|
||||
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
|
||||
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
|
||||
</style>
|
||||
|
||||
<!--[if lt IE 7]>
|
||||
<STYLE type="text/css">
|
||||
#container { position: relative; top: 50%; }
|
||||
#content { position: relative;}
|
||||
</STYLE>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading TableBindings...</p></div>");
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<div id="container">
|
||||
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
|
||||
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
|
||||
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
|
||||
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
|
||||
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
|
||||
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
|
||||
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
|
||||
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
|
||||
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
|
||||
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,77 @@
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<!--
|
||||
index.html
|
||||
TableBindings
|
||||
|
||||
Created by You on January 16, 2011.
|
||||
Copyright 2011, Your Company All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||
|
||||
<title>TableBindings</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
#container {position: absolute; top:50%; left:50%;}
|
||||
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
|
||||
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
|
||||
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
|
||||
</style>
|
||||
|
||||
<!--[if lt IE 7]>
|
||||
<STYLE type="text/css">
|
||||
#container { position: relative; top: 50%; }
|
||||
#content { position: relative;}
|
||||
</STYLE>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading TableBindings...</p></div>");
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<div id="container">
|
||||
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
|
||||
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
|
||||
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
|
||||
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
|
||||
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
|
||||
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
|
||||
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
|
||||
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
|
||||
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
|
||||
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* TableBindings
|
||||
*
|
||||
* Created by You on January 16, 2011.
|
||||
* Copyright 2011, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
@import "AppController.j"
|
||||
|
||||
|
||||
function main(args, namedArgs)
|
||||
{
|
||||
CPApplicationMain(args, namedArgs);
|
||||
}
|
||||
@@ -31,7 +31,7 @@ PROJECT_NAME = "Cappuccino API"
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 0.8.1
|
||||
PROJECT_NUMBER = 0.9.0
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
|
||||
@@ -4,10 +4,13 @@ Included you should find the following:
|
||||
|
||||
1. Documentation
|
||||
2. NewApplication
|
||||
3. bootstrap.sh
|
||||
4. README
|
||||
|
||||
NewApplication is a stand alone Cappuccino application that you can use as a template to start building your own apps. To get started, just open up NewApplication/index.html in your favorite web browser. A great place to go from there is to read the "Downloading and Getting Started" tutorial found at http://cappuccino.org/learn/tutorials/starter-tutorial.php. This will walk you through these initial steps as well as getting you to do a little coding. If you want to debug your application, try running it with index-debug.html instead, which should make it easier.
|
||||
|
||||
You can build your entire application right from either of these sample projects, but if you want to dig a little deeper, you can also download the Tools package found at http://cappuccino.org/download/. This will set you up with some great additions like syntax modules for certain text editors and build tools to get extra performance.
|
||||
You can build your entire application right from either of these sample projects, but if you want to dig a little deeper, you can install the full set of tools by running the bootstrap.sh script. This will set you up with some great additions like build tools to help fine tune the performance of your deployments.
|
||||
|
||||
NOTE: If you'd like to make a nib-based application, you will need to download the Tools package from cappuccino.org/download
|
||||
NOTE: If you'd like to make a nib-based application (so you can create your interface in Interface Builder), you will need to install the Cappuccino tools.
|
||||
|
||||
For more details, see our more thorough README on our website: http://cappuccino.org/download/readme.php
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
_preservesSelection = [aCoder decodeBoolForKey:@"NSPreservesSelection"];
|
||||
_selectsInsertedObjects = [aCoder decodeBoolForKey:@"NSSelectsInsertedObjects"];
|
||||
_alwaysUsesMultipleValuesMarker = [aCoder decodeBoolForKey:@"NSAlwaysUsesMultipleValuesMarker"];
|
||||
_automaticallyRearrangesObjects = [aCoder decodeBoolForKey:@"NSAutomaticallyRearrangesObjects"];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
@@ -49,8 +49,8 @@
|
||||
_tag = [aCoder decodeIntForKey:"NSTag"];
|
||||
_state = [aCoder decodeIntForKey:"NSState"];
|
||||
|
||||
// _image = [aCoder decodeObjectForKey:"NSImage"];
|
||||
// _alternateImage = [aCoder decodeObjectForKey:""];
|
||||
_image = [aCoder decodeObjectForKey:"NSImage"];
|
||||
// _alternateImage = [aCoder decodeObjectForKey:""];
|
||||
// _onStateImage = [aCoder decodeObjectForKey:"NSOnImage"];
|
||||
// _offStateImage = [aCoder decodeObjectForKey:"NSOffImage"];
|
||||
// _mixedStateImage = [aCoder decodeObjectForKey:"NSMixedImage"];
|
||||
|
||||
+29
-15
@@ -79,6 +79,24 @@ function check_and_exit () {
|
||||
}
|
||||
|
||||
function check_build_environment () {
|
||||
# make sure dependencies are installed and on the $PATH
|
||||
CAPP_BUILD_DEPS=(java gcc unzip)
|
||||
|
||||
for dep in ${CAPP_BUILD_DEPS[@]}; do
|
||||
which "$dep" &> /dev/null
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo "Error: $dep is required to bootstrap Cappuccino. Please install $dep and re-run bootstrap.sh."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# special case: check for curl or wget
|
||||
which curl &> /dev/null || which wget &> /dev/null
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo "Error: curl or wget are required to bootstrap Cappuccino. Please install one of them and re-run bootstrap.sh."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# make sure user is running the Sun JVM or OpenJDK >= 6b18
|
||||
java_version=$(java -version 2>&1)
|
||||
echo $java_version | grep OpenJDK > /dev/null
|
||||
@@ -90,17 +108,6 @@ function check_build_environment () {
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# make sure other dependencies are installed and on the $PATH
|
||||
OTHER_DEPS=(gcc unzip)
|
||||
|
||||
for dep in ${OTHER_DEPS[@]}; do
|
||||
which "$dep" &> /dev/null
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo "Error: $dep is required to build Cappuccino. Please install $dep and re-run bootstrap.sh."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
check_build_environment
|
||||
@@ -126,6 +133,7 @@ while [ $# -gt 0 ]; do
|
||||
--noprompt) noprompt="yes";;
|
||||
--directory) install_directory="$2"; shift;;
|
||||
--clone) tusk_install_command="clone";;
|
||||
--clone-http) tusk_install_command="clone --http";;
|
||||
--github-user) github_user="$2"; shift;;
|
||||
--github-ref) github_ref="$2"; shift;;
|
||||
--install-capp) install_capp="yes";;
|
||||
@@ -134,7 +142,8 @@ usage: ./bootstrap.sh [OPTIONS]
|
||||
|
||||
--noprompt: Don't prompt, use relatively safe defaults.
|
||||
--directory [DIR]: Use a directory other than /usr/local/narwhal.
|
||||
--clone: Do "git clone" instead of downloading zips.
|
||||
--clone: Do "git clone git://" instead of downloading zips.
|
||||
--clone-http: Do "git clone http://" instead of downloading zips.
|
||||
--github-user [USER]: Use another github user (default: 280north).
|
||||
--github-ref [REF]: Use another git ref (default: master).
|
||||
--install-capp: Install "objective-j" and "cappuccino" packages.
|
||||
@@ -199,7 +208,7 @@ if [ "$install_narwhal" ]; then
|
||||
else
|
||||
read input
|
||||
fi
|
||||
if [ "$input" ]; then
|
||||
if [ "$input" ] && [ ! "$input" = "yes" ]; then
|
||||
install_directory="`cd \`dirname "$input"\`; pwd`/`basename "$input"`"
|
||||
else
|
||||
install_directory="$default_directory"
|
||||
@@ -224,8 +233,13 @@ if [ "$install_narwhal" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$tusk_install_command" = "clone" ]; then
|
||||
git_repo="git://github.com/$github_path.git"
|
||||
if [ "$(echo $tusk_install_command | cut -c-5)" = "clone" ]; then
|
||||
if [ "$(echo $tusk_install_command | cut -c7-)" = "--http" ]; then
|
||||
git_protocol="http"
|
||||
else
|
||||
git_protocol="git"
|
||||
fi
|
||||
git_repo="$git_protocol://github.com/$github_path.git"
|
||||
echo "Cloning Narwhal from \"$git_repo\"..."
|
||||
git clone "$git_repo" "$install_directory"
|
||||
(cd "$install_directory" && git checkout "origin/$github_ref")
|
||||
|
||||
Reference in New Issue
Block a user