/* Network-Integrated Multimedia Middleware (NMM)
 * http://www.motama.com/nmm.html
 *
 * Copyright (C) 2006-2007
 * Motama GmbH, Saarbruecken, Germany
 * http://www.motama.com
 *
 * This file is part of NMM. 
 * 
 * NMM is free software; you can redistribute it and/or modify it    
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; only version 2 of the License.      
 * 
 * NMM is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 
 * License for more details.  
 * 
 * You should have received a copy of the GNU General Public License 
 * along with NMM; if not, write to the Free Software Foundation,    
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

#include "IWidget.idl"
#include "IWindow.idl"
#include "IBitmapReader.idl"

module NMM {
  
  /**
   * OSD Manager.
   * Interface for a OSD manager.
   */
  interface IOSDManager {
    
    /**
     * add font to list
     * @param id font identifier
     * @param xmfilename filename of the XML file where the font is described
     * @param fontname as a XML font file can describe several fonts, this parameter describes
     *        the desired fontname, if this name is empty, the first font is loaded
     */
    Result loadFont( in string id, in string xmlfilename, in string fontname );
    
    /**
     * Get list of all fonts.
     */
    list<string> getFontList() const;
    
    /**
     * Update the OSD.
     * This will update all widgets.
     */
    Result update();
    
    
    /**
     * Get widget.
     * Returns an interface to access a widget.
     * @param id widget id
     * @return an interface to access the widget
     */
    IWidget* getWidget(in nmm_int32 id);
    
    /**
     * Get window.
     * Returns an interface to access the window of a widget.
     * @param id window id
     * @return an interface to access the window
     */
    IWindow* getWindow(in nmm_int32 id);
    
    
    /**
     * Create a window.
     * Creates a new window and returns an interface for it.
     * @return interface for window
     */
    IWindow* createWindow();
    
    /**
     * Deletes a window.
     * Removes the window from the manager's window list and destroys it.
     */
    void deleteWindow( in IWindow window );
    
    
    /** Delete a widget. */
    void deleteWidget( in IWidget widget);
    
    
    /**
     * Display a message.
     * @param header message header
     * @param text message text
     * @param label1 button label 1 text
     * @param label2 button label 2 text
     * @param label3 button label 3 text
     * @param sel initial selection
     */
    Result displayMessage( in string header, in string text, in string label1, in string label2="",
                           in string label3="", in nmm_uint32 sel=0 );
    
    /** Delete current message. */
    Result deleteMessage();
    
    
    /**
     * Display time.
     * @param header header text
     * @param x x position
     * @param y y position
     */
    Result displayTime( in string header="", in nmm_uint32 x = 500, in nmm_uint32 y = 410 );    
    Result createTime( in nmm_bool ct );
    Result resetTime();
    Result hideTime();
    Result setTime(in nmm_uint64 time);
    nmm_uint64 getTime();
    
    /**
     * Display symbol.
     * @param symbol symbol id
     * @param x x position
     * @param y y position
     */
    Result displaySymbol( in string symbol, in nmm_uint32 x = 600, in nmm_uint32 y = 50 );
    Result hideSymbol();
    
    Result displayProgressBar( in string header="", in nmm_uint32 x = 50, in nmm_uint32 y = 470, in nmm_uint32 width = 620 );
    Result hideProgressBar();
    void setMaxProgress( in nmm_uint64 max );
    void setProgress( in nmm_uint64 progress );
    void updateProgress();

    /**
     * Displays the color bar which can be used to show the functionality of the four color buttons of a remote control.
     * @param x x position
     * @param y y position
     */
    Result displayColorBar(in nmm_uint32 x = 80, in nmm_uint32 y = 480);

    /**
     * Hides the color bar. 
     */
    Result hideColorBar();

    /**
     * Sets the text of all four color fields in the color bar.
     */
    void setColorBarText(in string red, in string green, in string yellow, in string blue);

    /**
     * Sets the text of the red color field in the color bar.
     */
    void setRedColorBarText(in string text);

    /**
     * Sets the text of the green color field in the color bar.
     */
    void setGreenColorBarText(in string text);

    /**
     * Sets the text of the yellow color field in the color bar.
     */
    void setYellowColorBarText(in string text);

    /**
     * Sets the text of the blue color field in the color bar.
     */
    void setBlueColorBarText(in string text);

    /**
     * Returns the text of the red color field in the color bar.
     */
    string getRedColorBarText();

    /**
     * Returns the text of the green color field in the color bar.
     */
    string getGreenColorBarText();

    /**
     * Returns the text of the yellow color field in the color bar.
     */
    string getYellowColorBarText();

    /**
     * Returns the text of the blue color field in the color bar.
     */
    string getBlueColorBarText();
    
    Result messageLeft();
    Result messageRight();
    string messageID();
    
    /**
     * Set pause mode.
     * the pause flag is a hint to the OSD manager that it receives no buffers and must set its
     * working flag explicitely to redraw the OSD whenever it has been updated.
     */
    void setPause(in nmm_bool value);
    
    /**
     * Send pause event.
     * Make the OSD manager send a pause event.
     */
    void sendPauseEvent();
    
    IBitmapReader* getBitmapReader();
    
    
    /**
     * Gets width and height of a character.
     * @param id font id
     * @param c character that dimension is desired
     * @param x here the width is saved
     * @param y here the height is saved
     */
    void checkCharDimension( in string id, in nmm_uchar c, out nmm_uint32 x, out nmm_uint32 y ) const;
    
    /**
     * Get maximum width of font.
     * @param id font id
     * @return the maximum width of a character
     */
    nmm_uint32 getMaxWidth( in string id ) const;
    
    /**
     * Get maximum height of font.
     * @param id font id
     * @return the maximum height of a character
     */
    nmm_uint32 getMaxHeight( in string id ) const;
    
    /**
     * Set space (pixels) between 2 lines.
     * @param id font id
     */
    void setLineSpace( in string id, in nmm_uint32 space );
    
    /**
     * Get line space.
     * @param id font id
     */
    nmm_uint32 getLineSpace( in string id ) const;
  };
}
