You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/11/17 20:49:47 UTC
svn commit: r881463 -
/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
Author: tvolkert
Date: Tue Nov 17 19:49:47 2009
New Revision: 881463
URL: http://svn.apache.org/viewvc?rev=881463&view=rev
Log:
Implemented CardPaneSkin.getBaseline(int,int)
Modified:
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java?rev=881463&r1=881462&r2=881463&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java Tue Nov 17 19:49:47 2009
@@ -411,13 +411,30 @@
@Override
public int getBaseline(int width, int height) {
- // TODO Should this report the baseline of the currently selected card?
- return -1;
+ int baseline = -1;
+
+ if (sizeToSelection) {
+ CardPane cardPane = (CardPane)getComponent();
+ Component selectedCard = cardPane.getSelectedCard();
+
+ if (selectedCard != null) {
+ int cardWidth = Math.max(width - (padding.left + padding.right), 0);
+ int cardHeight = Math.max(height - (padding.top + padding.bottom), 0);
+
+ baseline = selectedCard.getBaseline(cardWidth, cardHeight);
+
+ if (baseline != -1) {
+ baseline += padding.top;
+ }
+ }
+ }
+
+ return baseline;
}
@Override
public void layout() {
- // Set the size of all components to match the size of the stack pane,
+ // Set the size of all components to match the size of the card pane,
// minus padding
CardPane cardPane = (CardPane)getComponent();
int width = Math.max(getWidth() - (padding.left + padding.right), 0);