Commit Graph
72 Commits
Author SHA1 Message Date
Mathieu MonneyandMathieu Monney ea95897bbd Fixed: default selection of a CPTabView
The selected tab item view is now loaded correctly after awakeFromCib, which wasn't the case before.
2015-10-27 08:09:17 +01:00
cacaodev 3ef1c9167f Merge remote-tracking branch 'upstream/master' into CPTabView
Conflicts:
	AppKit/CPTabView.j
2015-09-29 11:04:51 +02:00
Alexandre Wilhelm 3fcc37e086 Fixed: CPTabView did not accept first mouse event
Previously, the CPTabView did not react with the first mouse event (for instance when a CPTabView was in a not focused window). Now it does as in cocoa.

To do that, the CPTavView override the method acceptsFirstMouse. Previously, the tabView had a CPBox, it now has a _CPTabViewBox. This new box reacts differently than the CPBox for the method hitTests. It now returns nil when the click was performed on the segmentedControl of the CPTabView, previously this same click would be handle byt the CPBox.
2015-09-22 14:33:14 -07:00
cacaodev 41d259006e Merge remote-tracking branch 'upstream/master' into CPTabView 2015-09-14 18:57:12 +02:00
Antoine Mercadal 547764e3c1 FIXED: Always call [super awakeFromCib] in CPView subclasses 2015-08-14 01:43:55 -07:00
cacaodev db9e649f6e FIXED: missing return stmt in -indexOfTabViewItemWithIdenfier;
Refactored delegate notifications.
CPTabViewItem style.

Tests: All delegate methods are tested in CPTabViewNib manual test.
2015-05-07 22:35:02 +02:00
cacaodev 865a45044f NEW: bindings support 2015-03-27 14:38:58 +01:00
cacaodev 7378d06bfd FIXED: CPTabView -insertTabViewItem:atIndex:
Before this commit, the tabViewItems and the segments were 2 different
collections. Any indexed change in the tabViewItems asked to re-sync
the segments making it difficult to maintain any persistent state. Now
the tabView items are the segments content.

Also fixed the selection update when items are removed.
See CPTabViewTest.j  and manual test Manual/CPTabViewNib/
2015-03-27 14:27:46 +01:00
Antoine Mercadal f9275a70af FIXED: New warnings reveleaded by ivar type checking
This patch fixes all new warnings
2014-11-06 10:17:05 -08:00
Alexandre Wilhelm e4516c19d3 Fixed: CPSegmentedControl doesn't support small and mini control
Previously, when changing the controlSize of a CPSegmentedControl, Cappuccino didn't have the theme to do that.
Now, Cappuccino supports the controlSize small and mini. Aristo and Aristo2 have new attributes for that.
The attribute theme "default-height" has been replaced by "min-size" and "max-size" (used everywhere else in Cappuccino).
The CPSegmentedControl has now the theme attribute "nib2cib-adjustment-frame".

This pull request fixed alignment issue when adding a CPSegmentedControl from xCode. In the method initWithCode, we didn't care about the divider thickness, now we do. This same method will also add leftovers pixel to have exactly the same size as in xCode. Leftovers pixels are here because FLOOR operation and size of the font.

Manual test in Tests/Manual/CPSegmentedControlTest
Manual test in Tests/Manual/Nib2CibAlignment
2014-10-22 15:29:40 -07:00
Alos 1d40b5010e Merge branch 'layoutSubview-fix' of github.com:Alos/cappuccino into layoutSubview-fix
Conflicts:
	AppKit/CPTabView.j
2014-02-16 23:28:57 -06:00
Alos 9d25f1c073 Fixed layoutSubviews
Added missing setNeedsLayout
2014-02-16 23:25:22 -06:00
Alexandre Wilhelm 27fdb3116c Fixed: CPTabViewDelegate protocol does not implement CPObject protocol 2013-12-09 01:21:01 -08:00
Alexandre Wilhelm 7d14676bce New : Added CPTabViewDelegate protocol
This PR adds the CPTabViewDelegate protocol
2013-12-08 19:01:50 -08:00
Martin Carlberg bb58a206a8 Fixed: Removed all warnings of conflicting return and parameter types caused by the new compiler 2013-08-12 16:46:14 +02:00
Sergio Felix d7b5382c32 Fixed: CPTabView will now update its tabs labels when the layoutSubviews method is called. Fixes 1926 2013-05-13 01:08:32 -05:00
Aparajita Fishman afd5925499 Fixed: _CG and _CP macros were confusing and could degrade performance
Previously, Cappuccino was using preprocessor macros internally for the CGPoint/Size/Rect/Inset/Affine functions, as well as for CPRange. These macros had the same name as the corresponding function, but began with _. The functions were actually defined using the macros.

The motivation behind using macros was to increase performance by reducing function calls. However, there were a number of problems with this approach:

- There was an artificial dichotomy between _CG macros and the corresponding CG functions. We never completely replaced CG function calls with _CG macros. In fact, they were often mixed up in the same file. There was an extra burden on the programmer to remember to use the macro instead of the function.
- If a method call was passed as an argument to a macro, performance could actually be significantly *worse* than a function call. For example, _CGGetRectMakeCopy([view frame]) would expand to `{ origin:{ x:[view frame].origin.x, y:[view frame].origin.y }, size:{ width:[view frame].size.width, height:[view frame].size.height } }`. So instead of a single objj_msgSend and a single simple function call, we ended up with 4 objj_msgSend calls, which are way more expensive than simple function calls.
- Because of this expansion problem, to use macros efficiently required us to remember to use variables for all macro parameters. This didn't happen, and shouldn't have to happen.
- Finally, with modern Javascript engines, function call overhead is so small that it really isn't worth using the macros.

This commit eliminates the _CGGeometry, CGAffineTransformation and CPRange macros and replaces them with function calls.

BREAKING CHANGE:
The macros are no longer available. They could only be used with compiled code, but if there is any user code that used them, they will have to be replaced with the corresponding functions.
2013-03-13 12:22:10 -04:00
Alexander Ljungberg 677124da49 Fixed: another tab view decoding error.
Without this fix, CPTabView would still make view hierarchy changes in `initWithCoder:` despite the fix in f805b6b. Making view hierarchy changes before a cib is fully decoded can easily result in a corrupted hierarchy.

In this case, the decoding of a tab view item view, A, lead to the decoder to try to decode A's next responder, which was the tab view, B. B then tried to set the selected tab, which involved adding A as a subview. But since A wasn't done decoding, A._superview would change later in the process, corrupting this change.

This fix delays `_updateItems` to `awakeFromCib` at which time changing the view hierarchy is safe.

Refs #1409.
2013-03-13 12:41:47 +00:00
Alexander Ljungberg f805b6bfa6 Fixes #1409. Improve CPTabView decoding to fix tab selection errors.
This is an improved fix to the corrupted tab view state bug partially addressed by 0f347be.

Without either fix, NSTabView is converted to a CPTabView where tab view item views are subviews of the NSTabView, while in Cappuccino the selected view item is supposed to be a subview of a CPBox.

Without this fix, CPTabView decoding called addSubview: in initWithCoder: which can cause the superview of a view to become set, only to later be overwritten when the superview ivar is decoded.

This fix removes the tab item view as a subview from the tab view before encoding it in nib2cib, and then makes sure not to call addSubview: while still in the initWithCoder stage, but rather later in awakeFromCib.
2013-02-24 23:08:44 +00:00
Alexander Ljungberg a19ec35a47 Fixes #1409. Fixed: broken tab view decoded from xib in certain situation.
Without this fix, a tab view set up in Xcode where a tab but the first was selected could be instantiated in a corrupted state in Cappuccino, where tab selection would have no effect.

This fix ensures that even if the decoded view of the selected tab view item has a superview different from how we do things in Cappuccino, we make sure to set it right.
2013-02-22 19:08:38 +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 acd98b5c88 Clarify CPTabView code. 2012-08-28 14:32:04 +01:00
Alexander Ljungberg f535a6a242 Minor CPTabView optimisation. 2012-08-28 11:42:38 +01:00
cacaodev d581dec6cf CPTabView: Do not track the segment when the delegate disallows item selection. 2012-02-13 00:32:22 +01:00
cacaodev 6a42d601c5 CPTabView: remove duplicate code. 2012-02-10 16:31:45 +01:00
cacaodev 59ce74a3df CPTabView : _selectedIndex was undefined after decoding an empty tab view (no items).
A visible bug was that the first item added was not immediately selected. Updated CPTabViewNib example, shows the bug fixed.
2012-02-10 16:29:50 +01:00
Alexander Ljungberg c7d3ccb13a Add missing header to CPTabView. 2012-01-27 12:33:07 +00:00
Alexander Ljungberg a081f98fd1 Refs #1440. Whitespace cleanup. 2012-01-27 12:32:11 +00:00
cacaodev 7a41282912 CPTabView: Fix a bug where a CPTabView would not reflect immediately the replacement of the selected item's view.
Updated CPTabViewNib to show a setView: on the current item.

If the view changes on a non selected item, the tabView content will be
updated when this item is selected.
2012-01-26 14:45:42 +01:00
cacaodev c8f8c01d2f CPTabView : _setTabView: on newly decoded CPTabViewItems
A CPTabViewItem needs to know about its tabView.
2012-01-26 14:34:52 +01:00
cacaodev 7f6db7bf98 CPTabView: Fix a bug where -selectedTabViewItem was raising instead of returning nil when no tab items (i.e. _selectedItemIndex = -1) and causing nib2cib to fail.
Added An empty Tab View to CPTabViewNib test app.
Needs a jake sudo-install for changes to take effects.
2012-01-26 10:44:46 +01:00
Alexander Ljungberg f0bba44e45 Completed CPTabView documentation. 2011-04-03 17:56:31 -04:00
Aparajita Fishman 044a605e47 Added font methods so that nib2cib can do font substitution 2011-03-28 23:51:45 -04:00
Aparajita Fishman b0af42e236 Removed extra blank line 2011-03-11 12:39:54 -05:00
Aparajita Fishman d303e6e96c Initial commit before testing. 2011-03-08 17:40:41 -05:00
Alexander Ljungberg af30e96b7b Cleanup. 2011-01-14 12:16:51 -03:00
Francisco Ryan Tolmasky I 4db1e28677 Merge branch 'trunk' of https://github.com/meelash/cappuccino into meelash-trunk 2011-01-08 15:27:34 -08:00
meelash d6cbc52790 Fix for issue #302 CPTabViewItem _tabView is not set. Closes #302 2011-01-08 15:15:13 -05:00
Antoine Mercadal ae67b00c4d remove the change in tabViewItemAtIndex: 2011-01-04 20:06:53 +01:00
Antoine Mercadal 29430df66d fix small bugs in CPTabView 2011-01-04 19:36:05 +01:00
Francisco Ryan Tolmasky I e2327fcf94 Fix for remaining delegate reference instead of _delegate in CPTabView.
Closes #1061.

Reviewed by me.
2010-12-26 15:36:06 -08:00
Ross Boucher ab083a3baf Clean up several flaws in CPTabView:
- should not force empty space above and below, but only where the tabs are
- box should fill frame when no tabs are present
- ivars should be prefixed with underscore
- not sure about the current background color code, may revisit
2010-12-15 15:48:42 -08:00
Alexander Ljungberg 04a19543a5 Fix CPTabView decoding to work better with nib2cib. 2010-11-11 20:21:24 -03:00
Alexander Ljungberg ed1c5714a3 Closes #971. Fixed: nib2cib did not work with the new CPTabView. 2010-11-05 13:51:51 -03:00
Alexander Ljungberg dfe03458d0 Fixed: decoding a CPTabView would result in "TypeError: Result of expression 'aRect' [null] is not an object" due to incomplete initialisation. 2010-11-05 13:30:57 -03:00
Antoine Mercadal b9095b2176 box is now resized using CPViewHeightSizable 2010-11-02 13:02:24 +01:00
Francisco Ryan Tolmasky I 52f7844aee Made it so .h files are automatically included in AppKit (avoiding needing to manually include Platform.h, etc.).
Also changed a bunch of <AppKit/*> imports to "*" imports.

Reviewed by me.
2010-11-01 11:10:01 -07:00
Antoine Mercadal 3d82203893 remove 'drunk' code and simply use resizing masks 2010-10-19 22:53:52 +02:00
Antoine Mercadal 560c971aeb capp_lint 2010-10-13 13:41:35 +02:00
Antoine Mercadal 8fc465b63a fix: CPTabView not resizable
fix: delegate problem with uninitialized variable
2010-10-13 13:37:28 +02:00