Search in sources :

Example 1 with LookAndFeel

use of com.codename1.ui.plaf.LookAndFeel in project CodenameOne by codenameone.

the class MenuBar method createMenuCancelCommand.

/**
 * Factory method that returns the Form Menu cancel Command.
 * This method can be overridden to customize the Command on the Form.
 *
 * @return Command
 */
protected Command createMenuCancelCommand() {
    UIManager manager = parent.getUIManager();
    LookAndFeel lf = manager.getLookAndFeel();
    return new Command(manager.localize("cancel", "Cancel"), lf.getMenuIcons()[1]);
}
Also used : UIManager(com.codename1.ui.plaf.UIManager) LookAndFeel(com.codename1.ui.plaf.LookAndFeel)

Example 2 with LookAndFeel

use of com.codename1.ui.plaf.LookAndFeel in project CodenameOne by codenameone.

the class MenuBar method createMenuSelectCommand.

/**
 * Factory method that returns the Form Menu select Command.
 * This method can be overridden to customize the Command on the Form.
 *
 * @return Command
 */
protected Command createMenuSelectCommand() {
    UIManager manager = parent.getUIManager();
    LookAndFeel lf = manager.getLookAndFeel();
    return new Command(manager.localize("select", "Select"), lf.getMenuIcons()[0]);
}
Also used : UIManager(com.codename1.ui.plaf.UIManager) LookAndFeel(com.codename1.ui.plaf.LookAndFeel)

Example 3 with LookAndFeel

use of com.codename1.ui.plaf.LookAndFeel in project CodenameOne by codenameone.

the class TextArea method initLaf.

/**
 * {@inheritDoc}
 */
protected void initLaf(UIManager uim) {
    super.initLaf(uim);
    setSelectCommandText(uim.localize("edit", "Edit"));
    LookAndFeel laf = uim.getLookAndFeel();
    setSmoothScrolling(laf.isDefaultSmoothScrolling());
}
Also used : LookAndFeel(com.codename1.ui.plaf.LookAndFeel)

Example 4 with LookAndFeel

use of com.codename1.ui.plaf.LookAndFeel in project CodenameOne by codenameone.

the class Container method initLaf.

/**
 * {@inheritDoc}
 */
protected void initLaf(UIManager uim) {
    if (uim == getUIManager() && isInitialized()) {
        return;
    }
    super.initLaf(uim);
    LookAndFeel laf = uim.getLookAndFeel();
    setSmoothScrolling(laf.isDefaultSmoothScrolling());
    if (components != null) {
        int count = getComponentCount();
        for (int i = 0; i < count; i++) {
            Component c = getComponentAt(i);
            c.initLaf(uim);
        }
    }
}
Also used : LookAndFeel(com.codename1.ui.plaf.LookAndFeel)

Example 5 with LookAndFeel

use of com.codename1.ui.plaf.LookAndFeel in project CodenameOne by codenameone.

the class MenuBar method initMenuBar.

/**
 * Initialize the MenuBar
 *
 * @param parent the associated Form
 */
protected void initMenuBar(Form parent) {
    this.parent = parent;
    selectMenuItem = createMenuSelectCommand();
    cancelMenuItem = createMenuCancelCommand();
    UIManager manager = parent.getUIManager();
    LookAndFeel lf = manager.getLookAndFeel();
    // don't minimize the app if it's a Dialog
    minimizeOnBack = manager.isThemeConstant("minimizeOnBackBool", true) && !(parent instanceof Dialog);
    hideEmptyCommands = manager.isThemeConstant("hideEmptyCommandsBool", false);
    menuStyle = manager.getComponentStyle("Menu");
    setUIID("SoftButton");
    menuCommand = new Command(manager.localize("menu", "Menu"), lf.getMenuIcons()[2]);
    // use the slide transition by default
    if (lf.getDefaultMenuTransitionIn() != null || lf.getDefaultMenuTransitionOut() != null) {
        transitionIn = lf.getDefaultMenuTransitionIn();
        transitionOut = lf.getDefaultMenuTransitionOut();
    } else {
        transitionIn = CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL, true, 300, true);
        transitionOut = CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL, false, 300, true);
    }
    menuCellRenderer = lf.getMenuRenderer();
    int softkeyCount = Display.getInstance().getImplementation().getSoftkeyCount();
    thirdSoftButton = Display.getInstance().isThirdSoftButton();
    int commandBehavior = getCommandBehavior();
    if (softkeyCount > 1 && commandBehavior < Display.COMMAND_BEHAVIOR_BUTTON_BAR) {
        if (thirdSoftButton) {
            setLayout(new GridLayout(1, 3));
            soft = new Button[] { createSoftButton("SoftButtonCenter"), createSoftButton("SoftButtonLeft"), createSoftButton("SoftButtonRight") };
            main = soft[0];
            left = soft[1];
            right = soft[2];
            if (parent.isRTL()) {
                right.setUIID("SoftButtonLeft");
                left.setUIID("SoftButtonRight");
                addComponent(right);
                addComponent(main);
                addComponent(left);
            } else {
                addComponent(left);
                addComponent(main);
                addComponent(right);
            }
            if (isReverseSoftButtons()) {
                Button b = soft[1];
                soft[1] = soft[2];
                soft[2] = b;
            }
        } else {
            setLayout(new GridLayout(1, 2));
            soft = new Button[] { createSoftButton("SoftButtonLeft"), createSoftButton("SoftButtonRight") };
            main = soft[0];
            left = soft[0];
            right = soft[1];
            if (parent.isRTL()) {
                right.setUIID("SoftButtonLeft");
                left.setUIID("SoftButtonRight");
                addComponent(right);
                addComponent(left);
            } else {
                addComponent(left);
                addComponent(right);
            }
            if (isReverseSoftButtons()) {
                Button b = soft[0];
                soft[0] = soft[1];
                soft[1] = b;
            }
        }
        // It doesn't make sense for softbuttons to have ... at the end
        for (int iter = 0; iter < soft.length; iter++) {
            soft[iter].setEndsWith3Points(false);
        }
    } else {
        // special case for touch screens we still want the 3 softbutton areas...
        if (thirdSoftButton) {
            setLayout(new GridLayout(1, 3));
            soft = new Button[] { createSoftButton("SoftButtonCenter"), createSoftButton("SoftButtonLeft"), createSoftButton("SoftButtonRight") };
            main = soft[0];
            left = soft[1];
            right = soft[2];
            addComponent(left);
            addComponent(main);
            addComponent(right);
            if (isReverseSoftButtons()) {
                Button b = soft[1];
                soft[1] = soft[2];
                soft[2] = b;
            }
        } else {
            soft = new Button[] { createSoftButton("SoftButtonCenter") };
        }
    }
    softCommand = new Command[soft.length];
}
Also used : GridLayout(com.codename1.ui.layouts.GridLayout) UIManager(com.codename1.ui.plaf.UIManager) LookAndFeel(com.codename1.ui.plaf.LookAndFeel)

Aggregations

LookAndFeel (com.codename1.ui.plaf.LookAndFeel)9 UIManager (com.codename1.ui.plaf.UIManager)5 BubbleTransition (com.codename1.ui.animations.BubbleTransition)1 Transition (com.codename1.ui.animations.Transition)1 BorderLayout (com.codename1.ui.layouts.BorderLayout)1 GridLayout (com.codename1.ui.layouts.GridLayout)1 DefaultLookAndFeel (com.codename1.ui.plaf.DefaultLookAndFeel)1