Compare commits

..
Author SHA1 Message Date
Stefan Eilers a61db69dea Merge branch 'master' of git://github.com/slevenbits/cappuccino into slevenbits-master 2012-12-14 16:33:55 +01:00
Alexander Ljungberg 90640b824c Merge branch 'refs/heads/slevenbits-tokenfield-value-fix' into slevenbits 2012-12-14 15:14:15 +00:00
Alexander Ljungberg eed37a0f81 Fixed: if any token field was being edited, the object value of all other token fields contained the partial value.
Without this fix, token fields generally assumed that if there was anything in the shared editor buffer, it belonged to the current field, even if it wasn't the field that was being edited.

With this fix only the token field actually being edited considers the editor contents.
2012-12-14 15:12:44 +00:00
Stefan Eilers f974955d4b Fix "jake release" 2012-12-13 17:06:15 +01:00
Alexander Ljungberg 252144950a Merge branch 'refs/heads/slevenbits-popover-firefox-fix' into slevenbits 2012-12-13 14:09:18 +00:00
Alexander Ljungberg 0781a4153e Fixed: popoverDidShow in Firefox. New: popover animation support in Firefox, Opera and IE10.
Before this fix, popoverDidShow: would not be sent to popover delegates when the app ran in Firefox due to Firefox now recognising the -webkit-transition property, but not the webkitTransitionEnd event.

Also, before this fix popover animation was only implemented for Webkit based browsers.

This fix resolves that issue and in addition adds full support for animated popovers in all browsers that support CSS transitions. The fix also improves Cappuccino's general support for CSS3 animations.
2012-12-13 14:04:36 +00:00
Alexander Ljungberg 17e49c458e Merge branch 'refs/heads/slevenbits-key-popover-fix' into slevenbits 2012-12-12 18:17:34 +00:00
Alexander Ljungberg 8ec1325aff Fixed: CPPopovers could not become key windows in recent versions.
This prevented text fields and token fields from accepting input when placed in a pop over.

This fix allows the underlying popover window to become the key window.
2012-12-12 18:17:20 +00:00
Alexander Ljungberg 7fbe571e04 Merge remote-tracking branch 'slevenbits/slevenbits-tokenfield-scroll-fix' into slevenbits 2012-12-12 17:50:41 +00:00
Alexander Ljungberg b0051603da Merge remote-tracking branch 'slevenbits/slevenbits-editable-tokenfield-fix' into slevenbits 2012-12-12 17:50:33 +00:00
Alexander Ljungberg 947b116c06 Manual test for non-editable token fields. 2012-12-12 17:50:05 +00:00
Alexander Ljungberg 095858d3d5 Fixed: token field autocomplete scrollbars unresponsive to mouse.
Without this fix, the scroll handle in the token field autocomplete menu could not be moved using the mouse. Only scroll wheel or keyboard based scrolling was possible.

This fix enables regular mouse interaction with the scrollbar.
2012-12-12 17:47:50 +00:00
Alexander Ljungberg 2b1b1ea33b Fixed: CPScrollView setGlobalScrollerStyle: return value. 2012-12-12 17:45:59 +00:00
Alexander Ljungberg 1bed7e7108 Merge remote-tracking branch 'slevenbits/slevenbits-editable-tokenfield-fix' into slevenbits 2012-12-11 17:28:17 +00:00
Alexander Ljungberg bd1f64bfde Only show token delete button on hover, and only when token field is editable.
Before this change the close button showed at all times, even for token fields which weren't even editable.

This change brings us closer to Cocoa in that there's no token delete button most of the time, and just like in Cocoa there are more controls available on hover. (Although in Cocoa there's a disclosure arrow and we have a close button instead.)
2012-12-11 17:27:13 +00:00
Alexander Ljungberg d27e333941 Fixed: tokens could be deleted in an non editable token field.
Prior to this fix, clicking the (X) button on a token would delete the token even if the field was not actually editable.
2012-12-11 17:19:02 +00:00
Alexander Ljungberg c2bf47eca2 Support CPThemeStateEditable for text fields. 2012-12-11 17:15:24 +00:00
Alexander Ljungberg 9035439f61 Fixed: token field first responder flicker when clicking tokens.
Without this change, clicking a token in a first responder token field would cause it to momentarily lose first responder status and then immediately gain it back.

This fix makes it so that tokens never try to become the first responder, resulting in a more stable token field as tokens are selected and deselected.
2012-12-11 16:43:06 +00:00
Alexander Ljungberg 60fd129bd9 Merge remote-tracking branch 'slevenbits/slevenbits-settimeout-fix' into slevenbits 2012-12-11 13:05:43 +00:00
Alexander Ljungberg 77955f4e2b Allow setTimeout(f) to support some JS libraries such as PDF.js.
Without this change some 3rd party JS libraries such as PDF.js, which rely on the nonstandard setTimeout(f), will not operate correctly.

According to MDN the delay argument is required. However browsers seem to treat setTimeout without delay argument the same as a delay of 0. This fix makes it so that Cappuccino apps do the same.
2012-12-11 00:57:42 +00:00
Alexander Ljungberg ad5f0a7f7d Avoid touching the window object in CPApplication of non-DOM apps. 2012-12-03 22:45:53 +00:00
Alexander Ljungberg 2611e867b3 Fixed: ce9534c too negative with canBecomeKeyWindow.
Due to a typo in ce9534c, even standard titled windows returned NO for `canBecomeKeyWindow`. This triggered errors in `CPApplicationTest`.

The fix returns the correct YES for `canBecomeKeyWindow` of titled windows.
2012-12-03 22:44:12 +00:00
Alexander Ljungberg c9434ec4dc Fixed: CPFontManager attempt to access DOM in non-DOM apps.
The DOM access caused `CPFontManagerTest` when executed with rhino.
2012-12-03 22:22:16 +00:00
Alexander Ljungberg 282e96649a Formatting. 2012-12-03 22:21:01 +00:00
Alexander Ljungberg d4f9e7cba4 Merge branch 'master' into slevenbits 2012-11-30 00:07:07 +00:00
Alexander Ljungberg 71b93a2b4c Merge pull request #1696 from slevenbits/slevenbits-tokenfield-autocomplete-position
Fixed: token field autocomplete menu placed incorrectly.
2012-11-29 23:51:52 +00:00
Alexander Ljungberg 86b302491a Merge pull request #1695 from slevenbits/slevenbits-tabbing-fix
Fixed: tabbing to token fields.
2012-11-29 23:50:00 +00:00
Alexander Ljungberg e28a78afd3 Merge pull request #1693 from mrcarlberg/nib2cib_correct_height_for_button_subclasses
nib2cib will now adjust to the correct themed height for subclasses of CPButton
2012-11-29 12:34:29 +00:00
Martin Carlberg 7dd034e56c nib2cib will now adjust to the correct themed height for subclasses of CPButton.
For examples CPPopUpButton can get another height then CPButton.
2012-11-29 13:25:53 +01:00
cacaodev b97a07630d CPStepper : Adds binding support for CPValueBinding, CPMinValueBinding, CPMaxValueBinding. Placehoders defaults are minValue, minValue, maxValue.
CPStepperBindings : Example for these bindings. Shows behavior when input is a marker.
2012-11-27 15:52:38 +01:00
Alexander Ljungberg 990aeca0ba Merge pull request #1681 from mockingbird/master
Make all validations by the framework be autovalidations
2012-11-26 23:44:22 +00:00
Alexander Ljungberg 3c5284f081 Merge pull request #1691 from cacaodev/CPBinder-_updatePlaceholdersWithOptions
CPBinder -_updatePlaceholdersWithOptions:  add a reference to the binding.
2012-11-26 23:36:55 +00:00
Alexander Ljungberg db1bf80cd4 Merge branch 'refs/heads/slevenbits-tabbing-fix' into slevenbits 2012-11-26 23:33:30 +00:00
cacaodev da01d3aaaa do it right 2012-11-26 18:31:08 +01:00
Alexander Ljungberg 9d4e8164b7 Fixed: token field autocomplete selection by mouse.
After recent changes clicking on an autocomplete item in the pop up did nothing. Now this works and in conjunction with the new non-key-window-change update it's likely to work better than before.
2012-11-26 15:39:41 +00:00
Alexander Ljungberg ce9534cdea Fixed: canBecomeKeyWindow response for auxiliary windows.
Without this fix Cappuccino always returned YES for `canBecomeKeyWindow` for every window. But in Cocoa, only "standard" windows with a title bar and/or resizing return YES.

With this fix Cappuccino better matches Cocoa's behaviour.
2012-11-26 14:01:33 +00:00
Alexander Ljungberg 2236e7d2da Unused variable. 2012-11-26 13:48:45 +00:00
Alexander Ljungberg 2ea24ed2dc Merge branch 'slevenbits-tokenfield-autocomplete-position' into slevenbits 2012-11-26 13:41:39 +00:00
Alexander Ljungberg abfb23d931 Merge branch 'refs/heads/slevenbits-tab-view-resize-fix' into slevenbits 2012-11-25 18:00:20 +00:00
Alexander Ljungberg 868480ada5 Merge branch 'refs/heads/master' into slevenbits 2012-11-25 17:59:48 +00:00
Alexander Ljungberg 632e226b51 Manual test to demo/test fixed position text with and without bezel. 2012-11-25 11:12:37 +00:00
cacaodev 6c4d1e5ce1 CPBinder _updatePlaceholdersWithOptions : Added forBinding:(CPString)aBinding argument.
If a binder instance can manage several bindings, you may want to set placeholders depending on the binding name.
2012-11-22 15:33:01 +01:00
Alexander Ljungberg 4ef5dc83bb Fixed: token field autocomplete menu placed incorrectly.
If the token field was in a window not placed in the upper left corner of the screen (like regular platform windows are), the autocomplete menu would show up in the wrong spot.
2012-11-19 15:08:17 +00:00
Alexander Ljungberg 9ebc78773d Put half a vertical spacing above the first row of tokens.
This means there'll be 1 px of spacing both above and below tokens in multi-row configurations. It also places the token much better in the field both in single and multi-row configurations, at least for the Aristo theme.
2012-11-19 12:14:28 +00:00
Alexander Ljungberg e2f8d77f67 Fixed: white line when scrolling between tokens.
Without this fix there'd be a white line visible on top of the token field when scrolling between multiple lines of tokens in a short field.

In addition the scroll view was 1 px short which made it possible to scroll tokens up and down by 1 px even when there was only a single row of tokens which should fit in the field.

This fix expands the clip rect upwards by 1 px to bring it all the way up to the first row of bezel pixels, ensuring sure a single row of tokens fits fully in a 1 row token field.
2012-11-19 11:54:05 +00:00
Alexander Ljungberg 256d36320a Fixed: token fields lost first responder status when switching between windows.
E.g. in a two window application, if a token field was the first responder and another window was made active and then the original window made active again, the token field would no longer be the first responder.
2012-11-19 00:40:26 +00:00
Alexander Ljungberg 6bc8ad0e2c Add a token field to attached sheet test for first responder testing in multi window situations. 2012-11-18 22:34:08 +00:00
Alexander Ljungberg fd3ad76db3 Fixed: after tabbing to a token field it'd immediately lose first responder status.
Without this fix, the tab key press would be propagated to the browser, which would blur the focused input element, even when that input element was the one the new first responder intended to use.
2012-11-18 22:32:41 +00:00
Alexander Ljungberg 8a39561ddb Extend tab view test with different tab view types.
Resizing for all tab view types can now be tested by clicking "Cycle Tab View Type" up to 6 times and resizing the window for each mode. (Some modes are not implemented.)
2012-11-18 19:33:58 +00:00
Alexander Ljungberg 27584544d9 Fixed: tab views added in IB didn't resize properly.
IB sets `autoresizesSubviews` to NO for tab views by default. In Cocoa this doesn't make any difference because `NSTabView` ignores this setting.

This fix makes it so that Cappuccino's tab view also works with `autoresizesSubviews` off.
2012-11-18 19:24:13 +00:00
Alexander Ljungberg 8902acba04 Merge branch 'master' into slevenbits 2012-11-17 11:58:46 +00:00
Alexander Ljungberg 788ee6cd90 Merge branch 'master' of github.com:cappuccino/cappuccino 2012-11-17 11:45:20 +00:00
Alexander Ljungberg 97f3ab23b7 Merge pull request #1689 from slevenbits/slevenbits-content-rect-toolbar-fix
Fixed: incorrect `- CPWindow contentRectForFrameRect:` and  `frameRectForContentRect:` for borderless windows with toolbars.
2012-11-17 11:40:53 +00:00
Alexander Ljungberg 074e9f70a0 Fixed: incorrect - CPWindow contentRectForFrameRect: and frameRectForContentRect: for borderless windows with toolbars.
The window views driving non standard windows (such as borderless or bridge windows) did not take the toolbar into account when calculating the content rect.

Apart from being wrong, this could lead to the content view overlapping the toolbar if the content view was set after the toolbar was prepared.

Perhaps the thought was that the base _CPWindowView shouldn't make assumptions about the placement and sizing of a toolbar and leave that up to subclasses, but the _CPWindowView tile method already did.
2012-11-17 10:06:08 +00:00
Antoine Mercadal 621f1f1d61 Merge branch 'master' of https://github.com/cappuccino/cappuccino 2012-11-15 15:33:49 -08:00
Antoine Mercadal ba338036f9 improve CPPopover's popoverDidShow: management
Before, the popoverDidShow: delegate methods was called during the CSS animation (if any)
Problem is that is we are processing big amount of data, the animation may hang for a bit in the middle, giving an impression of jerkiness.

Now, popoverDidShow: is called at the end of the CSS animation if popover is animated.
2012-11-15 15:31:20 -08:00
Alexander Ljungberg 9b9380c18e Merge branch 'refs/heads/master' into slevenbits 2012-11-15 17:15:18 +00:00
Alexander Ljungberg c896101a30 Fixed: a recent internal method rename broke CPTabViewItem setView:. 2012-11-15 10:05:14 +00:00
Alexander Ljungberg 7fab75216f Fixed: text field responder error when using a formatter.
If the formatter rejected a change and prevented the first responder status from being surrendered, the text field would still stop listening to key window changes and break first responder behaviour when switching between windows.
2012-11-13 16:34:47 +00:00
Alexander Ljungberg 6c265fee30 With the NSMatrix->CPRadioGroup change the selectedRadio is easier to get. 2012-11-13 16:31:52 +00:00
Alexander Ljungberg f1c6a8bc12 Fixed: Error: Permission denied to access property '_childAppIsStarting' in Firefox.
This error would occur when running an app in an iframe which could not access its parent frame.
2012-11-08 17:30:17 +00:00
Antoine Mercadal 0fa499bd61 Makes CPAlert above popovers 2012-10-30 11:09:38 -07:00
Antoine Mercadal c747a79db9 Merge branch 'master' of https://github.com/cappuccino/cappuccino 2012-10-29 16:10:15 -07:00
Antoine Mercadal a1751cc981 Improve Popover's content view resizing 2012-10-29 16:09:09 -07:00
Alexander Ljungberg 797bfeec98 Implement CPPointInRect.
This improves source code compatibility with Cocoa when replacing NS with CP.
2012-10-24 15:35:42 +01:00
Alexander Ljungberg c3c61e1889 - CPBox titleView.
This method is the Cappuccino analog to `- NSBox titleCell`.
2012-10-24 15:32:45 +01:00
Alexander Ljungberg 0d9973abb9 Fixed: out of place table headers and other text positioning errors.
A line breaking, vertically centred or bottom aligned `_CPImageAndTextView` would not properly recalculate text position when the height of the text changed due to the width of the field changing.

This could cause, for example, table header text to be misaligned if the table was initialised with a zero height.
2012-10-23 16:19:11 +01:00
Saikat Chakrabarti e46cd1478b Fix syntax of validateVisibleItems 2012-10-07 14:45:23 -04:00
Aparajita Fishman 3992ca71c6 Merge branch 'clickedColumn' 2012-10-02 17:20:53 -04:00
Saikat Chakrabarti d718c292f5 Combine the _autovalidate and validateVisibleItems methods. 2012-10-01 21:21:01 -07:00
Aparajita Fishman 3a04bb2957 Merge branch 'refs/heads/upstream' 2012-09-29 05:28:41 -04:00
Aparajita Fishman 1c3300b066 Merge branch 'tag-fix' 2012-09-28 16:21:27 -04:00
Aparajita Fishman b443cb806a Both cells and controls can have tags in IB, control tag should take precedence 2012-09-28 16:13:24 -04:00
Alexander Ljungberg adbc420e0f Merge branch 'master' into slevenbits 2012-09-04 16:39:20 +01:00
Alexander Ljungberg e95648ca16 Merge branch 'master' into slevenbits 2012-09-03 20:20:52 +01:00
Alexander Ljungberg d0d66227cb Merge branch 'master' into slevenbits 2012-09-03 11:36:33 +01:00
Alexander Ljungberg 9d57d02eb5 Merge branch 'master' into slevenbits 2012-09-02 23:12:16 +01:00
Alexander Ljungberg bc93b3f6c7 Merge branch 'master' into slevenbits 2012-08-31 22:31:58 +01:00
Alexander Ljungberg 63b57b886e Merge branch 'master' into slevenbits 2012-08-31 22:12:16 +01:00
Alexander Ljungberg 10f6c8e8f6 Merge branch 'master' into slevenbits 2012-08-16 19:14:36 +01:00
Alexander Ljungberg 7b3136dae3 Merge branch 'master' into slevenbits 2012-08-15 18:32:36 +01:00
Alexander Ljungberg b7ee0fe44d Merge branch 'master' into slevenbits 2012-08-15 13:39:09 +01:00
Alexander Ljungberg 0150271e67 Merge branch 'master' into slevenbits 2012-08-15 02:09:40 +01:00
Alexander Ljungberg e23ba0852b Merge branch 'master' of github.com:slevenbits/cappuccino into slevenbits 2012-08-11 19:36:01 +01:00
Alexander Ljungberg 7cae90f8f9 Merge branch 'master' into slevenbits 2012-08-11 19:35:39 +01:00
Aparajita Fishman 9e1d09909e Merge branch 'stringValue-fix' 2012-08-09 20:31:37 -07:00
Alexander Ljungberg 306f2c987c Merge branch 'master' of github.com:slevenbits/cappuccino into slevenbits 2012-08-10 03:55:23 +01:00
Alexander Ljungberg 42200ce567 Merge branch 'master' into slevenbits 2012-08-10 03:55:03 +01:00
Aparajita Fishman 79cd71d2ab Merge branch 'fix-xcc-warnings' 2012-08-09 12:17:52 -07:00
Aparajita Fishman 081cf61e68 Merge branch 'refs/heads/upstream' 2012-08-09 11:27:32 -07:00
Alexander Ljungberg ed0fd87646 Merge branch 'master' into slevenbits 2012-08-07 12:32:47 +01:00
Alexander Ljungberg 4136953752 Merge branch 'refs/heads/master' into slevenbits 2012-08-06 14:03:37 +01:00
Alexander Ljungberg e70430057e Merge branch 'master' of github.com:slevenbits/cappuccino into slevenbits 2012-08-05 12:39:19 +01:00
Alexander Ljungberg 8498e28b70 Merge branch 'master' into slevenbits 2012-08-05 12:37:55 +01:00
Eric Wong 7ad24efe4f Merge branch 'cpdecimalnumber-fix' 2012-08-05 10:10:40 +08:00
Alexander Ljungberg a055d6d97e Merge branch 'refs/heads/master' into slevenbits 2012-08-04 14:11:25 +01:00
Alexander Ljungberg 23ed09a84e Merge branch 'refs/heads/master' into slevenbits 2012-08-02 15:54:36 +01:00
Aparajita Fishman 8e6119000d Added CPViewController -isViewLoaded, fixed CPWindowController -setViewController to use that
Before this fix, CPWindowController -setViewController was unconditionally loading the view, which should not happen.
2012-07-26 06:39:31 -07:00
Alexander Ljungberg 1db154ac5b Merge branch 'refs/heads/master' into slevenbits 2012-07-26 13:34:45 +01:00
Alexander Ljungberg 7ab833495f Merge branch 'refs/heads/master' into slevenbits 2012-07-23 15:39:03 +02:00
Alexander Ljungberg 60a33b9592 Merge branch 'master' of github.com:slevenbits/cappuccino into slevenbits 2012-07-19 01:07:29 +01:00
Alexander Ljungberg 7429687932 Merge branch 'master' into slevenbits 2012-07-19 01:06:41 +01:00
Aparajita Fishman fe04cfbe1f Merge branch 'refs/heads/upstream' 2012-07-18 14:48:56 -07:00
Alexander Ljungberg d57f5427fb Merge branch 'master' into slevenbits 2012-07-18 19:23:05 +01:00
Aparajita Fishman 6537a44c02 Merge branch 'refs/heads/upstream' 2012-07-18 09:53:32 -07:00
Aparajita Fishman f8cc2eb670 Merge branch 'refs/heads/upstream' 2012-07-17 15:12:50 -07:00
Alexander Ljungberg c83b4bf3af Merge branch 'master' into slevenbits 2012-07-17 23:02:17 +01:00
Alexander Ljungberg 5c5d2e47a9 Merge branch 'master' into slevenbits 2012-07-17 21:11:45 +01:00
Alexander Ljungberg 9e20f209bf Merge branch 'master' of github.com:slevenbits/cappuccino into slevenbits 2012-07-16 03:17:39 +01:00
Alexander Ljungberg ce5c6d9b96 Merge branch 'master' into slevenbits 2012-07-16 03:17:12 +01:00
Aparajita Fishman c166a20b89 Merge branch 'dictionary-key-methods' 2012-07-15 09:28:15 -07:00
Alexander Ljungberg 1cbf927684 Merge branch 'master' of github.com:slevenbits/cappuccino into slevenbits 2012-07-14 14:13:05 +01:00
Alexander Ljungberg 9fdfc4025a Merge branch 'refs/heads/master' into slevenbits 2012-07-14 14:12:53 +01:00
Aparajita Fishman 4958b4c47b Merge branch 'master' of github.com:slevenbits/cappuccino 2012-07-13 21:05:36 -07:00
Aparajita Fishman fedb24c2f3 Merge branch 'text-size-theming' 2012-07-13 21:02:46 -07:00
Aparajita Fishman e61a2a296e Merge branch 'master' of github.com:cappuccino/cappuccino 2012-07-13 21:00:35 -07:00
Alexander Ljungberg 0e87659093 Merge branch 'refs/heads/master' into slevenbits 2012-07-13 15:35:29 +01:00
Alexander Ljungberg eb990b6d4f Merge branch 'refs/heads/master' into slevenbits 2012-07-13 11:38:49 +01:00
Aparajita Fishman 12ea224f21 Merge branch 'master' of github.com:cappuccino/cappuccino 2012-07-12 17:21:40 -07:00
Aparajita Fishman 98260630ac Merge branch 'master' of github.com:cappuccino/cappuccino 2012-07-12 15:17:06 -07:00
Aparajita Fishman ba7fa38924 Merge branch 'master' of github.com:cappuccino/cappuccino 2012-07-12 07:15:19 -07:00
Aparajita Fishman 744bbd15d7 Merge branch 'master' of github.com:cappuccino/cappuccino 2012-07-11 09:24:35 -07:00
Aparajita Fishman 61f683b2e3 Merge branch 'text-clip-fix' 2012-07-11 09:11:04 -07:00
Aparajita Fishman 49521b44fb Merge branch 'system-font' 2012-07-10 18:54:42 -07:00
Aparajita Fishman f76404ef5e Merge branch 'refs/heads/system-font' 2012-07-10 16:41:06 -07:00
Aparajita Fishman 4df0b7c940 Merge branch 'archive-formatter' 2012-07-09 21:31:09 -07:00
Aparajita Fishman 6cd2c96152 Merge branch 'system-font' 2012-07-09 16:50:55 -07:00
Aparajita Fishman 106e21b79c Merge branch 'system-font' 2012-07-09 15:33:34 -07:00
Alexander Ljungberg 970dc912cb Merge branch 'master' into slevenbits 2012-07-09 20:32:07 +01:00
Alexander Ljungberg 6f84440bcd Merge branch 'master' into slevenbits 2012-07-08 21:29:08 +01:00
Alexander Ljungberg 4f69d82a4e Merge branch 'master' into slevenbits 2012-07-08 14:13:37 +01:00
Aparajita Fishman b85e44098b Merge branch 'CPComboBox' 2012-07-06 08:51:19 -07:00
46 changed files with 2626 additions and 330 deletions
+1
View File
@@ -595,6 +595,7 @@ CPCriticalAlertStyle = 2;
frame.size = [self currentValueForThemeAttribute:@"size"];
_window = [[CPWindow alloc] initWithContentRect:frame styleMask:forceStyle || _defaultWindowStyle];
[_window setLevel:CPStatusWindowLevel];
if (_title)
[_window setTitle:_title];
+26 -6
View File
@@ -250,8 +250,13 @@ CPRunContinuesResponse = -1002;
_documentController = [CPDocumentController sharedDocumentController];
var needsUntitled = !!_documentController,
URLStrings = window.cpOpeningURLStrings && window.cpOpeningURLStrings(),
index = 0,
URLStrings = nil;
#if PLATFORM(DOM)
URLStrings = window.cpOpeningURLStrings && window.cpOpeningURLStrings();
#endif
var index = 0,
count = [URLStrings count];
for (; index < count; ++index)
@@ -1009,7 +1014,8 @@ CPRunContinuesResponse = -1002;
*/
- (CPArray)arguments
{
if (_fullArgsString !== window.location.hash)
// FIXME This should probably not access the window object #if !PLATFORM(DOM), but the unit tests rely on it.
if (window && window.location && _fullArgsString !== window.location.hash)
[self _reloadArguments];
return _args;
@@ -1036,8 +1042,9 @@ CPRunContinuesResponse = -1002;
if (!args || args.length == 0)
{
_args = [];
#if PLATFORM(DOM)
window.location.hash = @"#";
#endif
return;
}
@@ -1052,12 +1059,15 @@ CPRunContinuesResponse = -1002;
var hash = [toEncode componentsJoinedByString:@"/"];
#if PLATFORM(DOM)
window.location.hash = @"#" + hash;
#endif
}
- (void)_reloadArguments
{
_fullArgsString = window.location.hash;
// FIXME This should probably not access the window object #if !PLATFORM(DOM), but the unit tests rely on it.
_fullArgsString = (window && window.location) ? window.location.hash : "";
if (_fullArgsString.length)
{
@@ -1218,7 +1228,17 @@ function CPApplicationMain(args, namedArgs)
#if PLATFORM(DOM)
// hook to allow recorder, etc to manipulate things before starting AppKit
if (window.parent !== window && typeof window.parent._childAppIsStarting === "function")
window.parent._childAppIsStarting(window);
{
try
{
window.parent._childAppIsStarting(window);
}
catch(err)
{
// This could happen if we're in an iframe without access to the parent frame.
CPLog.warn("Failed to call parent frame's _childAppIsStarting().");
}
}
#endif
var mainBundle = [CPBundle mainBundle],
+10
View File
@@ -332,6 +332,16 @@ CPBelowBottom = 6;
[_titleView setFont:aFont];
}
/*!
Return the text field used to display the receiver's title.
This is the Cappuccino equivalent to the `titleCell` method.
*/
- (CPTextField)titleView
{
return _titleView;
}
- (void)_manageTitlePositioning
{
if (_titlePosition == CPNoTitle)
+86 -1
View File
@@ -83,7 +83,8 @@ CPCanvasParentDrawErrorsOnMovementBug = 1 << 0;
var USER_AGENT = "",
PLATFORM_ENGINE = CPUnknownBrowserEngine,
PLATFORM_FEATURES = 0,
PLATFORM_BUGS = 0;
PLATFORM_BUGS = 0,
PLATFORM_STYLE_JS_PROPERTIES = {};
// default these features to true
@@ -273,3 +274,87 @@ else
CPUndoKeyEquivalentModifierMask = CPControlKeyMask;
CPRedoKeyEquivalentModifierMask = CPControlKeyMask;
}
/*!
Return the properly prefixed JS property for the given name. E.g. in a webkit browser,
CPBrowserStyleProperty('transition') -> WebkitTransition
While technically not a style property, style related event handler names are also supported.
CPBrowserStyleProperty('transitionend') -> 'webkitTransitionEnd'
CSS is only available in platform(dom), so don't rely too heavily on it.
*/
function CPBrowserStyleProperty(aProperty)
{
var lowerProperty = aProperty.toLowerCase();
if (PLATFORM_STYLE_JS_PROPERTIES[lowerProperty] === undefined)
{
var r = nil;
#if PLATFORM(DOM)
var testElement = document.createElement('div');
switch (lowerProperty)
{
case 'transitionend':
var candidates = {
'WebkitTransition' : 'webkitTransitionEnd',
'MozTransition' : 'transitionend',
'OTransition' : 'oTransitionEnd',
'msTransition' : 'MSTransitionEnd',
'transition' : 'transitionend'
};
r = candidates[PLATFORM_STYLE_JS_PROPERTIES['transition']] || nil;
break;
default:
var prefixes = ["Webkit", "Moz", "O", "ms"],
capProperty = [aProperty capitalizedString];
for (var i = 0; i < prefixes.length; i++)
{
if (prefixes[i] + capProperty in testElement.style)
{
r = prefixes[i] + capProperty;
break;
}
}
if (!r && lowerProperty in testElement.style)
r = lowerProperty;
break;
}
#endif
PLATFORM_STYLE_JS_PROPERTIES[lowerProperty] = r;
}
return PLATFORM_STYLE_JS_PROPERTIES[lowerProperty];
}
function CPBrowserCSSProperty(aProperty)
{
var browserProperty = CPBrowserStyleProperty(aProperty);
if (!browserProperty)
return nil;
var prefixes = {
'Webkit': '-webkit-',
'Moz': '-moz-',
'O': '-o-',
'ms': '-ms-'
};
for (var prefix in prefixes)
{
if (browserProperty.substring(0, prefix.length) == prefix)
{
return prefixes[prefix] + browserProperty.substring(prefix.length).toLowerCase();
}
}
return browserProperty.toLowerCase();
}
+7 -1
View File
@@ -99,6 +99,9 @@ var CPSharedFontManager = nil,
{
if (!_availableFonts)
{
_availableFonts = [];
#if PLATFORM(DOM)
_CPFontDetectSpan = document.createElement("span");
_CPFontDetectSpan.fontSize = "24px";
_CPFontDetectSpan.appendChild(document.createTextNode("mmmmmmmmmml"));
@@ -110,13 +113,16 @@ var CPSharedFontManager = nil,
_CPFontDetectReferenceFonts = _CPFontDetectPickTwoDifferentFonts(["monospace", "serif", "sans-serif", "cursive"]);
_availableFonts = [];
for (var i = 0; i < _CPFontDetectAllFonts.length; i++)
{
var available = _CPFontDetectFontAvailable(_CPFontDetectAllFonts[i]);
if (available)
_availableFonts.push(_CPFontDetectAllFonts[i]);
}
#else
// If there's no font detection, just assume all fonts are available.
_availableFonts = _CPFontDetectAllFonts;
#endif
}
return _availableFonts;
}
+8 -1
View File
@@ -131,7 +131,7 @@ var CPBindingOperationAnd = 0,
if (options)
[_info setObject:options forKey:CPOptionsKey];
[self _updatePlaceholdersWithOptions:options];
[self _updatePlaceholdersWithOptions:options forBinding:aName];
[aDestination addObserver:self forKeyPath:aKeyPath options:CPKeyValueObservingOptionNew context:aBinding];
@@ -321,6 +321,11 @@ var CPBindingOperationAnd = 0,
}
}
- (void)_updatePlaceholdersWithOptions:(CPDictionary)options forBinding:(CPString)aBinding
{
[self _updatePlaceholdersWithOptions:options];
}
- (void)_placeholderForMarker:aMarker
{
var placeholder = _placeholderForMarker[aMarker];
@@ -564,6 +569,8 @@ CPFontNameBinding = @"fontName";
CPFontBoldBinding = @"fontBold";
CPHiddenBinding = @"hidden";
CPFilterPredicateBinding = @"filterPredicate";
CPMaxValueBinding = @"maxValue";
CPMinValueBinding = @"minValue";
CPPredicateBinding = @"predicate";
CPSelectedIndexBinding = @"selectedIndex";
CPSelectedLabelBinding = @"selectedLabel";
+8 -1
View File
@@ -234,7 +234,7 @@ Set the behavior of the CPPopover. It can be:
[_attachedWindow setContentView:[_contentViewController view]];
[_attachedWindow positionRelativeToRect:positioningRect ofView:positioningView preferredEdge:preferredEdge];
if (_implementedDelegateMethods & CPPopoverDelegate_popover_didShow_)
if (!_animates && _implementedDelegateMethods & CPPopoverDelegate_popover_didShow_)
[_delegate popoverDidShow:self];
}
@@ -311,6 +311,13 @@ Set the behavior of the CPPopover. It can be:
[_delegate popoverDidClose:self];
}
/*! @ignore */
- (void)attachedWindowDidShow:(_CPAttachedWindow)anAttachedWindow
{
if (_implementedDelegateMethods & CPPopoverDelegate_popover_didShow_)
[_delegate popoverDidShow:self];
}
#pragma mark -
#pragma mark Notifications
+1 -1
View File
@@ -213,7 +213,7 @@ var CPScrollerStyleGlobal = CPScrollerStyleOverlay,
@param aStyle the scroller style to set all scroller views to use (CPScrollerStyleLegacy or CPScrollerStyleOverlay)
*/
+ (int)setGlobalScrollerStyle:(int)aStyle
+ (void)setGlobalScrollerStyle:(int)aStyle
{
CPScrollerStyleGlobal = aStyle;
[[CPNotificationCenter defaultCenter] postNotificationName:CPScrollerStyleGlobalChangeNotification object:nil];
+35 -2
View File
@@ -76,6 +76,22 @@
return [CPStepper stepperWithInitialValue:0.0 minValue:0.0 maxValue:59.0];
}
+ (Class)_binderClassForBinding:(CPString)theBinding
{
if (theBinding == CPValueBinding || theBinding == CPMinValueBinding || theBinding == CPMaxValueBinding)
return [_CPStepperValueBinder class];
return [super _binderClassForBinding:theBinding];
}
- (id)_replacementKeyPathForBinding:(CPString)aBinding
{
if (aBinding == CPValueBinding)
return @"doubleValue";
return [super _replacementKeyPathForBinding:aBinding];
}
/*!
Initializes a CPStepper.
@param aFrame the frame of the control
@@ -211,8 +227,7 @@
else
[self setDoubleValue:([self doubleValue] - _increment)];
if (_target && _action && [_target respondsToSelector:_action])
[self sendAction:_action to:_target];
[self sendAction:[self action] to:[self target]];
}
/*!
@@ -250,6 +265,24 @@
@end
@implementation _CPStepperValueBinder : CPBinder
{
}
- (void)_updatePlaceholdersWithOptions:(CPDictionary)options forBinding:(CPString)aBinding
{
var placeholder = (aBinding == CPMaxValueBinding) ? [_source maxValue] : [_source minValue];
[super _updatePlaceholdersWithOptions:options];
[self _setPlaceholder:placeholder forMarker:CPMultipleValuesMarker isDefault:YES];
[self _setPlaceholder:placeholder forMarker:CPNoSelectionMarker isDefault:YES];
[self _setPlaceholder:placeholder forMarker:CPNotApplicableMarker isDefault:YES];
[self _setPlaceholder:placeholder forMarker:CPNullMarker isDefault:YES];
}
@end
var CPStepperMinValue = @"CPStepperMinValue",
CPStepperMaxValue = @"CPStepperMaxValue",
CPStepperValueWraps = @"CPStepperValueWraps",
+25 -16
View File
@@ -88,9 +88,6 @@ var CPTabViewDidSelectTabViewItemSelector = 1,
_box = [[CPBox alloc] initWithFrame:[self bounds]];
[self setBackgroundColor:[CPColor colorWithCalibratedWhite:0.95 alpha:1.0]];
[_box setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[_tabs setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin];
[self addSubview:_box];
[self addSubview:_tabs];
}
@@ -343,21 +340,9 @@ var CPTabViewDidSelectTabViewItemSelector = 1,
_type = aTabViewType;
if (_type !== CPTopTabsBezelBorder && _type !== CPBottomTabsBezelBorder)
{
[_box setFrame:[self bounds]];
[_tabs removeFromSuperview];
}
else
{
var aFrame = [self frame],
segmentedHeight = _CGRectGetHeight([_tabs frame]),
origin = _type === CPTopTabsBezelBorder ? segmentedHeight / 2 : 0;
[_box setFrame:_CGRectMake(0, origin, _CGRectGetWidth(aFrame),
_CGRectGetHeight(aFrame) - segmentedHeight / 2)];
[self addSubview:_tabs];
}
switch (_type)
{
@@ -373,6 +358,29 @@ var CPTabViewDidSelectTabViewItemSelector = 1,
[_box setBorderType:CPNoBorder];
break;
}
[self setNeedsLayout];
}
- (void)layoutSubviews
{
// Even if CPTabView's autoresizesSubviews is NO, _tabs and _box has to be laid out.
// This means we can't rely on autoresize masks.
if (_type !== CPTopTabsBezelBorder && _type !== CPBottomTabsBezelBorder)
{
[_box setFrame:[self bounds]];
}
else
{
var aFrame = [self frame],
segmentedHeight = _CGRectGetHeight([_tabs frame]),
origin = _type === CPTopTabsBezelBorder ? segmentedHeight / 2 : 0;
[_box setFrame:_CGRectMake(0, origin, _CGRectGetWidth(aFrame),
_CGRectGetHeight(aFrame) - segmentedHeight / 2)];
[self _repositionTabs];
}
}
/*!
@@ -497,7 +505,6 @@ var CPTabViewItemsKey = "CPTabViewItemsKey",
[_items makeObjectsPerformSelector:@selector(_setTabView:) withObject:self];
[self _updateItems];
[self _repositionTabs];
[self setDelegate:[aCoder decodeObjectForKey:CPTabViewDelegateKey]];
@@ -506,6 +513,8 @@ var CPTabViewItemsKey = "CPTabViewItemsKey",
[self selectTabViewItem:selected];
[self setTabViewType:[aCoder decodeIntForKey:CPTabViewTypeKey]];
[self setNeedsLayout];
}
return self;
+1 -1
View File
@@ -138,7 +138,7 @@ CPPressedTab = 2;
_view = aView;
if ([_tabView selectedTabViewItem] == self)
[_tabView _setContentViewForItem:self];
[_tabView _setContentViewFromItem:self];
}
/*!
+24 -7
View File
@@ -308,6 +308,11 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
if (shouldBeEditable)
_isSelectable = YES;
if (_isEditable)
[self setThemeState:CPThemeStateEditable];
else
[self unsetThemeState:CPThemeStateEditable];
// We only allow first responder status if the field is editable and enabled.
if (!shouldBeEditable && [[self window] firstResponder] === self)
[[self window] makeFirstResponder:nil];
@@ -490,13 +495,13 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
- (BOOL)becomeFirstResponder
{
#if PLATFORM(DOM)
// FIXME Why do we care about who's the first responder in a different window?
if (CPTextFieldInputOwner && [CPTextFieldInputOwner window] !== [self window])
[[CPTextFieldInputOwner window] makeFirstResponder:nil];
#endif
// As long as we are the first responder we need to monitor the key status of our window.
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidResignKey:) name:CPWindowDidResignKeyNotification object:[self window]];
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidBecomeKey:) name:CPWindowDidBecomeKeyNotification object:[self window]];
[self _setObserveWindowKeyNotifications:YES];
_isEditing = NO;
@@ -613,10 +618,6 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
/* @ignore */
- (BOOL)resignFirstResponder
{
// When we are no longer the first responder we don't worry about the key status of our window anymore.
[[CPNotificationCenter defaultCenter] removeObserver:self name:CPWindowDidResignKeyNotification object:[self window]];
[[CPNotificationCenter defaultCenter] removeObserver:self name:CPWindowDidBecomeKeyNotification object:[self window]];
#if PLATFORM(DOM)
var element = [self _inputElement],
@@ -638,6 +639,9 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
#endif
// When we are no longer the first responder we don't worry about the key status of our window anymore.
[self _setObserveWindowKeyNotifications:NO];
[self _resignFirstKeyResponder];
_isEditing = NO;
@@ -661,7 +665,6 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
_willBecomeFirstResponderByClick = NO;
[self _updatePlaceholderState];
[self setNeedsLayout];
#if PLATFORM(DOM)
@@ -696,6 +699,20 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
#endif
}
- (void)_setObserveWindowKeyNotifications:(BOOL)shouldObserve
{
if (shouldObserve)
{
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidResignKey:) name:CPWindowDidResignKeyNotification object:[self window]];
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidBecomeKey:) name:CPWindowDidBecomeKeyNotification object:[self window]];
}
else
{
[[CPNotificationCenter defaultCenter] removeObserver:self name:CPWindowDidResignKeyNotification object:[self window]];
[[CPNotificationCenter defaultCenter] removeObserver:self name:CPWindowDidBecomeKeyNotification object:[self window]];
}
}
- (void)_windowDidResignKey:(CPNotification)aNotification
{
if (![[self window] isKeyWindow])
+123 -38
View File
@@ -138,18 +138,23 @@ var CPScrollDestinationNone = 0,
return _autocompleteMenu;
}
- (void)_complete:(_CPAutocompleteMenu)anAutocompleteMenu
{
[self _autocompleteWithEvent:nil];
}
- (void)_autocompleteWithEvent:(CPEvent)anEvent
{
if (![self _inputElement].value && (![_autocompleteMenu contentArray] || ![self hasThemeState:CPThemeStateAutocompleting]))
if (![self _editorValue] && (![_autocompleteMenu contentArray] || ![self hasThemeState:CPThemeStateAutocompleting]))
return;
[self _hideCompletions];
var token = [_autocompleteMenu selectedItem],
shouldRemoveLastObject = token !== @"" && [self _inputElement].value !== @"";
shouldRemoveLastObject = token !== @"" && [self _editorValue] !== @"";
if (!token)
token = [self _inputElement].value;
token = [self _editorValue];
// 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 fall back to the normal behavior, resigning first
@@ -307,9 +312,22 @@ var CPScrollDestinationNone = 0,
- (BOOL)becomeFirstResponder
{
#if PLATFORM(DOM)
if (CPTokenFieldInputOwner && [CPTokenFieldInputOwner window] !== [self window])
[[CPTokenFieldInputOwner window] makeFirstResponder:nil];
#endif
// As long as we are the first responder we need to monitor the key status of our window.
[self _setObserveWindowKeyNotifications:YES];
if ([[self window] isKeyWindow])
[self _becomeFirstKeyResponder];
return YES;
}
- (void)_becomeFirstKeyResponder
{
[self setThemeState:CPThemeStateEditing];
[self _updatePlaceholderState];
@@ -368,8 +386,6 @@ var CPScrollDestinationNone = 0,
}
#endif
return YES;
}
- (BOOL)resignFirstResponder
@@ -377,9 +393,31 @@ var CPScrollDestinationNone = 0,
if (_preventResign)
return NO;
[self _autocomplete];
// From CPTextField superclass.
[self _setObserveWindowKeyNotifications:NO];
[self _resignFirstKeyResponder];
if (_shouldNotifyTarget)
{
_shouldNotifyTarget = NO;
[self textDidEndEditing:[CPNotification notificationWithName:CPControlTextDidEndEditingNotification object:self userInfo:nil]];
if ([self sendsActionOnEndEditing])
[self sendAction:[self action] to:[self target]];
}
return YES;
}
- (void)_resignFirstKeyResponder
{
[self unsetThemeState:CPThemeStateEditing];
[self _autocomplete];
[self _updatePlaceholderState];
[self setNeedsLayout];
#if PLATFORM(DOM)
@@ -409,21 +447,6 @@ var CPScrollDestinationNone = 0,
}
#endif
[self _updatePlaceholderState];
[self setNeedsLayout];
if (_shouldNotifyTarget)
{
_shouldNotifyTarget = NO;
[self textDidEndEditing:[CPNotification notificationWithName:CPControlTextDidEndEditingNotification object:self userInfo:nil]];
if ([self sendsActionOnEndEditing])
[self sendAction:[self action] to:[self target]];
}
return YES;
}
- (void)mouseDown:(CPEvent)anEvent
@@ -492,9 +515,9 @@ var CPScrollDestinationNone = 0,
#if PLATFORM(DOM)
if ([self _inputElement].value != @"")
if ([self _editorValue])
{
var token = [self _representedObjectForEditingString:[self _inputElement].value];
var token = [self _representedObjectForEditingString:[self _editorValue]];
[objectValue insertObject:token atIndex:_selectedRange.location];
}
@@ -547,6 +570,7 @@ var CPScrollDestinationNone = 0,
[newToken setTokenField:self];
[newToken setRepresentedObject:tokenObject];
[newToken setStringValue:tokenValue];
[newToken setEditable:[self isEditable]];
[contentView addSubview:newToken];
}
@@ -592,6 +616,13 @@ var CPScrollDestinationNone = 0,
}
}
- (void)setEditable:(BOOL)shouldBeEditable
{
[super setEditable:shouldBeEditable];
[[self _tokens] makeObjectsPerformSelector:@selector(setEditable:) withObject:shouldBeEditable];
}
- (void)sendAction:(SEL)anAction to:(id)anObject
{
_shouldNotifyTarget = NO;
@@ -629,10 +660,13 @@ var CPScrollDestinationNone = 0,
if (CPTokenFieldInputOwner && CPTokenFieldInputOwner._preventResign)
return false;
if (!CPTokenFieldInputResigning && !CPTokenFieldFocusInput)
if (!CPTokenFieldInputResigning && [[CPTokenFieldInputOwner window] isKeyWindow])
{
[[CPTokenFieldInputOwner window] makeFirstResponder:nil];
return;
// If we lost focus somehow but we're not resigning and we're still in the key window, we'll need to take it back.
window.setTimeout(function()
{
CPTokenFieldDOMInputElement.focus();
}, 0.0);
}
CPTokenFieldHandleBlur(anEvent, CPTokenFieldDOMInputElement);
@@ -668,6 +702,13 @@ var CPScrollDestinationNone = 0,
}
#endif
- (CPString)_editorValue
{
if (![self hasThemeState:CPThemeStateEditing])
return @"";
return [self _inputElement].value;
}
- (void)moveUp:(id)sender
{
[[self _autocompleteMenu] selectPrevious];
@@ -747,7 +788,7 @@ var CPScrollDestinationNone = 0,
- (void)moveLeft:(id)sender
{
// Left arrow
if ((_selectedRange.location > 0 || _selectedRange.length) && CPTokenFieldDOMInputElement.value == "")
if ((_selectedRange.location > 0 || _selectedRange.length) && [self _editorValue] == "")
{
if (_selectedRange.length)
// Simply collapse the range.
@@ -766,7 +807,7 @@ var CPScrollDestinationNone = 0,
- (void)moveLeftAndModifySelection:(id)sender
{
if (_selectedRange.location > 0 && CPTokenFieldDOMInputElement.value == "")
if (_selectedRange.location > 0 && [self _editorValue] == "")
{
_selectedRange.location--;
// When shift is depressed, select the next token backwards.
@@ -784,7 +825,7 @@ var CPScrollDestinationNone = 0,
- (void)moveRight:(id)sender
{
// Right arrow
if ((_selectedRange.location < [[self _tokens] count] || _selectedRange.length) && CPTokenFieldDOMInputElement.value == "")
if ((_selectedRange.location < [[self _tokens] count] || _selectedRange.length) && [self _editorValue] == "")
{
if (_selectedRange.length)
{
@@ -810,7 +851,7 @@ var CPScrollDestinationNone = 0,
- (void)moveRightAndModifySelection:(id)sender
{
if (_CPMaxRange(_selectedRange) < [[self _tokens] count] && CPTokenFieldDOMInputElement.value == "")
if (_CPMaxRange(_selectedRange) < [[self _tokens] count] && [self _editorValue] == "")
{
// Leave the selection location in place but include the next token to the right.
_selectedRange.length++;
@@ -828,7 +869,7 @@ var CPScrollDestinationNone = 0,
{
// TODO Even if the editor isn't empty you should be able to delete the previous token by placing the cursor
// at the beginning of the editor.
if (CPTokenFieldDOMInputElement.value == @"")
if ([self _editorValue] == @"")
{
[self _hideCompletions];
@@ -854,7 +895,7 @@ var CPScrollDestinationNone = 0,
{
// TODO Even if the editor isn't empty you should be able to delete the next token by placing the cursor
// at the end of the editor.
if (CPTokenFieldDOMInputElement.value == @"")
if ([self _editorValue] == @"")
{
// Delete forward if nothing is selected, else delete all selected.
[self _hideCompletions];
@@ -970,8 +1011,7 @@ var CPScrollDestinationNone = 0,
var frame = [self frame],
contentView = [_tokenScrollView documentView],
tokens = [self _tokens],
shouldShowAutoComplete = [self hasThemeState:CPThemeStateAutocompleting];
tokens = [self _tokens];
// Hack to make sure we are handling an array
if (![tokens isKindOfClass:[CPArray class]])
@@ -989,6 +1029,9 @@ var CPScrollDestinationNone = 0,
lineHeight = [font defaultLineHeightForFont],
editorInset = [self currentValueForThemeAttribute:@"editor-inset"];
// Put half a spacing above the tokens.
offset.y += CEIL(spaceBetweenTokens.height / 2.0);
// Get the height of a typical token, or a token token if you will.
[tokenToken sizeToFit];
@@ -1076,12 +1119,19 @@ var CPScrollDestinationNone = 0,
if (isEditing && _selectedRange.length)
{
_inputFrame = nil;
[self _inputElement].style.left = "-10000px";
[self _inputElement].focus();
var inputElement = [self _inputElement];
inputElement.style.display = "none";
}
else if (isEditing)
{
var inputElement = [self _inputElement];
inputElement.style.display = "block";
if (document.activeElement !== inputElement)
inputElement.focus();
}
// Trim off any excess height downwards (in case we shrank).
var scrollHeight = offset.y + tokenHeight + CEIL(spaceBetweenTokens.height / 2.0);
var scrollHeight = offset.y + tokenHeight;
if (_CGRectGetHeight([contentView bounds]) > scrollHeight)
[contentView setFrameSize:_CGSizeMake(_CGRectGetWidth([_tokenScrollView bounds]), scrollHeight)];
@@ -1249,6 +1299,11 @@ var CPScrollDestinationNone = 0,
return "tokenfield-token";
}
- (BOOL)acceptsFirstResponder
{
return NO;
}
- (id)initWithFrame:(CPRect)frame
{
if (self = [super initWithFrame:frame])
@@ -1284,6 +1339,34 @@ var CPScrollDestinationNone = 0,
_representedObject = representedObject;
}
- (void)setEditable:(BOOL)shouldBeEditable
{
[super setEditable:shouldBeEditable];
[self setNeedsLayout];
}
- (BOOL)setThemeState:(CPThemeState)aState
{
var r = [super setThemeState:aState];
// Share hover state with the delete button.
if (r && aState === CPThemeStateHovered)
[_deleteButton setThemeState:aState];
return r;
}
- (BOOL)unsetThemeState:(CPThemeState)aState
{
var r = [super unsetThemeState:aState];
// Share hover state with the delete button.
if (r && aState === CPThemeStateHovered)
[_deleteButton unsetThemeState:aState];
return r;
}
- (CGSize)_minimumFrameSize
{
var size = _CGSizeMakeZero(),
@@ -1309,6 +1392,7 @@ var CPScrollDestinationNone = 0,
{
[_deleteButton setTarget:self];
[_deleteButton setAction:@selector(_delete:)];
[_deleteButton setEnabled:[self isEditable]];
var frame = [bezelView frame],
buttonOffset = [_deleteButton currentValueForThemeAttribute:@"offset"],
@@ -1330,7 +1414,8 @@ var CPScrollDestinationNone = 0,
- (void)_delete:(id)sender
{
[_tokenField _deleteToken:self];
if ([self isEditable])
[_tokenField _deleteToken:self];
}
@end
+9 -8
View File
@@ -247,7 +247,7 @@ var CPToolbarsByIdentifier = nil,
_window = aWindow;
if (_window)
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_autovalidate) name:_CPWindowDidChangeFirstResponderNotification object:aWindow];
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_autoValidateVisibleItems) name:_CPWindowDidChangeFirstResponderNotification object:aWindow];
}
/*!
@@ -400,14 +400,15 @@ var CPToolbarsByIdentifier = nil,
*/
- (void)validateVisibleItems
{
var toolbarItems = [self visibleItems],
count = [toolbarItems count];
while (count--)
[toolbarItems[count] validate];
[self _validateVisibleItems:NO]
}
- (void)_autovalidate
- (void)_autoValidateVisibleItems
{
[self _validateVisibleItems:YES]
}
- (void)_validateVisibleItems:(BOOL)isAutovalidation
{
var toolbarItems = [self visibleItems],
count = [toolbarItems count];
@@ -415,7 +416,7 @@ var CPToolbarsByIdentifier = nil,
while (count--)
{
var item = [toolbarItems objectAtIndex:count];
if ([item autovalidates])
if (!isAutovalidation || [item autovalidates])
[item validate];
}
}
+23 -3
View File
@@ -1673,11 +1673,29 @@ CPTexturedBackgroundWindowMask
[self selectPreviousKeyView:self];
else
[self selectNextKeyView:self];
#if PLATFORM(DOM)
// Make sure the browser doesn't try to do its own tab handling.
// This is important or the browser might blur the shared text field or token field input field,
// even that we just moved it to a new first responder.
[[[anEvent window] platformWindow] _propagateCurrentDOMEvent:NO]
#endif
return;
}
else if ([anEvent charactersIgnoringModifiers] === CPBackTabCharacter)
return [self selectPreviousKeyView:self];
{
var didTabBack = [self selectPreviousKeyView:self];
if (didTabBack)
{
#if PLATFORM(DOM)
// Make sure the browser doesn't try to do its own tab handling.
// This is important or the browser might blur the shared text field or token field input field,
// even that we just moved it to a new first responder.
[[[anEvent window] platformWindow] _propagateCurrentDOMEvent:NO]
#endif
}
return didTabBack;
}
[[self firstResponder] keyDown:anEvent];
@@ -1838,7 +1856,9 @@ CPTexturedBackgroundWindowMask
*/
- (BOOL)canBecomeKeyWindow
{
return YES;
// In Cocoa only resizable or titled windows return YES here by default. But the main browser window in Cappuccino
// doesn't have these masks even that it's both titled and resizable, so we return YES when isFullPlatformWindow too.
return (_styleMask & CPTitledWindowMask) || (_styleMask & CPResizableWindowMask) || [self isFullPlatformWindow];
}
/*!
+23 -12
View File
@@ -53,15 +53,20 @@ var _CPAttachedWindowViewDefaultCursorSize = CGSizeMake(16, 10),
*/
- (CGRect)contentRectForFrameRect:(CGRect)aFrameRect
{
var contentRect = CGRectMakeCopy(aFrameRect);
var contentRect = CGRectMakeCopy(aFrameRect),
modifierX = 16,
modifierY = 19;
// @todo change border art and remove this pixel perfect adaptation
// return CGRectInset(contentRect, 20, 20);
//
// @comment: If we use this, each time we open the popover, the content
// view is reduced a little over and over
// return CGRectInset(contentRect, modifierX, modifierY);
contentRect.origin.x += 18;
contentRect.origin.y += 17;
contentRect.size.width -= 35;
contentRect.size.height -= 37;
contentRect.origin.x += modifierX;
contentRect.origin.y += modifierY;
contentRect.size.width -= modifierX * 2;
contentRect.size.height -= modifierY * 2;
return contentRect;
}
@@ -73,15 +78,21 @@ var _CPAttachedWindowViewDefaultCursorSize = CGSizeMake(16, 10),
*/
+ (CGRect)frameRectForContentRect:(CGRect)aContentRect
{
var frameRect = CGRectMakeCopy(aContentRect);
var frameRect = CGRectMakeCopy(aContentRect),
modifierX = 16,
modifierY = 19;
// @todo change border art and remove this pixel perfect adaptation
//return CGRectOffset(frameRect, 20, 20);
// @comment: If we use this, each time we open the popover, the content
//
// view is reduced a little over and over
// return CGRectOffset(frameRect, modifierX, modifierY);
frameRect.origin.x -= modifierX;
frameRect.origin.y -= modifierY;
frameRect.size.width += modifierX * 2;
frameRect.size.height += modifierY * 2;
frameRect.origin.x -= 18;
frameRect.origin.y -= 17;
frameRect.size.width += 35;
frameRect.size.height += 37;
return frameRect;
}
-32
View File
@@ -152,38 +152,6 @@ var STANDARD_GRADIENT_HEIGHT = 41.0;
return _CPStandardWindowViewDividerBackgroundColor;
}
- (CGRect)contentRectForFrameRect:(CGRect)aFrameRect
{
var contentRect = [[self class] contentRectForFrameRect:aFrameRect],
theToolbar = [[self window] toolbar];
if ([theToolbar isVisible])
{
var toolbarHeight = CGRectGetHeight([[theToolbar _toolbarView] frame]);
contentRect.origin.y += toolbarHeight;
contentRect.size.height -= toolbarHeight;
}
return contentRect;
}
- (CGRect)frameRectForContentRect:(CGRect)aContentRect
{
var frameRect = [[self class] frameRectForContentRect:aContentRect],
theToolbar = [[self window] toolbar];
if ([theToolbar isVisible])
{
var toolbarHeight = CGRectGetHeight([[theToolbar _toolbarView] frame]);
frameRect.origin.y -= toolbarHeight;
frameRect.size.height += toolbarHeight;
}
return frameRect;
}
- (id)initWithFrame:(CPRect)aFrame styleMask:(unsigned)aStyleMask
{
self = [super initWithFrame:aFrame styleMask:aStyleMask];
+24 -2
View File
@@ -76,12 +76,34 @@ var _CPWindowViewResizeIndicatorImage = nil;
- (CGRect)contentRectForFrameRect:(CGRect)aFrameRect
{
return [[self class] contentRectForFrameRect:aFrameRect];
var contentRect = [[self class] contentRectForFrameRect:aFrameRect],
theToolbar = [[self window] toolbar];
if ([theToolbar isVisible])
{
var toolbarHeight = CGRectGetHeight([[theToolbar _toolbarView] frame]);
contentRect.origin.y += toolbarHeight;
contentRect.size.height -= toolbarHeight;
}
return contentRect;
}
- (CGRect)frameRectForContentRect:(CGRect)aContentRect
{
return [[self class] frameRectForContentRect:aContentRect];
var frameRect = [[self class] frameRectForContentRect:aContentRect],
theToolbar = [[self window] toolbar];
if ([theToolbar isVisible])
{
var toolbarHeight = CGRectGetHeight([[theToolbar _toolbarView] frame]);
frameRect.origin.y -= toolbarHeight;
frameRect.size.height += toolbarHeight;
}
return frameRect;
}
- (id)initWithFrame:(CPRect)aFrame styleMask:(unsigned)aStyleMask
+1 -1
View File
@@ -285,7 +285,7 @@
// Change of document means toolbar items may no longer make sense.
// FIXME: DOCUMENT ARCHITECTURE Should we setToolbar: as well?
[[[self window] toolbar] validateVisibleItems];
[[[self window] toolbar] _autoValidateVisibleItems];
}
- (void)setSupportsMultipleDocuments:(BOOL)shouldSupportMultipleDocuments
+9 -8
View File
@@ -1028,7 +1028,7 @@ var themedButtonValues = nil,
overrides =
[
[@"bezel-inset", CGInsetMakeZero()],
[@"editor-inset", CGInsetMake(2.0, 0.0, 0.0, 0.0)],
[@"editor-inset", CGInsetMake(3.0, 0.0, 0.0, 0.0)],
// Non-bezeled token field with tokens
[@"content-inset", CGInsetMake(6.0, 8.0, 4.0, 8.0)],
@@ -1037,7 +1037,7 @@ var themedButtonValues = nil,
[@"content-inset", CGInsetMake(7.0, 8.0, 6.0, 8.0), CPTextFieldStatePlaceholder],
// Bezeled token field with tokens
[@"content-inset", CGInsetMake(6.0, 5.0, 4.0, 5.0), CPThemeStateBezeled],
[@"content-inset", CGInsetMake(5.0, 5.0, 4.0, 5.0), CPThemeStateBezeled],
// Bezeled token field with no tokens
[@"content-inset", CGInsetMake(8.0, 8.0, 7.0, 8.0), CPThemeStateBezeled | CPTextFieldStatePlaceholder]
@@ -1089,7 +1089,7 @@ var themedButtonValues = nil,
[@"text-color", textHighlightedColor, CPThemeStateHighlighted],
[@"bezel-inset", CGInsetMakeZero(), CPThemeStateBezeled],
[@"content-inset", CGInsetMake(2.0, 22.0, 2.0, 15.0), CPThemeStateBezeled],
[@"content-inset", CGInsetMake(2.0, 20.0, 2.0, 20.0), CPThemeStateBezeled],
// Minimum height == maximum height since tokens are fixed height.
[@"min-size", CGSizeMake(0.0, 19.0)],
@@ -1112,16 +1112,17 @@ var themedButtonValues = nil,
themeValues =
[
[@"bezel-color", bezelColor, CPThemeStateBordered],
[@"bezel-color", bezelHighlightedColor, CPThemeStateBordered | CPThemeStateHighlighted],
[@"bezel-color", bezelColor, CPThemeStateBordered | CPThemeStateHovered],
[@"bezel-color", [bezelColor colorWithAlphaComponent:0], CPThemeStateBordered | CPThemeStateDisabled],
[@"bezel-color", bezelHighlightedColor, CPThemeStateBordered | CPThemeStateHighlighted],
[@"min-size", CGSizeMake(8.0, 8.0)],
[@"max-size", CGSizeMake(8.0, 8.0)],
[@"bezel-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateBordered],
[@"bezel-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateBordered | CPThemeStateHighlighted],
[@"bezel-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateBordered],
[@"bezel-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateBordered | CPThemeStateHighlighted],
[@"offset", CGPointMake(17, 6), CPThemeStateBordered]
[@"offset", CGPointMake(17, 6), CPThemeStateBordered]
];
[self registerThemeValues:themeValues forView:button];
+34 -20
View File
@@ -31,7 +31,8 @@ CPPopoverAppearanceMinimal = 0;
CPPopoverAppearanceHUD = 1;
var _CPAttachedWindow_attachedWindowShouldClose_ = 1 << 0,
_CPAttachedWindow_attachedWindowDidClose_ = 1 << 1;
_CPAttachedWindow_attachedWindowDidClose_ = 1 << 1,
_CPAttachedWindow_attachedWindowDidShow_ = 1 << 2;
/*!
@@ -133,7 +134,7 @@ var _CPAttachedWindow_attachedWindowShouldClose_ = 1 << 0,
[self setMovableByWindowBackground:YES];
[self setHasShadow:NO];
[self setCSS3Property:@"TransitionProperty" value:@"-webkit-transform, opacity"];
[self setCSS3Property:@"TransitionProperty" value:CPBrowserCSSProperty('transform') + @", opacity"];
[_windowView setNeedsDisplay:YES];
}
@@ -170,6 +171,9 @@ var _CPAttachedWindow_attachedWindowShouldClose_ = 1 << 0,
if ([_delegate respondsToSelector:@selector(attachedWindowDidClose:)])
_implementedDelegateMethods |= _CPAttachedWindow_attachedWindowDidClose_;
if ([_delegate respondsToSelector:@selector(attachedWindowDidShow:)])
_implementedDelegateMethods |= _CPAttachedWindow_attachedWindowDidShow_;
}
#pragma mark -
@@ -346,25 +350,18 @@ var _CPAttachedWindow_attachedWindowShouldClose_ = 1 << 0,
}
/*! @ignore */
- (void)setCSS3Property:(CPString)property value:(CPString)value
- (void)setCSS3Property:(CPString)aProperty value:(CPString)value
{
_DOMElement.style['webkit' + property] = value;
var browserProperty = CPBrowserStyleProperty(aProperty);
// Support other browsers here eventually
if (browserProperty)
_DOMElement.style[browserProperty] = value;
}
/*! @ignore */
- (BOOL)browserSupportsAnimation
{
return typeof(_DOMElement.style.webkitTransition) !== "undefined";
/*
No others browsers supported yet.
typeof(_DOMElement.style.MozTransition) !== "undefined" ||
typeof(_DOMElement.style.MsTransition) !== "undefined" ||
typeof(_DOMElement.style.OTransition) !== "undefined";
*/
return CPBrowserStyleProperty('transition') && CPBrowserStyleProperty('transitionend');
}
#pragma mark -
@@ -384,6 +381,14 @@ var _CPAttachedWindow_attachedWindowShouldClose_ = 1 << 0,
#pragma mark -
#pragma mark Overrides
/*!
Attached windows, such as pop overs, can usually become the key window.
*/
- (BOOL)canBecomeKeyWindow
{
return YES;
}
/*!
Called when the window is losing focus.
*/
@@ -448,19 +453,28 @@ var _CPAttachedWindow_attachedWindowShouldClose_ = 1 << 0,
// Set up the pop-out transition
[self setCSS3Property:@"Transform" value:@"scale(1.1)"];
[self setCSS3Property:@"Transition" value:@"-webkit-transform 200ms ease-in"];
[self setCSS3Property:@"Transition" value:CPBrowserCSSProperty('transform') + @" 200ms ease-in"];
var transitionEndFunction = function()
{
_DOMElement.removeEventListener("webkitTransitionEnd", transitionEndFunction, YES);
_DOMElement.removeEventListener(CPBrowserStyleProperty('transitionend'), transitionEndFunction, YES);
// Now set up the pop-in to normal size transition.
// Because we are watching the -webkit-transform, it will occur now.
[self setCSS3Property:@"Transform" value:@"scale(1)"];
[self setCSS3Property:@"Transition" value:@"-webkit-transform 50ms linear"];
[self setCSS3Property:@"Transition" value:CPBrowserCSSProperty('transform') + @" 50ms linear"];
var transitionCompleteFunction = function()
{
_DOMElement.removeEventListener(CPBrowserStyleProperty('transitionend'), transitionCompleteFunction, YES);
if (_implementedDelegateMethods & _CPAttachedWindow_attachedWindowDidShow_)
[_delegate attachedWindowDidShow:self];
}
_DOMElement.addEventListener(CPBrowserStyleProperty('transitionend'), transitionCompleteFunction, YES);
};
_DOMElement.addEventListener("webkitTransitionEnd", transitionEndFunction, YES);
_DOMElement.addEventListener(CPBrowserStyleProperty('transitionend'), transitionEndFunction, YES);
}, 0);
}
else
@@ -493,11 +507,11 @@ var _CPAttachedWindow_attachedWindowShouldClose_ = 1 << 0,
var transitionEndFunction = function()
{
_DOMElement.removeEventListener("webkitTransitionEnd", transitionEndFunction, YES);
_DOMElement.removeEventListener(CPBrowserStyleProperty("transitionend"), transitionEndFunction, YES);
[self _close];
};
_DOMElement.addEventListener("webkitTransitionEnd", transitionEndFunction, YES);
_DOMElement.addEventListener(CPBrowserStyleProperty("transitionend"), transitionEndFunction, YES);
}
else
{
+9 -2
View File
@@ -55,7 +55,7 @@ var _CPAutocompleteMenuMaximumHeight = 307;
[_menuWindow setLevel:CPPopUpMenuWindowLevel];
[_menuWindow setHasShadow:YES];
[_menuWindow setShadowStyle:CPMenuWindowShadowStyle];
[_menuWindow setAcceptsMouseMovedEvents:NO];
[_menuWindow setAcceptsMouseMovedEvents:YES];
[_menuWindow setBackgroundColor:[_CPMenuWindow backgroundColorForBackgroundStyle:_CPMenuWindowPopUpBackgroundStyle]];
var contentView = [_menuWindow contentView];
@@ -73,6 +73,8 @@ var _CPAutocompleteMenuMaximumHeight = 307;
[tableView setDataSource:self];
[tableView setDelegate:self];
[tableView setTarget:self];
[tableView setAction:@selector(complete:)];
[tableView setAllowsMultipleSelection:NO];
[tableView setHeaderView:nil];
[tableView setCornerView:nil];
@@ -161,7 +163,7 @@ var _CPAutocompleteMenuMaximumHeight = 307;
// TODO Track down why mystery constant is needed to allocate enough width. Scroll view insets?
}
var frameOrigin = [textField convertPoint:origin toView:nil],
var frameOrigin = [[textField window] convertBaseToGlobal:[textField convertPointToBase:origin]],
screenSize = [([CPPlatform isBrowser] ? [_menuWindow platformWindow] : [_menuWindow screen]) visibleFrame].size,
availableWidth = screenSize.width - frameOrigin.x,
availableHeight = screenSize.height - frameOrigin.y,
@@ -251,6 +253,11 @@ var _CPAutocompleteMenuMaximumHeight = 307;
return [contentArray objectAtIndex:row];
}
- (@action)complete:(id)sender
{
[textField _complete:self];
}
@end
+45 -27
View File
@@ -292,7 +292,7 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
{
[self layoutIfNeeded];
var textFrame = CGRectMakeZero();
var textFrame = _CGRectMakeZero();
if (_DOMTextElement)
{
@@ -681,38 +681,47 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
textRectWidth = _CGRectGetWidth(textRect),
textRectHeight = _CGRectGetHeight(textRect);
if (_verticalAlignment !== CPTopVerticalTextAlignment)
if (textRectWidth <= 0 || textRectHeight <= 0)
{
if (!_textSize)
// Don't bother trying to position the text in an empty rect.
textRectWidth = 0;
textRectHeight = 0;
}
else
{
if (_verticalAlignment !== CPTopVerticalTextAlignment)
{
if (_lineBreakMode === CPLineBreakByCharWrapping ||
_lineBreakMode === CPLineBreakByWordWrapping)
if (!_textSize)
{
_textSize = [_text sizeWithFont:_font inWidth:textRectWidth];
}
else
{
_textSize = [_text sizeWithFont:_font];
if (_lineBreakMode === CPLineBreakByCharWrapping ||
_lineBreakMode === CPLineBreakByWordWrapping)
{
_textSize = [_text sizeWithFont:_font inWidth:textRectWidth];
}
else
{
_textSize = [_text sizeWithFont:_font];
// Account for possible fractional pixels at right edge
_textSize.width += 1;
// Account for possible fractional pixels at right edge
_textSize.width += 1;
}
// Account for possible fractional pixels at bottom edge
_textSize.height += 1;
}
// Account for possible fractional pixels at bottom edge
_textSize.height += 1;
}
if (_verticalAlignment === CPCenterVerticalTextAlignment)
{
// Since we added +1 px height above to show fractional pixels on the bottom, we have to remove that when calculating vertical centre.
textRectY = textRectY + (textRectHeight - _textSize.height + 1.0) / 2.0;
textRectHeight = _textSize.height;
}
if (_verticalAlignment === CPCenterVerticalTextAlignment)
{
// Since we added +1 px height above to show fractional pixels on the bottom, we have to remove that when calculating vertical centre.
textRectY = textRectY + (textRectHeight - _textSize.height + 1.0) / 2.0;
textRectHeight = _textSize.height;
}
else //if (_verticalAlignment === CPBottomVerticalTextAlignment)
{
textRectY = textRectY + textRectHeight - _textSize.height;
textRectHeight = _textSize.height;
else //if (_verticalAlignment === CPBottomVerticalTextAlignment)
{
textRectY = textRectY + textRectHeight - _textSize.height;
textRectHeight = _textSize.height;
}
}
}
@@ -740,7 +749,7 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
- (void)sizeToFit
{
var size = CGSizeMakeZero();
var size = _CGSizeMakeZero();
if ((_imagePosition !== CPNoImage) && _image)
{
@@ -781,4 +790,13 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
[self setFrameSize:size];
}
- (void)setFrameSize:(CGSize)aSize
{
// If we're applying line breaks the height of the text size might change as a result of the bounds changing.
if ((_lineBreakMode === CPLineBreakByCharWrapping || _lineBreakMode === CPLineBreakByWordWrapping) && aSize.width !== [self frameSize].width)
_textSize = nil;
[super setFrameSize:aSize];
}
@end
+12
View File
@@ -74,6 +74,18 @@ CPPointCreateCopy = CGPointMakeCopy;
*/
CPPointEqualToPoint = CGPointEqualToPoint;
/*!
Tests whether the CGPoint is contained by the CGRect.
@group CGPoint
@param aPoint the CGPoint to check
@param aRect the CGRect to check
@return BOOL \c YES if the rect contains the point.
*/
CPPointInRect = function(aPoint, aRect)
{
return CGRectContainsPoint(aRect, aPoint)
};
/*!
Test whether the two CGRects have the same origin and size
@group CGRect
+3
View File
@@ -254,6 +254,9 @@ var _CPTimerBridgeTimer = function(codeOrFunction, aDelay, shouldRepeat, functio
theFunction = function() { codeOrFunction.apply(window, functionArgs); if (!shouldRepeat) CPTimersForTimeoutIDs[timeoutID] = nil; }
}
// A call such as setTimeout(f) is technically invalid but browsers seem to treat it as setTimeout(f, 0), so so will we.
aDelay = aDelay | 0.0;
CPTimersForTimeoutIDs[timeoutID] = [CPTimer scheduledTimerWithTimeInterval:aDelay / 1000 callback:theFunction repeats:shouldRepeat];
return timeoutID;
+6 -2
View File
@@ -151,8 +151,12 @@ var CPURLConnectionDelegate = nil;
var URL = [_request URL],
scheme = [URL scheme];
// Browsers use "file:"
_isLocalFileConnection = scheme === "file";
// Browsers use "file:", Titanium uses "app:"
_isLocalFileConnection = scheme === "file" ||
((scheme === "http" || scheme === "https:") &&
window.location &&
(window.location.protocol === "file:" || window.location.protocol === "app:"));
_HTTPRequest = new CFHTTPRequest();
if (shouldStartImmediately)
+4 -4
View File
@@ -195,7 +195,7 @@ globalResults = [];
[[CPNotificationCenter defaultCenter] addObserver:self
selector:@selector(receiveNotification:)
name:CPApplicationWillTerminateNotification
object:nil];
object:nil];
[app replyToApplicationShouldTerminate:CPTerminateNow];
[self assert:CPApplicationWillTerminateNotification equals:[globalResults[0] name]];
@@ -223,8 +223,8 @@ globalResults = [];
- (void)testTargetForAction
{
var mainWin = [[TestMainWindow alloc] init];
var keyWin = [[TestKeyWindow alloc] init];
var mainWin = [[TestMainWindow alloc] init],
keyWin = [[TestKeyWindow alloc] init];
mainWin._isVisible = YES;
keyWin._isVisible = YES;
[mainWin makeMainWindow];
@@ -252,6 +252,6 @@ globalResults = [];
// when no target is given, targetForAction is called
[self assert:app equals:[app targetForAction:@selector(someTestMethod:) to:nil from:nil]];
}
@end
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+158 -120
View File
@@ -1,26 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1070</int>
<string key="IBDocument.SystemVersion">11D50d</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.32</string>
<string key="IBDocument.HIToolboxVersion">568.00</string>
<int key="IBDocument.SystemTarget">1080</int>
<string key="IBDocument.SystemVersion">12C60</string>
<string key="IBDocument.InterfaceBuilderVersion">2844</string>
<string key="IBDocument.AppKitVersion">1187.34</string>
<string key="IBDocument.HIToolboxVersion">625.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2182</string>
<string key="NS.object.0">2844</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>NSTextField</string>
<string>NSView</string>
<string>NSWindowTemplate</string>
<string>NSTextFieldCell</string>
<string>NSSliderCell</string>
<string>NSButton</string>
<string>NSButtonCell</string>
<string>NSCustomObject</string>
<string>NSMatrix</string>
<string>NSSlider</string>
<string>NSButtonCell</string>
<string>NSButton</string>
<string>NSCustomObject</string>
<string>NSSliderCell</string>
<string>NSTextField</string>
<string>NSTextFieldCell</string>
<string>NSTokenField</string>
<string>NSTokenFieldCell</string>
<string>NSView</string>
<string>NSWindowTemplate</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -55,13 +57,13 @@
<object class="NSSlider" id="626349312">
<reference key="NSNextResponder" ref="161598483"/>
<int key="NSvFlags">301</int>
<string key="NSFrame">{{116, 54}, {96, 21}}</string>
<string key="NSFrame">{{59, 52}, {96, 21}}</string>
<reference key="NSSuperview" ref="161598483"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="225469319"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSliderCell" key="NSCell" id="1024364993">
<int key="NSCellFlags">-2079981824</int>
<int key="NSCellFlags">-2080112384</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents"/>
<object class="NSFont" key="NSSupport">
@@ -79,17 +81,18 @@
<bool key="NSAllowsTickMarkValuesOnly">NO</bool>
<bool key="NSVertical">NO</bool>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSTextField" id="225469319">
<reference key="NSNextResponder" ref="161598483"/>
<int key="NSvFlags">301</int>
<string key="NSFrame">{{234, 51}, {96, 22}}</string>
<string key="NSFrame">{{166, 51}, {96, 22}}</string>
<reference key="NSSuperview" ref="161598483"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="244990043"/>
<reference key="NSNextKeyView" ref="393836098"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="771311359">
<int key="NSCellFlags">-1804468671</int>
<int key="NSCellFlags">-1804599231</int>
<int key="NSCellFlags2">272630784</int>
<string key="NSContents"/>
<object class="NSFont" key="NSSupport" id="394344788">
@@ -97,9 +100,10 @@
<double key="NSSize">13</double>
<int key="NSfFlags">1044</int>
</object>
<string key="NSPlaceholderString">CPTextField</string>
<reference key="NSControlView" ref="225469319"/>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSColor" key="NSBackgroundColor">
<object class="NSColor" key="NSBackgroundColor" id="539867213">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">textBackgroundColor</string>
@@ -118,6 +122,7 @@
</object>
</object>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="917693159">
<reference key="NSNextResponder" ref="161598483"/>
@@ -129,19 +134,20 @@
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="193918884">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Close</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="917693159"/>
<int key="NSButtonFlags">-2038284033</int>
<int key="NSButtonFlags">-2038284288</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string type="base64-UTF8" key="NSKeyEquivalent">DQ</string>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="503115995">
<reference key="NSNextResponder" ref="161598483"/>
@@ -153,19 +159,20 @@
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="387916657">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Modal Window</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="503115995"/>
<int key="NSButtonFlags">-2038284033</int>
<int key="NSButtonFlags">-2038284288</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="368830815">
<reference key="NSNextResponder" ref="161598483"/>
@@ -177,19 +184,20 @@
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="17045191">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Sheet</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="368830815"/>
<int key="NSButtonFlags">-2038284033</int>
<int key="NSButtonFlags">-2038284288</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="666980504">
<reference key="NSNextResponder" ref="161598483"/>
@@ -201,19 +209,20 @@
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="549512143">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Window</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="666980504"/>
<int key="NSButtonFlags">-2038284033</int>
<int key="NSButtonFlags">-2038284288</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="223206700">
<reference key="NSNextResponder" ref="161598483"/>
@@ -225,19 +234,20 @@
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="202127501">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Modal Sheet</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="223206700"/>
<int key="NSButtonFlags">-2038284033</int>
<int key="NSButtonFlags">-2038284288</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="968632972">
<reference key="NSNextResponder" ref="161598483"/>
@@ -249,19 +259,20 @@
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="895163260">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Alert Sheet</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="968632972"/>
<int key="NSButtonFlags">-2038284033</int>
<int key="NSButtonFlags">-2038284288</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="821769865">
<reference key="NSNextResponder" ref="161598483"/>
@@ -273,19 +284,20 @@
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="119441282">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Close Parent Too</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="821769865"/>
<int key="NSButtonFlags">-2038284033</int>
<int key="NSButtonFlags">-2038284288</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="244990043">
<reference key="NSNextResponder" ref="161598483"/>
@@ -297,19 +309,20 @@
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="280494721">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Chain Sheets</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="244990043"/>
<int key="NSButtonFlags">-2038284033</int>
<int key="NSButtonFlags">-2038284288</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="133258452">
<reference key="NSNextResponder" ref="161598483"/>
@@ -321,13 +334,13 @@
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="220534627">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">orderOut: after endSheet:</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="133258452"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">2</int>
<object class="NSCustomResource" key="NSNormalImage" id="757628530">
<string key="NSClassName">NSImage</string>
@@ -341,6 +354,7 @@
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="1070361803">
<reference key="NSNextResponder" ref="161598483"/>
@@ -352,13 +366,13 @@
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="858583142">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Shade Window View of Non-CIB Windows</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="1070361803"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="757628530"/>
<reference key="NSAlternateImage" ref="375806730"/>
@@ -367,6 +381,7 @@
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="945251289">
<reference key="NSNextResponder" ref="161598483"/>
@@ -378,13 +393,13 @@
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="1032816">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Shade Content View of Non-CIB Window</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="945251289"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="757628530"/>
<reference key="NSAlternateImage" ref="375806730"/>
@@ -393,6 +408,7 @@
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="671904505">
<reference key="NSNextResponder" ref="161598483"/>
@@ -404,13 +420,13 @@
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="885506522">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Shade Parent Window on windowWillBeginSheet:</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="671904505"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="757628530"/>
<reference key="NSAlternateImage" ref="375806730"/>
@@ -419,6 +435,7 @@
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="816373959">
<reference key="NSNextResponder" ref="161598483"/>
@@ -426,17 +443,17 @@
<string key="NSFrame">{{193, 268}, {174, 18}}</string>
<reference key="NSSuperview" ref="161598483"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<reference key="NSNextKeyView" ref="893839534"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="26730683">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags">-2080374784</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">CPTitledWindowMask</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="816373959"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="757628530"/>
<reference key="NSAlternateImage" ref="375806730"/>
@@ -445,6 +462,7 @@
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="893839534">
<reference key="NSNextResponder" ref="161598483"/>
@@ -456,13 +474,13 @@
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="497880742">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags">-2080374784</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">CPClosableWindowMask</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="893839534"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="757628530"/>
<reference key="NSAlternateImage" ref="375806730"/>
@@ -471,6 +489,7 @@
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSMatrix" id="531109111">
<reference key="NSNextResponder" ref="161598483"/>
@@ -481,17 +500,18 @@
<reference key="NSNextKeyView" ref="968632972"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<int key="NSNumRows">5</int>
<int key="NSNumCols">1</int>
<array class="NSMutableArray" key="NSCells">
<object class="NSButtonCell" id="552182731">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags">-2080374784</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">CIB Window</string>
<reference key="NSSupport" ref="394344788"/>
<reference key="NSControlView" ref="531109111"/>
<int key="NSTag">1</int>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">0</int>
<object class="NSButtonImageSource" key="NSAlternateImage" id="680600750">
<string key="NSImageName">NSRadioButton</string>
@@ -502,13 +522,13 @@
<int key="NSPeriodicInterval">25</int>
</object>
<object class="NSButtonCell" id="268094245">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">CPHUDBackgroundWindowMask</string>
<reference key="NSSupport" ref="394344788"/>
<reference key="NSControlView" ref="531109111"/>
<int key="NSTag">2</int>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">0</int>
<object class="NSImage" key="NSNormalImage">
<int key="NSImageFlags">549453824</int>
@@ -557,39 +577,39 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSPeriodicInterval">75</int>
</object>
<object class="NSButtonCell" id="569365394">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">CPBorderlessWindowMask</string>
<reference key="NSSupport" ref="394344788"/>
<reference key="NSControlView" ref="531109111"/>
<int key="NSTag">3</int>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">0</int>
<reference key="NSAlternateImage" ref="680600750"/>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
</object>
<object class="NSButtonCell" id="755250605">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">CPTexturedBackgroundWindowMask</string>
<reference key="NSSupport" ref="394344788"/>
<reference key="NSControlView" ref="531109111"/>
<int key="NSTag">4</int>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">0</int>
<reference key="NSAlternateImage" ref="680600750"/>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
</object>
<object class="NSButtonCell" id="830766462">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">CPDocModalWindowMask</string>
<reference key="NSSupport" ref="394344788"/>
<reference key="NSControlView" ref="531109111"/>
<int key="NSTag">5</int>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">0</int>
<reference key="NSAlternateImage" ref="680600750"/>
<int key="NSPeriodicDelay">400</int>
@@ -601,11 +621,11 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSMatrixFlags">1151868928</int>
<string key="NSCellClass">NSActionCell</string>
<object class="NSButtonCell" key="NSProtoCell" id="510263560">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Radio</string>
<reference key="NSSupport" ref="394344788"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">0</int>
<object class="NSImage" key="NSNormalImage">
<int key="NSImageFlags">549453824</int>
@@ -669,17 +689,17 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string key="NSFrame">{{192, 228}, {210, 18}}</string>
<reference key="NSSuperview" ref="161598483"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<reference key="NSNextKeyView" ref="132928531"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="920567219">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags">-2080374784</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">CPMiniaturizableWindowMask</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="583986702"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="757628530"/>
<reference key="NSAlternateImage" ref="375806730"/>
@@ -688,6 +708,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="132928531">
<reference key="NSNextResponder" ref="161598483"/>
@@ -695,17 +716,17 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string key="NSFrame">{{192, 208}, {180, 18}}</string>
<reference key="NSSuperview" ref="161598483"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<reference key="NSNextKeyView" ref="133258452"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="479229106">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags">-2080374784</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">CPResizableWindowMask</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="132928531"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="757628530"/>
<reference key="NSAlternateImage" ref="375806730"/>
@@ -714,6 +735,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSTextField" id="772963208">
<reference key="NSNextResponder" ref="161598483"/>
@@ -726,7 +748,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string key="NSAntiCompressionPriority">{250, 750}</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="612486558">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">272629760</int>
<string key="NSContents">It is not specified if endSheet: or orderOut: on sheet should be called first. However, cannot call orderOut: after endSheet: when chaining.</string>
<object class="NSFont" key="NSSupport">
@@ -737,13 +759,43 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="772963208"/>
<reference key="NSBackgroundColor" ref="567491004"/>
<object class="NSColor" key="NSTextColor">
<object class="NSColor" key="NSTextColor" id="879929027">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlTextColor</string>
<reference key="NSColor" ref="170726192"/>
</object>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSTokenField" id="393836098">
<reference key="NSNextResponder" ref="161598483"/>
<int key="NSvFlags">268</int>
<set class="NSMutableSet" key="NSDragTypes">
<string>NSStringPboardType</string>
</set>
<string key="NSFrame">{{275, 51}, {96, 22}}</string>
<reference key="NSSuperview" ref="161598483"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="244990043"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTokenFieldCell" key="NSCell" id="437001198">
<int key="NSCellFlags">341835776</int>
<int key="NSCellFlags2">0</int>
<reference key="NSSupport" ref="394344788"/>
<string key="NSPlaceholderString">CPTokenField</string>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="393836098"/>
<bool key="NSDrawsBackground">YES</bool>
<reference key="NSBackgroundColor" ref="539867213"/>
<reference key="NSTextColor" ref="879929027"/>
<reference key="NSDelegate" ref="393836098"/>
<double key="NSCompletionDelay">0.0</double>
<int key="NSTokenStyle">0</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<int key="NSTokenFieldVersion">2</int>
</object>
</array>
<string key="NSFrameSize">{468, 425}</string>
@@ -751,7 +803,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="666980504"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
@@ -762,13 +814,13 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="725655611">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags">-2080374784</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">CPTitledWindowMask</string>
<reference key="NSSupport" ref="394344788"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="147975559"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="757628530"/>
<reference key="NSAlternateImage" ref="375806730"/>
@@ -777,6 +829,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
@@ -941,6 +994,14 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<int key="connectionID">33</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="393836098"/>
<reference key="destination" ref="1001"/>
</object>
<int key="connectionID">226</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -998,8 +1059,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<reference ref="244990043"/>
<reference ref="917693159"/>
<reference ref="821769865"/>
<reference ref="626349312"/>
<reference ref="225469319"/>
<reference ref="393836098"/>
<reference ref="626349312"/>
</array>
<reference key="parent" ref="1056085528"/>
</object>
@@ -1306,6 +1368,19 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<reference key="object" ref="885506522"/>
<reference key="parent" ref="671904505"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">224</int>
<reference key="object" ref="393836098"/>
<array class="NSMutableArray" key="children">
<reference ref="437001198"/>
</array>
<reference key="parent" ref="161598483"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">225</int>
<reference key="object" ref="437001198"/>
<reference key="parent" ref="393836098"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -1354,6 +1429,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string key="22.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="220.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="221.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="224.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="225.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="23.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="25.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="28.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1370,57 +1447,13 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">223</int>
<int key="maxID">226</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">SheetWindowController</string>
<string key="superclassName">NSWindowController</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="newAlertSheet:">id</string>
<string key="newColorPanelSheet:">id</string>
<string key="newModalSheet:">id</string>
<string key="newModalWindow:">id</string>
<string key="newOpenPanelSheet:">id</string>
<string key="newSavePanelSheet:">id</string>
<string key="newSheet:">id</string>
<string key="newWindow:">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="newAlertSheet:">
<string key="name">newAlertSheet:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="newColorPanelSheet:">
<string key="name">newColorPanelSheet:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="newModalSheet:">
<string key="name">newModalSheet:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="newModalWindow:">
<string key="name">newModalWindow:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="newOpenPanelSheet:">
<string key="name">newOpenPanelSheet:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="newSavePanelSheet:">
<string key="name">newSavePanelSheet:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="newSheet:">
<string key="name">newSheet:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="newWindow:">
<string key="name">newWindow:</string>
<string key="candidateClassName">id</string>
</object>
</dictionary>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="_altCloseButton">NSButton</string>
<string key="_closableMaskButton">NSButton</string>
@@ -1432,8 +1465,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string key="_shadeContentView">NSButton</string>
<string key="_shadeParentWindow">NSButton</string>
<string key="_shadeWindowView">NSButton</string>
<string key="_sheetWindowHackCheckbox">NSButton</string>
<string key="_titledMaskButton">NSButton</string>
<string key="_windowTypeMatrix">NSMatrix</string>
<string key="_windowTypeMatrix">CPRadioGroup</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="_altCloseButton">
@@ -1476,13 +1510,17 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string key="name">_shadeWindowView</string>
<string key="candidateClassName">NSButton</string>
</object>
<object class="IBToOneOutletInfo" key="_sheetWindowHackCheckbox">
<string key="name">_sheetWindowHackCheckbox</string>
<string key="candidateClassName">NSButton</string>
</object>
<object class="IBToOneOutletInfo" key="_titledMaskButton">
<string key="name">_titledMaskButton</string>
<string key="candidateClassName">NSButton</string>
</object>
<object class="IBToOneOutletInfo" key="_windowTypeMatrix">
<string key="name">_windowTypeMatrix</string>
<string key="candidateClassName">NSMatrix</string>
<string key="candidateClassName">CPRadioGroup</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -126,11 +126,11 @@
- (SheetWindowController)allocController
{
CPLog.debug("[%@ %@] groupClass=%@", [self class], _cmd,
[[[[[_windowTypeMatrix subviews] objectAtIndex:0] radioGroup] selectedRadio] tag]);
[[_windowTypeMatrix selectedRadio] tag]);
var type = 1;
if (_windowTypeMatrix)
type = [[[[[_windowTypeMatrix subviews] objectAtIndex:0] radioGroup] selectedRadio] tag];
type = [[_windowTypeMatrix selectedRadio] tag];
var styleMask = 0;
if ([_titledMaskButton state])
@@ -481,4 +481,20 @@
[[_parentWindow contentView] setBackgroundColor:_savedColor];
}
- (CPArray)tokenField:(CPTokenField)aTokenField completionsForSubstring:(CPString)substring indexOfToken:(int)tokenIndex indexOfSelectedItem:(int)selectedIndex
{
var choices = ["aardvark", "baa", "caaing whale"],
r = [];
// Don't complete 'blank' - this would show all available matches which is excessive.
if (!substring)
return r;
for (var i = 0; i < choices.length; i++)
if (choices[i].toLowerCase().indexOf(substring.toLowerCase()) == 0)
r.push(choices[i]);
return r;
}
@end
File diff suppressed because one or more lines are too long
@@ -0,0 +1,33 @@
/*
* AppController.j
* CPStepperBindings
*
* Created by You on November 27, 2012.
* Copyright 2012, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
CPWindow theWindow; //this "outlet" is connected automatically by the Cib
@outlet CPStepper stepper @accessors;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
// This is called when the application is done loading.
}
- (void)awakeFromCib
{
// This is called when the cib is done loading.
// You can implement this method on any object instantiated from a Cib.
// It's a useful hook for setting up current UI values, and other things.
// In this case, we want the window from Cib to become our full browser window
[theWindow setFullPlatformWindow:YES];
}
@end
+10
View File
@@ -0,0 +1,10 @@
<?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>CPStepperBindings</string>
</dict>
</plist>
+94
View File
@@ -0,0 +1,94 @@
/*
* Jakefile
* CPStepperBindings
*
* Created by You on November 27, 2012.
* Copyright 2012, 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 ("CPStepperBindings", function(task)
{
task.setBuildIntermediatesPath(FILE.join("Build", "CPStepperBindings.build", configuration));
task.setBuildPath(FILE.join("Build", configuration));
task.setProductName("CPStepperBindings");
task.setIdentifier("com.yourcompany.CPStepperBindings");
task.setVersion("1.0");
task.setAuthor("Your Company");
task.setEmail("feedback @nospam@ yourcompany.com");
task.setSummary("CPStepperBindings");
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", ["CPStepperBindings"], 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", "CPStepperBindings", "index.html")]);
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "CPStepperBindings", "index.html")]);
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "CPStepperBindings"));
OS.system(["press", "-f", FILE.join("Build", "Release", "CPStepperBindings"), FILE.join("Build", "Deployment", "CPStepperBindings")]);
printResults("Deployment")
});
task ("desktop", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Desktop", "CPStepperBindings"));
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "CPStepperBindings"), FILE.join("Build", "Desktop", "CPStepperBindings", "CPStepperBindings.app"));
printResults("Desktop")
});
task ("run-desktop", ["desktop"], function()
{
OS.system([FILE.join("Build", "Desktop", "CPStepperBindings", "CPStepperBindings.app", "Contents", "MacOS", "NativeHost"), "-i"]);
});
function printResults(configuration)
{
print("----------------------------");
print(configuration+" app built at path: "+FILE.join("Build", configuration, "CPStepperBindings"));
print("----------------------------");
}
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,107 @@
<!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
CPStepperBindings
Created by You on November 27, 2012.
Copyright 2012, 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>CPStepperBindings</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);
// Tag view DOM elements with a "data-cappuccino-view" attribute that contains
// the class name of the view that created them. Comment this or set to false to disable.
appkit_tag_dom_elements = true;
</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 CPStepperBindings...</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>
+77
View File
@@ -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
CPStepperBindings
Created by You on November 27, 2012.
Copyright 2012, 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>CPStepperBindings</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 CPStepperBindings...</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>
+18
View File
@@ -0,0 +1,18 @@
/*
* AppController.j
* CPStepperBindings
*
* Created by You on November 27, 2012.
* Copyright 2012, Your Company All rights reserved.
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "AppController.j"
function main(args, namedArgs)
{
CPApplicationMain(args, namedArgs);
}
+22 -6
View File
@@ -11,15 +11,18 @@
@implementation AppController : CPObject
{
CPTabView tabView1;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
var tabView = [[CPTabView alloc] initWithFrame:CGRectMake(50,50,400,400)];
[tabView setTabViewType:CPNoTabsBezelBorder];
[tabView setTabViewType:CPTopTabsBezelBorder];
tabView1 = [[CPTabView alloc] initWithFrame:CGRectMake(50,50,400,400)];
[tabView1 setTabViewType:CPNoTabsBezelBorder];
[tabView1 setTabViewType:CPTopTabsBezelBorder];
var tabs = [
"First Tab", "a label",
@@ -39,14 +42,27 @@
var item = [[CPTabViewItem alloc] initWithIdentifier:tabs[i]];
[item setView:view];
[item setLabel:tabs[i]];
[tabView addTabViewItem:item];
[tabView1 addTabViewItem:item];
}
[contentView addSubview:tabView];
[contentView addSubview:tabView1];
[tabView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[tabView1 setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
var toggleButton = [CPButton buttonWithTitle:@"Cycle Tab View Type"];
[toggleButton setAction:@selector(switchTabType:)];
[toggleButton setTarget:self];
[toggleButton sizeToFit];
[toggleButton setFrameOrigin:CGPointMake(CGRectGetWidth([contentView frame]) - CGRectGetWidth([toggleButton frame]) - 15, 15)];
[toggleButton setAutoresizingMask:CPViewMinXMargin | CPViewMaxYMargin];
[contentView addSubview:toggleButton];
[theWindow orderFront:self];
}
- (@action)switchTabType:(id)sender
{
[tabView1 setTabViewType:[tabView1 tabViewType] < CPNoTabsNoBorder ? [tabView1 tabViewType] + 1 : CPTopTabsBezelBorder];
}
@end
+33 -2
View File
@@ -12,6 +12,7 @@
@implementation AppController : CPObject
{
CPWindow aWindow;
CPTextField bezelToggleField;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
@@ -83,6 +84,33 @@
y = CGRectGetMaxY([textField frame]) + 6;
}
label = [[CPTextField alloc] initWithFrame:CGRectMake(15, 420, 600, 30)];
[label setLineBreakMode:CPLineBreakByWordWrapping];
[label setStringValue:"This text field has been configured to show its text at a fixed location both with and without bezel."];
[contentView addSubview:label];
bezelToggleField = [CPTextField textFieldWithStringValue:"" placeholder:"Placeholder" width:200],
[bezelToggleField setEditable:YES];
[bezelToggleField setFrameOrigin:CGPointMake(15, 445)];
console.log("" + bezelToggleField._themeAttributes['content-inset']._parentAttribute._values);
console.log("" + bezelToggleField._themeAttributes['content-inset']._values);
[bezelToggleField setValue:[bezelToggleField valueForThemeAttribute:@"content-inset" inState:CPThemeStateBezeled] forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
console.log("" + bezelToggleField._themeAttributes['content-inset']._parentAttribute._values);
console.log("" + bezelToggleField._themeAttributes['content-inset']._values);
[contentView addSubview:bezelToggleField];
var bezelToggleButton = [CPButton buttonWithTitle:"Show Bezel"];
[bezelToggleButton setButtonType:CPPushOnPushOffButton];
[bezelToggleButton setAction:@selector(toggleBezel:)];
[bezelToggleButton setTarget:self];
[bezelToggleButton setState:CPOnState];
[bezelToggleButton sizeToFit];
[bezelToggleButton setFrameOrigin:CGPointMake(CGRectGetMaxX([bezelToggleField frame]) + 15, 448)];
[contentView addSubview:bezelToggleButton];
[theWindow orderFront:self];
aWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(150, 300, 400, 150) styleMask:CPTitledWindowMask | CPClosableWindowMask | CPDocModalWindowMask];
@@ -98,9 +126,7 @@
[contentView addSubview:label];
[textField setFrame:CGRectMake(15, CGRectGetMaxY([label frame]) + 10, 300, 30)];
[textField setEditable:YES];
[textField setTarget:self];
[textField setAction:@selector(modalAction:)];
@@ -109,6 +135,11 @@
[CPApp beginSheet:aWindow modalForWindow:theWindow modalDelegate:self didEndSelector:nil contextInfo:nil];
}
- (@action)toggleBezel:(id)sender
{
[bezelToggleField setBezeled:([sender state] == CPOnState)];
}
- (void)modalAction:(id)sender
{
[CPApp endSheet:aWindow returnCode:0];
@@ -87,6 +87,11 @@ var STATES = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorad
// Delegate must be set before objectValue
[tokenFieldD setDelegate:self];
var tokenFieldDEditable = [CPCheckBox checkBoxWithTitle:"Editable"];
[tokenFieldDEditable setFrame:CGRectMake(525, CGRectGetMinY([tokenFieldD frame]), 200, 30)];
[tokenFieldDEditable bind:CPValueBinding toObject:tokenFieldD withKeyPath:@"editable" options:nil];
[contentView addSubview:tokenFieldDEditable];
allPersons = [
[Person personWithFirstName:@"Luc" lastName:@"Vauvillier"],
[Person personWithFirstName:@"John" lastName:@"Doe"],
+2 -2
View File
@@ -220,8 +220,8 @@ var NSButtonIsBorderedMask = 0x00800000,
- If there is no max height either, don't do any height adjustments.
*/
var theme = [[Converter sharedConverter] themes][0],
minSize = [theme valueForAttributeWithName:@"min-size" forClass:[CPButton class]],
maxSize = [theme valueForAttributeWithName:@"max-size" forClass:[CPButton class]],
minSize = [theme valueForAttributeWithName:@"min-size" forClass:[self class]],
maxSize = [theme valueForAttributeWithName:@"max-size" forClass:[self class]],
adjustHeight = NO;
if (minSize.height > 0 && maxSize.height > 0 && minSize.height === maxSize.height)