v0.2.4: improved tabs, and the auto-layout of tabs. They can now be more compact, less wasted space.
This commit is contained in:
parent
cb5cd807b3
commit
a1837d77ae
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
@ -52,11 +52,11 @@ public class Chrome {
|
||||||
case SCROLL:
|
case SCROLL:
|
||||||
return new NinePatch( Asset, 32, 32, 32, 32, 5, 11, 5, 11 );
|
return new NinePatch( Asset, 32, 32, 32, 32, 5, 11, 5, 11 );
|
||||||
case TAB_SET:
|
case TAB_SET:
|
||||||
return new NinePatch( Asset, 64, 0, 20, 20, 6, 6, 6, 6 );
|
return new NinePatch( Asset, 64, 0, 20, 20, 6 );
|
||||||
case TAB_SELECTED:
|
case TAB_SELECTED:
|
||||||
return new NinePatch( Asset, 64, 22, 10, 14, 4, 7, 4, 6 );
|
return new NinePatch( Asset, 65, 22, 8, 13, 3, 7, 3, 5 );
|
||||||
case TAB_UNSELECTED:
|
case TAB_UNSELECTED:
|
||||||
return new NinePatch( Asset, 74, 22, 10, 14, 4, 7, 4, 6 );
|
return new NinePatch( Asset, 75, 22, 8, 13, 3, 7, 3, 5 );
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class WndTabbed extends Window {
|
||||||
protected Tab add( Tab tab ) {
|
protected Tab add( Tab tab ) {
|
||||||
|
|
||||||
tab.setPos( tabs.size() == 0 ?
|
tab.setPos( tabs.size() == 0 ?
|
||||||
-chrome.marginLeft() :
|
-chrome.marginLeft() + 1 :
|
||||||
tabs.get( tabs.size() - 1 ).right(), height );
|
tabs.get( tabs.size() - 1 ).right(), height );
|
||||||
tab.select( false );
|
tab.select( false );
|
||||||
super.add( tab );
|
super.add( tab );
|
||||||
|
@ -102,7 +102,8 @@ public class WndTabbed extends Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void layoutTabs(){
|
public void layoutTabs(){
|
||||||
int fullWidth = width+chrome.marginHor();
|
//subract two as there's extra horizontal space for those nobs on the top.
|
||||||
|
int fullWidth = width+chrome.marginHor()-2;
|
||||||
int numTabs = tabs.size();
|
int numTabs = tabs.size();
|
||||||
|
|
||||||
if (numTabs == 0)
|
if (numTabs == 0)
|
||||||
|
@ -116,7 +117,7 @@ public class WndTabbed extends Window {
|
||||||
int spacing = -1;
|
int spacing = -1;
|
||||||
|
|
||||||
while (spacing == -1) {
|
while (spacing == -1) {
|
||||||
for (int i = 0; i <= 5; i++){
|
for (int i = 0; i <= 3; i++){
|
||||||
if ((fullWidth - i*(spaces)) % numTabs == 0) {
|
if ((fullWidth - i*(spaces)) % numTabs == 0) {
|
||||||
spacing = i;
|
spacing = i;
|
||||||
break;
|
break;
|
||||||
|
@ -130,7 +131,7 @@ public class WndTabbed extends Window {
|
||||||
for (int i = 0; i < tabs.size(); i++){
|
for (int i = 0; i < tabs.size(); i++){
|
||||||
tabs.get(i).setSize(tabWidth, tabHeight());
|
tabs.get(i).setSize(tabWidth, tabHeight());
|
||||||
tabs.get(i).setPos( i == 0 ?
|
tabs.get(i).setPos( i == 0 ?
|
||||||
-chrome.marginLeft() :
|
-chrome.marginLeft() + 1 :
|
||||||
tabs.get( i - 1 ).right() + spacing, height );
|
tabs.get( i - 1 ).right() + spacing, height );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user