//# 0 errors, 45 messages
//#
/*
    //#ThemeToggle.java:1:1: class: com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle
    //#ThemeToggle.java:1:1: method: com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle.com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle__static_init
 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.dmdirc.addons.ui_swing.components.themepanel;

import com.dmdirc.ui.themes.Theme;

/**
 * Wraps a Theme object with a boolean to indicate whether it should be
 * enabled or not.
 * 
 * @author chris
 */
public class ThemeToggle {
    
    /** The Theme object we're wrapping. */
    private final Theme theme;
    
    /** Whether or not to enable it. */
    private boolean enable;

    /**
     * Creates a new instance of ThemeToggle to wrap the specified
     * Theme.
     * 
     * @param theme The theme to be wrapped
     */
    public ThemeToggle(final Theme theme) {
    //#ThemeToggle.java:46: method: void com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle.com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle(Theme)
    //#input(void com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle(Theme)): theme
    //#input(void com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle(Theme)): this
    //#output(void com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle(Theme)): this.enable
    //#output(void com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle(Theme)): this.theme
    //#pre[1] (void com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle(Theme)): theme != null
    //#post(void com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle(Theme)): init'ed(this.enable)
    //#post(void com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle(Theme)): this.theme == theme
    //#post(void com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle(Theme)): this.theme != null
        this.theme = theme;
        enable = theme.isEnabled();
    //#ThemeToggle.java:48: Warning: method not available - call not analyzed
    //#    call on bool com.dmdirc.ui.themes.Theme:isEnabled()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle
    //#    method: void com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle(Theme)
    //#    unanalyzed callee: bool com.dmdirc.ui.themes.Theme:isEnabled()
    }
    //#ThemeToggle.java:49: end of method: void com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle.com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle(Theme)
    
    /**
     * Toggles this theme.
     */
    public void toggle() {
        enable = !enable;
    //#ThemeToggle.java:55: method: void com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle.toggle()
    //#input(void toggle()): this
    //#input(void toggle()): this.enable
    //#output(void toggle()): this.enable
    //#pre[1] (void toggle()): init'ed(this.enable)
    //#post(void toggle()): init'ed(this.enable)
    }
    //#ThemeToggle.java:56: end of method: void com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle.toggle()
    
    /**
     * Gets the state of this ThemeToggle.
     * 
     * @return True if the theme is or should be loaded, false otherwise.
     */
    public boolean getState() {
        return enable;
    //#ThemeToggle.java:64: method: bool com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle.getState()
    //#input(bool getState()): this
    //#input(bool getState()): this.enable
    //#output(bool getState()): return_value
    //#pre[2] (bool getState()): init'ed(this.enable)
    //#post(bool getState()): return_value == this.enable
    //#post(bool getState()): init'ed(return_value)
    //#ThemeToggle.java:64: end of method: bool com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle.getState()
    }

    /**
     * Retrieves the Theme object associated with this toggle.
     * 
     * @return This toggle's theme object.
     */
    public Theme getTheme() {
        return theme;
    //#ThemeToggle.java:73: method: Theme com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle.getTheme()
    //#input(Theme getTheme()): this
    //#input(Theme getTheme()): this.theme
    //#output(Theme getTheme()): return_value
    //#post(Theme getTheme()): return_value == this.theme
    //#post(Theme getTheme()): init'ed(return_value)
    //#ThemeToggle.java:73: end of method: Theme com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle.getTheme()
    }

}
    //#output(com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/components/themepanel/ThemeToggle]
    //#output(com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle__static_init): __Dispatch_Table.getState()Z
    //#output(com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle__static_init): __Dispatch_Table.getTheme()Lcom/dmdirc/ui/themes/Theme;
    //#output(com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle__static_init): __Dispatch_Table.toggle()V
    //#post(com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/components/themepanel/ThemeToggle] == &__Dispatch_Table
    //#post(com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle__static_init): __Dispatch_Table.getState()Z == &getState
    //#post(com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle__static_init): __Dispatch_Table.getTheme()Lcom/dmdirc/ui/themes/Theme; == &getTheme
    //#post(com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle__static_init): __Dispatch_Table.toggle()V == &toggle
    //#ThemeToggle.java:: end of method: com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle.com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle__static_init
    //#ThemeToggle.java:: end of class: com.dmdirc.addons.ui_swing.components.themepanel.ThemeToggle
