Commit 1de38f36 authored by Aneta Steimarova's avatar Aneta Steimarova

#909 Added scrollbar to Hall of fame

parent 16ae615d
......@@ -17,16 +17,23 @@
package cz.nic.tablexia.util.ui;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import cz.nic.tablexia.loader.application.ApplicationAtlasManager;
/**
* Created by drahomir on 4/4/16.
*/
public class ScrollPaneWithBorders extends ScrollPane{
private static final float SCROLL_SIZE = 10f;
private static final Color SCROLL_COLOR = new Color(0.f,0,0,0.1f);
private static final Color KNOB_COLOR = new Color(0,0,0,0.35f);
private float lastScrollX;
private Image leftBorder, rightBorder;
......@@ -53,6 +60,20 @@ public class ScrollPaneWithBorders extends ScrollPane{
singleBorder = true;
this.rightBorder = leftBorder;
}
this.setStyle(initScrollPaneStyle());
}
private ScrollPaneStyle initScrollPaneStyle() {
ScrollPane.ScrollPaneStyle style = new ScrollPane.ScrollPaneStyle();
style.hScrollKnob = getScrollRegionDrawable(KNOB_COLOR);
style.hScroll = getScrollRegionDrawable(SCROLL_COLOR);
return style;
}
private TextureRegionDrawable getScrollRegionDrawable(Color color){
TextureRegionDrawable regionDrawable = new TextureRegionDrawable(ApplicationAtlasManager.getInstance().getColorTextureRegion(color));
regionDrawable.setMinHeight(SCROLL_SIZE);
return regionDrawable;
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment