use of com.spinyowl.legui.icon.CharIcon in project legui by SpinyOwl.
the class SelectBox method initialize.
/**
* Used to initialize selectbox.
*/
private void initialize() {
selectionListPanel.setHorizontalScrollBarVisible(false);
selectionListPanel.getContainer().getStyle().setDisplay(DisplayType.FLEX);
selectionListPanel.getContainer().getStyle().getFlexStyle().setFlexDirection(FlexDirection.COLUMN);
selectionListPanel.getContainer().getStyle().getBackground().setColor(ColorConstants.lightBlue());
this.getStyle().setDisplay(DisplayType.FLEX);
expandIcon = new CharIcon(new Vector2f(expandButton.getSize()), DEFAULT_ICON_FONT, (char) EXPAND_ICON_CHAR, ColorConstants.black());
collapseIcon = new CharIcon(new Vector2f(expandButton.getSize()), DEFAULT_ICON_FONT, (char) COLLAPSE_ICON_CHAR, ColorConstants.black());
expandButton.getStyle().getBackground().setIcon(expandIcon);
expandButton.getStyle().setMinimumSize(buttonWidth, 0);
expandButton.getStyle().setMaximumSize(buttonWidth, Float.MAX_VALUE);
expandButton.getStyle().setRight(0f);
expandButton.getStyle().setTop(0f);
expandButton.getStyle().setBottom(0f);
selectionButton.getStyle().setTop(0f);
selectionButton.getStyle().setLeft(0f);
selectionButton.getStyle().setBottom(0f);
selectionButton.getStyle().setRight(buttonWidth);
this.add(expandButton);
this.add(selectionButton);
MouseClickEventListener mouseClickEventListener = new SelectBoxClickListener<>(this);
selectionButton.getListenerMap().addListener(MouseClickEvent.class, mouseClickEventListener);
expandButton.getListenerMap().addListener(MouseClickEvent.class, mouseClickEventListener);
selectBoxLayer.getListenerMap().addListener(MouseClickEvent.class, mouseClickEventListener);
FocusEventListener focusEventListener = new SelectBoxFocusListener<>(this);
selectionListPanel.getVerticalScrollBar().getListenerMap().getListeners(FocusEvent.class).add(focusEventListener);
selectionButton.getListenerMap().getListeners(FocusEvent.class).add(focusEventListener);
expandButton.getListenerMap().getListeners(FocusEvent.class).add(focusEventListener);
selectBoxLayer.add(selectionListPanel);
SelectBoxAnimation animation = new SelectBoxAnimation(this, selectionListPanel);
animation.startAnimation();
Themes.getDefaultTheme().getThemeManager().getComponentTheme(SelectBox.class).applyAll(this);
}
use of com.spinyowl.legui.icon.CharIcon in project legui by SpinyOwl.
the class FlatSelectBoxTheme method apply.
/**
* Used to apply theme only for component and not apply for child components.
*
* @param component component to apply theme.
*/
@Override
public void apply(T component) {
super.apply(component);
Button expandButton = component.getExpandButton();
expandButton.getStyle().setShadow(null);
expandButton.getStyle().getBackground().setColor(ColorConstants.transparent());
Button selectionButton = component.getSelectionButton();
selectionButton.getStyle().setShadow(null);
selectionButton.getStyle().getBackground().setColor(ColorConstants.transparent());
Icon collapseIcon = component.getCollapseIcon();
if (collapseIcon instanceof CharIcon) {
CharIcon bgIcon = (CharIcon) collapseIcon;
bgIcon.setColor(ColorUtil.oppositeBlackOrWhite(settings.backgroundColor()));
bgIcon.setHorizontalAlign(HorizontalAlign.CENTER);
bgIcon.setVerticalAlign(VerticalAlign.MIDDLE);
}
Icon expandIcon = component.getExpandIcon();
if (expandIcon instanceof CharIcon) {
CharIcon bgIcon = (CharIcon) expandIcon;
bgIcon.setColor(ColorUtil.oppositeBlackOrWhite(settings.backgroundColor()));
bgIcon.setHorizontalAlign(HorizontalAlign.CENTER);
bgIcon.setVerticalAlign(VerticalAlign.MIDDLE);
}
}
use of com.spinyowl.legui.icon.CharIcon in project legui by SpinyOwl.
the class FlatCheckBoxTheme method apply.
/**
* Used to apply theme only for component and not apply for child components.
*
* @param component component to apply theme.
*/
@Override
public void apply(T component) {
super.apply(component);
component.setIconUnchecked(new CharIcon(new Vector2f(14), MATERIAL_ICONS_REGULAR, (char) 0xE835, ColorUtil.oppositeBlackOrWhite(settings.backgroundColor())));
component.setIconChecked(new CharIcon(new Vector2f(14), MATERIAL_ICONS_REGULAR, (char) 0xE834, ColorUtil.oppositeBlackOrWhite(settings.backgroundColor())));
component.getIconUnchecked().setHorizontalAlign(HorizontalAlign.LEFT);
component.getIconChecked().setHorizontalAlign(HorizontalAlign.LEFT);
}
use of com.spinyowl.legui.icon.CharIcon in project legui by SpinyOwl.
the class FlatWidgetTheme method applyAll.
/**
* Used to apply theme for component and for all children of this component. Should be
* reimplemented for components that contains other child components.
*
* @param component component to apply theme.
*/
@Override
public void applyAll(T component) {
super.apply(component);
component.getStyle().getBackground().setColor(settings.backgroundColor());
Button minimizeButton = component.getMinimizeButton();
minimizeButton.getStyle().getBackground().setColor(settings.borderColor());
minimizeButton.getStyle().setShadow(null);
Button closeButton = component.getCloseButton();
closeButton.getStyle().getBackground().setColor(settings.borderColor());
closeButton.getStyle().setShadow(null);
Component titleContainer = component.getTitleContainer();
titleContainer.getStyle().getBackground().setColor(settings.borderColor());
Button resizeButton = component.getResizeButton();
resizeButton.getStyle().setBorder(null);
resizeButton.getStyle().getBackground().setColor(ColorConstants.transparent());
resizeButton.getHoveredStyle().getBackground().setColor(ColorConstants.transparent());
resizeButton.getPressedStyle().getBackground().setColor(ColorConstants.transparent());
CharIcon icon = new CharIcon(FontRegistry.MATERIAL_DESIGN_ICONS, '\uF45D');
icon.setHorizontalAlign(HorizontalAlign.RIGHT);
icon.setVerticalAlign(VerticalAlign.BOTTOM);
icon.setColor(settings.textColor());
resizeButton.getStyle().getBackground().setIcon(icon);
resizeButton.getStyle().setShadow(null);
component.getTitle().getStyle().setPadding(3f, 5f);
Icon closeIcon = component.getCloseIcon();
if (closeIcon instanceof CharIcon) {
CharIcon bgIcon = (CharIcon) closeIcon;
bgIcon.setColor(settings.textColor());
bgIcon.setHorizontalAlign(HorizontalAlign.CENTER);
bgIcon.setVerticalAlign(VerticalAlign.MIDDLE);
}
Icon minimizeIcon = component.getMinimizeIcon();
if (minimizeIcon instanceof CharIcon) {
CharIcon bgIcon = (CharIcon) minimizeIcon;
bgIcon.setColor(settings.textColor());
bgIcon.setHorizontalAlign(HorizontalAlign.CENTER);
bgIcon.setVerticalAlign(VerticalAlign.MIDDLE);
}
Icon maximizeIcon = component.getMaximizeIcon();
if (maximizeIcon instanceof CharIcon) {
CharIcon bgIcon = (CharIcon) maximizeIcon;
bgIcon.setColor(settings.textColor());
bgIcon.setHorizontalAlign(HorizontalAlign.CENTER);
bgIcon.setVerticalAlign(VerticalAlign.MIDDLE);
}
Themes.getDefaultTheme().applyAll(component.getContainer());
component.getContainer().getStyle().setShadow(null);
}
use of com.spinyowl.legui.icon.CharIcon in project legui by SpinyOwl.
the class FlatRadioButtonTheme method apply.
/**
* Used to apply theme only for component and not apply for child components.
*
* @param component component to apply theme.
*/
@Override
public void apply(T component) {
super.apply(component);
component.setIconUnchecked(new CharIcon(new Vector2f(14), MATERIAL_ICONS_REGULAR, (char) 0xE836, ColorUtil.oppositeBlackOrWhite(settings.backgroundColor())));
component.setIconChecked(new CharIcon(new Vector2f(14), MATERIAL_ICONS_REGULAR, (char) 0xE837, ColorUtil.oppositeBlackOrWhite(settings.backgroundColor())));
component.getIconUnchecked().setHorizontalAlign(HorizontalAlign.LEFT);
component.getIconChecked().setHorizontalAlign(HorizontalAlign.LEFT);
}
Aggregations