Prevent being able to scroll options panel

This commit is contained in:
drdev
2014-07-25 05:23:37 +00:00
parent e0806e5d14
commit 0d46e58dbc
3 changed files with 9 additions and 18 deletions

View File

@@ -381,7 +381,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
} }
@Override @Override
protected float layoutOptionsPanel(float visibleWidth, float height) { protected void layoutOptionsPanel(float width, float height) {
float padding = ItemFilter.PADDING; float padding = ItemFilter.PADDING;
float x = 0; float x = 0;
float h = FTextField.getDefaultHeight(ItemFilter.DEFAULT_FONT); float h = FTextField.getDefaultHeight(ItemFilter.DEFAULT_FONT);
@@ -393,7 +393,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
//determine width of combo boxes based on available width versus auto-size widths //determine width of combo boxes based on available width versus auto-size widths
float lblPileByWidth = lblPileBy.getAutoSizeBounds().width; float lblPileByWidth = lblPileBy.getAutoSizeBounds().width;
float availableComboBoxWidth = visibleWidth - x - lblPileByWidth - padding; float availableComboBoxWidth = width - x - lblPileByWidth - padding;
float groupByWidth = availableComboBoxWidth * 0.6f; float groupByWidth = availableComboBoxWidth * 0.6f;
float pileByWidth = availableComboBoxWidth - groupByWidth; float pileByWidth = availableComboBoxWidth - groupByWidth;
@@ -402,9 +402,6 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
lblPileBy.setBounds(x, y, lblPileByWidth, h); lblPileBy.setBounds(x, y, lblPileByWidth, h);
x += lblPileByWidth; x += lblPileByWidth;
cbPileByOptions.setBounds(x, y, pileByWidth, h); cbPileByOptions.setBounds(x, y, pileByWidth, h);
x += pileByWidth + padding;
return x;
} }
private void updateLayout(boolean forRefresh) { private void updateLayout(boolean forRefresh) {

View File

@@ -209,8 +209,7 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
} }
@Override @Override
protected float layoutOptionsPanel(float visibleWidth, float height) { protected void layoutOptionsPanel(float width, float height) {
return visibleWidth;
} }
public final class ItemList extends FList<Entry<T, Integer>> { public final class ItemList extends FList<Entry<T, Integer>> {

View File

@@ -10,6 +10,7 @@ import forge.itemmanager.ItemColumn;
import forge.itemmanager.ItemManager; import forge.itemmanager.ItemManager;
import forge.itemmanager.ItemManagerConfig; import forge.itemmanager.ItemManagerConfig;
import forge.itemmanager.ItemManagerModel; import forge.itemmanager.ItemManagerModel;
import forge.toolbox.FContainer;
import forge.toolbox.FEvent; import forge.toolbox.FEvent;
import forge.toolbox.FEvent.FEventHandler; import forge.toolbox.FEvent.FEventHandler;
import forge.toolbox.FEvent.FEventType; import forge.toolbox.FEvent.FEventType;
@@ -86,18 +87,12 @@ public abstract class ItemView<T extends InventoryItem> {
return false; return false;
} }
protected abstract float getScrollHeight(); protected abstract float getScrollHeight();
protected abstract float layoutOptionsPanel(float visibleWidth, float height); protected abstract void layoutOptionsPanel(float visibleWidth, float height);
private class OptionsPanel extends FScrollPane { private class OptionsPanel extends FContainer {
@Override @Override
protected ScrollBounds layoutAndGetScrollBounds(float visibleWidth, float visibleHeight) { protected void doLayout(float width, float height) {
return new ScrollBounds(layoutOptionsPanel(visibleWidth, visibleHeight), visibleHeight); layoutOptionsPanel(width, height);
}
@Override
public void drawOverlay(Graphics g) {
super.drawOverlay(g);
g.drawLine(1, BORDER_COLOR, 0, 0, getWidth(), 0);
} }
} }
@@ -123,7 +118,7 @@ public abstract class ItemView<T extends InventoryItem> {
return scroller; return scroller;
} }
public FScrollPane getPnlOptions() { public FContainer getPnlOptions() {
return pnlOptions; return pnlOptions;
} }