use of org.apache.pivot.wtk.CalendarButton in project pivot by apache.
the class TerraCalendarButtonSkin method getPreferredSize.
@Override
public Dimensions getPreferredSize() {
CalendarButton calendarButton = (CalendarButton) getComponent();
Button.DataRenderer dataRenderer = calendarButton.getDataRenderer();
dataRenderer.render(calendarButton.getButtonData(), calendarButton, false);
Dimensions contentSize = dataRenderer.getPreferredSize();
int preferredWidth = contentSize.width + paddingWidth();
int preferredHeight = contentSize.height + paddingHeight();
return new Dimensions(preferredWidth, preferredHeight);
}
use of org.apache.pivot.wtk.CalendarButton in project pivot by apache.
the class TerraCalendarButtonSkin method getBaseline.
@Override
public int getBaseline(int width, int height) {
CalendarButton calendarButton = (CalendarButton) getComponent();
Button.DataRenderer dataRenderer = calendarButton.getDataRenderer();
dataRenderer.render(calendarButton.getButtonData(), calendarButton, false);
int clientWidth = Math.max(width - paddingWidth(), 0);
int clientHeight = Math.max(height - paddingHeight(), 0);
int baseline = dataRenderer.getBaseline(clientWidth, clientHeight);
if (baseline != -1) {
baseline += padding.top + 1;
}
return baseline;
}
Aggregations