Commit bebef5dc authored by JP Dinger's avatar JP Dinger

Skins2: Cosmetics, 100% pure. We don't indent for labels in C, we don't in C++.

parent b25aa5bf
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef ASYNC_QUEUE_HPP
......@@ -36,38 +36,38 @@ class OSTimer;
/// Asynchronous queue for commands
class AsyncQueue: public SkinObject
{
public:
/// Get the instance of AsyncQueue
/// Returns NULL if initialization failed.
static AsyncQueue *instance( intf_thread_t *pIntf );
public:
/// Get the instance of AsyncQueue
/// Returns NULL if initialization failed.
static AsyncQueue *instance( intf_thread_t *pIntf );
/// Destroy the instance of AsyncQueue
static void destroy( intf_thread_t *pIntf );
/// Destroy the instance of AsyncQueue
static void destroy( intf_thread_t *pIntf );
/// Add a command in the queue, after having removed the commands
/// of the same type already in the queue if needed
void push( const CmdGenericPtr &rcCommand, bool removePrev = true );
/// Add a command in the queue, after having removed the commands
/// of the same type already in the queue if needed
void push( const CmdGenericPtr &rcCommand, bool removePrev = true );
/// Remove the commands of the given type
void remove( const string &rType , const CmdGenericPtr &rcCommand );
/// Remove the commands of the given type
void remove( const string &rType , const CmdGenericPtr &rcCommand );
/// Flush the queue and execute the commands
void flush();
/// Flush the queue and execute the commands
void flush();
private:
/// Command queue
list<CmdGenericPtr> m_cmdList;
/// Timer
OSTimer *m_pTimer;
/// Mutex
vlc_mutex_t m_lock;
private:
/// Command queue
list<CmdGenericPtr> m_cmdList;
/// Timer
OSTimer *m_pTimer;
/// Mutex
vlc_mutex_t m_lock;
// Private because it is a singleton
AsyncQueue( intf_thread_t *pIntf );
virtual ~AsyncQueue();
// Private because it is a singleton
AsyncQueue( intf_thread_t *pIntf );
virtual ~AsyncQueue();
// Callback to flush the queue
DEFINE_CALLBACK( AsyncQueue, Flush );
// Callback to flush the queue
DEFINE_CALLBACK( AsyncQueue, Flush );
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_ADD_ITEM_HPP
......@@ -32,22 +32,18 @@
/// "Add item" command
class CmdAddItem: public CmdGeneric
{
public:
CmdAddItem( intf_thread_t *pIntf, const string &rName, bool playNow ):
CmdGeneric( pIntf ), m_name( rName ), m_playNow( playNow ) {}
virtual ~CmdAddItem() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "add item"; }
private:
/// Name of the item to enqueue
string m_name;
/// Should we play the item immediately?
bool m_playNow;
public:
CmdAddItem( intf_thread_t *pIntf, const string &rName, bool playNow )
: CmdGeneric( pIntf ), m_name( rName ), m_playNow( playNow ) { }
virtual ~CmdAddItem() { }
virtual void execute();
virtual string getType() const { return "add item"; }
private:
/// Name of the item to enqueue
string m_name;
/// Should we play the item immediately?
bool m_playNow;
};
#endif
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_AUDIO_HPP
......@@ -29,20 +29,16 @@
/// Command to enable/disable the equalizer
class CmdSetEqualizer: public CmdGeneric
{
public:
CmdSetEqualizer( intf_thread_t *pIntf, bool iEnable ):
CmdGeneric( pIntf ), m_enable( iEnable ) {}
virtual ~CmdSetEqualizer() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "set equalizer"; }
private:
/// Enable or disable the equalizer
bool m_enable;
public:
CmdSetEqualizer( intf_thread_t *pIntf, bool iEnable )
: CmdGeneric( pIntf ), m_enable( iEnable ) { }
virtual ~CmdSetEqualizer() { }
virtual void execute();
virtual string getType() const { return "set equalizer"; }
private:
/// Enable or disable the equalizer
bool m_enable;
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_CHANGE_SKIN_HPP
......@@ -31,20 +31,16 @@
/// "Change Skin" command
class CmdChangeSkin: public CmdGeneric
{
public:
CmdChangeSkin( intf_thread_t *pIntf, const string &rFile ):
CmdGeneric( pIntf ), m_file( rFile ) {}
virtual ~CmdChangeSkin() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "change skin"; }
private:
/// Skin file to load
string m_file;
public:
CmdChangeSkin( intf_thread_t *pIntf, const string &rFile ):
CmdGeneric( pIntf ), m_file( rFile ) { }
virtual ~CmdChangeSkin() { }
virtual void execute();
virtual string getType() const { return "change skin"; }
private:
/// Skin file to load
string m_file;
};
#endif
......@@ -17,68 +17,65 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_GENERIC_HPP
#define CMD_GENERIC_HPP
#include <string>
#include "../src/skin_common.hpp"
#include "../utils/pointer.hpp"
#include <string>
/// Macro to define the prototype of simple commands
#define DEFINE_COMMAND( name, type ) \
class Cmd##name: public CmdGeneric \
{ \
public: \
Cmd##name( intf_thread_t *pIntf ): CmdGeneric( pIntf ) {} \
virtual ~Cmd##name() {} \
virtual void execute(); \
virtual string getType() const { return type; } \
\
#define DEFINE_COMMAND( name, type ) \
class Cmd##name: public CmdGeneric \
{ public: \
Cmd##name( intf_thread_t *pIntf ): CmdGeneric( pIntf ) { } \
virtual ~Cmd##name() { } \
virtual void execute(); \
virtual string getType() const { return type; } \
};
/// Macro to define a "callback" command inside a class
#define DEFINE_CALLBACK( parent, action ) \
class Cmd##action: public CmdGeneric \
{ \
public: \
Cmd##action( parent *pParent ): \
CmdGeneric( pParent->getIntf() ), m_pParent( pParent ) {} \
virtual ~Cmd##action() {} \
virtual void execute(); \
virtual string getType() const { return "Cmd" #parent #action; } \
private: \
parent *m_pParent; \
\
} m_cmd##action; \
#define DEFINE_CALLBACK( parent, action ) \
class Cmd##action: public CmdGeneric \
{ \
public: \
Cmd##action( parent *pParent ): \
CmdGeneric( pParent->getIntf() ), m_pParent( pParent ) { } \
virtual ~Cmd##action() { } \
virtual void execute(); \
virtual string getType() const { return "Cmd" #parent #action; } \
private: \
parent *m_pParent; \
} m_cmd##action; \
friend class Cmd##action;
/// Base class for skins commands
class CmdGeneric: public SkinObject
{
public:
virtual ~CmdGeneric() {}
public:
virtual ~CmdGeneric() { }
/// This method does the real job of the command
virtual void execute() = 0;
/// This method does the real job of the command
virtual void execute() = 0;
/// Return the type of the command
virtual string getType() const { return ""; }
/// Return the type of the command
virtual string getType() const { return ""; }
/// During queue reductions, check if we really want to remove
/// this command.
virtual bool checkRemove( CmdGeneric * ) const { return true; }
/// During queue reductions, check if we really want to remove
/// this command.
virtual bool checkRemove( CmdGeneric * ) const { return true; }
protected:
CmdGeneric( intf_thread_t *pIntf ): SkinObject( pIntf ) {}
protected:
CmdGeneric( intf_thread_t *pIntf ): SkinObject( pIntf ) { }
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_LAYOUT_HPP
......@@ -33,20 +33,16 @@ class GenericLayout;
/// "Change layout" command
class CmdLayout: public CmdGeneric
{
public:
CmdLayout( intf_thread_t *pIntf, TopWindow &rWindow,
GenericLayout &rLayout );
virtual ~CmdLayout() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "change layout"; }
private:
TopWindow &m_rWindow;
GenericLayout &m_rLayout;
public:
CmdLayout( intf_thread_t *pIntf, TopWindow &rWindow,
GenericLayout &rLayout );
virtual ~CmdLayout() { }
virtual void execute();
virtual string getType() const { return "change layout"; }
private:
TopWindow &m_rWindow;
GenericLayout &m_rLayout;
};
#endif
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_MINIMIZE_HPP
......@@ -36,48 +36,40 @@ DEFINE_COMMAND(Restore, "restore" )
/// Command to maximize a window
class CmdMaximize: public CmdGeneric
{
public:
/// Maximize the given layout
CmdMaximize( intf_thread_t *pIntf, WindowManager &rWindowManager,
TopWindow &rWindow );
virtual ~CmdMaximize() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "maximize"; }
private:
WindowManager &m_rWindowManager;
TopWindow &m_rWindow;
public:
/// Maximize the given layout
CmdMaximize( intf_thread_t *pIntf, WindowManager &rWindowManager,
TopWindow &rWindow );
virtual ~CmdMaximize() { }
virtual void execute();
virtual string getType() const { return "maximize"; }
private:
WindowManager &m_rWindowManager;
TopWindow &m_rWindow;
};
/// Command to unmaximize a window
class CmdUnmaximize: public CmdGeneric
{
public:
/// Unmaximize the given layout
CmdUnmaximize( intf_thread_t *pIntf, WindowManager &rWindowManager,
TopWindow &rWindow );
virtual ~CmdUnmaximize() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "unmaximize"; }
private:
WindowManager &m_rWindowManager;
TopWindow &m_rWindow;
public:
/// Unmaximize the given layout
CmdUnmaximize( intf_thread_t *pIntf, WindowManager &rWindowManager,
TopWindow &rWindow );
virtual ~CmdUnmaximize() { }
virtual void execute();
virtual string getType() const { return "unmaximize"; }
private:
WindowManager &m_rWindowManager;
TopWindow &m_rWindow;
};
DEFINE_COMMAND(AddInTray, "add in tray" )
DEFINE_COMMAND(RemoveFromTray, "remove from tray" )
DEFINE_COMMAND(AddInTaskBar, "add in taskbar" )
DEFINE_COMMAND(RemoveFromTaskBar, "remove from taskbar" )
DEFINE_COMMAND( AddInTray, "add in tray" )
DEFINE_COMMAND( RemoveFromTray, "remove from tray" )
DEFINE_COMMAND( AddInTaskBar, "add in taskbar" )
DEFINE_COMMAND( RemoveFromTaskBar, "remove from taskbar" )
#endif
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_MUXER_HPP
......@@ -31,20 +31,16 @@
/// This command only contains other commands (composite pattern)
class CmdMuxer: public CmdGeneric
{
public:
CmdMuxer( intf_thread_t *pIntf, const list<CmdGeneric*> &rList ):
CmdGeneric( pIntf ), m_list( rList ) {}
virtual ~CmdMuxer() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "muxer"; }
private:
/// List of commands we will execute sequentially
list<CmdGeneric*> m_list;
public:
CmdMuxer( intf_thread_t *pIntf, const list<CmdGeneric*> &rList ):
CmdGeneric( pIntf ), m_list( rList ) { }
virtual ~CmdMuxer() { }
virtual void execute();
virtual string getType() const { return "muxer"; }
private:
/// List of commands we will execute sequentially
list<CmdGeneric*> m_list;
};
#endif
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_PLAYLIST_HPP
......@@ -32,20 +32,16 @@
/// Command to delete the selected items from a list
class CmdPlaylistDel: public CmdGeneric
{
public:
CmdPlaylistDel( intf_thread_t *pIntf, VarList &rList ):
CmdGeneric( pIntf ), m_rList( rList ) {}
virtual ~CmdPlaylistDel() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playlist del"; }
private:
/// List
VarList &m_rList;
public:
CmdPlaylistDel( intf_thread_t *pIntf, VarList &rList )
: CmdGeneric( pIntf ), m_rList( rList ) { }
virtual ~CmdPlaylistDel() { }
virtual void execute();
virtual string getType() const { return "playlist del"; }
private:
/// List
VarList &m_rList;
};
......@@ -65,100 +61,80 @@ DEFINE_COMMAND( PlaylistFirst, "playlist first" )
/// Command to set the random state
class CmdPlaylistRandom: public CmdGeneric
{
public:
CmdPlaylistRandom( intf_thread_t *pIntf, bool value ):
CmdGeneric( pIntf ), m_value( value ) {}
virtual ~CmdPlaylistRandom() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playlist random"; }
private:
/// Random state
bool m_value;
public:
CmdPlaylistRandom( intf_thread_t *pIntf, bool value )
: CmdGeneric( pIntf ), m_value( value ) { }
virtual ~CmdPlaylistRandom() { }
virtual void execute();
virtual string getType() const { return "playlist random"; }
private:
/// Random state
bool m_value;
};
/// Command to set the loop state
class CmdPlaylistLoop: public CmdGeneric
{
public:
CmdPlaylistLoop( intf_thread_t *pIntf, bool value ):
CmdGeneric( pIntf ), m_value( value ) {}
virtual ~CmdPlaylistLoop() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playlist loop"; }
private:
/// Loop state
bool m_value;
public:
CmdPlaylistLoop( intf_thread_t *pIntf, bool value )
: CmdGeneric( pIntf ), m_value( value ) { }
virtual ~CmdPlaylistLoop() { }
virtual void execute();
virtual string getType() const { return "playlist loop"; }
private:
/// Loop state
bool m_value;
};
/// Command to set the repeat state
class CmdPlaylistRepeat: public CmdGeneric
{
public:
CmdPlaylistRepeat( intf_thread_t *pIntf, bool value ):
CmdGeneric( pIntf ), m_value( value ) {}
virtual ~CmdPlaylistRepeat() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playlist repeat"; }
private:
/// Repeat state
bool m_value;
public:
CmdPlaylistRepeat( intf_thread_t *pIntf, bool value )
: CmdGeneric( pIntf ), m_value( value ) { }
virtual ~CmdPlaylistRepeat() { }
virtual void execute();
virtual string getType() const { return "playlist repeat"; }
private:
/// Repeat state
bool m_value;
};
/// Command to load a playlist
class CmdPlaylistLoad: public CmdGeneric
{
public:
CmdPlaylistLoad( intf_thread_t *pIntf, const string& rFile ):
CmdGeneric( pIntf ), m_file( rFile ) {}
virtual ~CmdPlaylistLoad() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playlist load"; }
private:
/// Playlist file to load
string m_file;
public:
CmdPlaylistLoad( intf_thread_t *pIntf, const string& rFile )
: CmdGeneric( pIntf ), m_file( rFile ) { }
virtual ~CmdPlaylistLoad() { }
virtual void execute();
virtual string getType() const { return "playlist load"; }
private:
/// Playlist file to load
string m_file;
};
/// Command to save a playlist
class CmdPlaylistSave: public CmdGeneric
{
public:
CmdPlaylistSave( intf_thread_t *pIntf, const string& rFile ):
CmdGeneric( pIntf ), m_file( rFile ) {}
virtual ~CmdPlaylistSave() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playlist save"; }
private:
/// Playlist file to save
string m_file;
public:
CmdPlaylistSave( intf_thread_t *pIntf, const string& rFile )
: CmdGeneric( pIntf ), m_file( rFile ) { }
virtual ~CmdPlaylistSave() { }
virtual void execute();
virtual string getType() const { return "playlist save"; }
private:
/// Playlist file to save
string m_file;
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_PLAYTREE_HPP
......@@ -33,20 +33,16 @@
/// Command to delete the selected items from a tree
class CmdPlaytreeDel: public CmdGeneric
{
public:
CmdPlaytreeDel( intf_thread_t *pIntf, VarTree &rTree ):
CmdGeneric( pIntf ), m_rTree( rTree ) {}
virtual ~CmdPlaytreeDel() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playtree del"; }
private:
/// Tree
VarTree &m_rTree;
public:
CmdPlaytreeDel( intf_thread_t *pIntf, VarTree &rTree )
: CmdGeneric( pIntf ), m_rTree( rTree ) { }
virtual ~CmdPlaytreeDel() { }
virtual void execute();
virtual string getType() const { return "playtree del"; }
private:
/// Tree
VarTree &m_rTree;
};
/// Command to sort the playtree
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_RESIZE_HPP
......@@ -36,83 +36,67 @@ class CtrlVideo;
/// Command to resize a layout
class CmdResize: public CmdGeneric
{
public:
/// Resize the given layout
CmdResize( intf_thread_t *pIntf, const WindowManager &rWindowManager,
GenericLayout &rLayout, int width, int height );
virtual ~CmdResize() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "resize"; }
private:
const WindowManager &m_rWindowManager;
GenericLayout &m_rLayout;
int m_width, m_height;
public:
/// Resize the given layout
CmdResize( intf_thread_t *pIntf, const WindowManager &rWindowManager,
GenericLayout &rLayout, int width, int height );
virtual ~CmdResize() { }
virtual void execute();
virtual string getType() const { return "resize"; }
private:
const WindowManager &m_rWindowManager;
GenericLayout &m_rLayout;
int m_width, m_height;
};
/// Command to resize the inner vout window
class CmdResizeInnerVout: public CmdGeneric
{
public:
/// Resize the given layout
CmdResizeInnerVout( intf_thread_t *pIntf, CtrlVideo* pCtrlVideo );
virtual ~CmdResizeInnerVout() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "resize inner vout"; }
private:
CtrlVideo* m_pCtrlVideo;
public:
/// Resize the given layout
CmdResizeInnerVout( intf_thread_t *pIntf, CtrlVideo* pCtrlVideo );
virtual ~CmdResizeInnerVout() { }
virtual void execute();
virtual string getType() const { return "resize inner vout"; }
private:
CtrlVideo* m_pCtrlVideo;
};
/// Command to resize the vout window
class CmdResizeVout: public CmdGeneric
{
public:
/// Resize the given layout
CmdResizeVout( intf_thread_t *pIntf, vout_window_t* pWnd,
int width, int height );
virtual ~CmdResizeVout() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "resize vout"; }
private:
vout_window_t* m_pWnd;
int m_width, m_height;
public:
/// Resize the given layout
CmdResizeVout( intf_thread_t *pIntf, vout_window_t* pWnd,
int width, int height );
virtual ~CmdResizeVout() { }
virtual void execute();
virtual string getType() const { return "resize vout"; }
private:
vout_window_t* m_pWnd;
int m_width, m_height;
};
/// Command to toggle Fullscreen
class CmdSetFullscreen: public CmdGeneric
{
public:
/// Resize the given layout
CmdSetFullscreen( intf_thread_t *pIntf, vout_window_t* pWnd,
bool fullscreen );
virtual ~CmdSetFullscreen() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "toogle fullscreen"; }
private:
vout_window_t* m_pWnd;
bool m_bFullscreen;
public:
/// Resize the given layout
CmdSetFullscreen( intf_thread_t *pIntf, vout_window_t* pWnd,
bool fullscreen );
virtual ~CmdSetFullscreen() { }
virtual void execute();
virtual string getType() const { return "toogle fullscreen"; }
private:
vout_window_t* m_pWnd;
bool m_bFullscreen;
};
#endif
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_SHOW_WINDOW_HPP
......@@ -35,91 +35,77 @@
/// Command to show a window
class CmdShowWindow: public CmdGeneric
{
public:
CmdShowWindow( intf_thread_t *pIntf, WindowManager &rWinManager,
TopWindow &rWin ):
CmdGeneric( pIntf ), m_rWinManager( rWinManager ), m_rWin( rWin ) {}
virtual ~CmdShowWindow() {}
/// This method does the real job of the command
virtual void execute() { m_rWinManager.show( m_rWin ); }
/// Return the type of the command
virtual string getType() const { return "show window"; }
private:
/// Reference to the window manager
WindowManager &m_rWinManager;
/// Reference to the window
TopWindow &m_rWin;
public:
CmdShowWindow( intf_thread_t *pIntf, WindowManager &rWinManager,
TopWindow &rWin ):
CmdGeneric( pIntf ), m_rWinManager( rWinManager ), m_rWin( rWin ) { }
virtual ~CmdShowWindow() { }
virtual void execute() { m_rWinManager.show( m_rWin ); }
virtual string getType() const { return "show window"; }
private:
/// Reference to the window manager
WindowManager &m_rWinManager;
/// Reference to the window
TopWindow &m_rWin;
};
/// Command to hide a window
class CmdHideWindow: public CmdGeneric
{
public:
CmdHideWindow( intf_thread_t *pIntf, WindowManager &rWinManager,
TopWindow &rWin ):
CmdGeneric( pIntf ), m_rWinManager( rWinManager ), m_rWin( rWin ) {}
virtual ~CmdHideWindow() {}
/// This method does the real job of the command
virtual void execute() { m_rWinManager.hide( m_rWin ); }
/// Return the type of the command
virtual string getType() const { return "hide window"; }
private:
/// Reference to the window manager
WindowManager &m_rWinManager;
/// Reference to the window
TopWindow &m_rWin;
public:
CmdHideWindow( intf_thread_t *pIntf, WindowManager &rWinManager,
TopWindow &rWin ):
CmdGeneric( pIntf ), m_rWinManager( rWinManager ), m_rWin( rWin ) { }
virtual ~CmdHideWindow() { }
virtual void execute() { m_rWinManager.hide( m_rWin ); }
virtual string getType() const { return "hide window"; }
private:
/// Reference to the window manager
WindowManager &m_rWinManager;
/// Reference to the window
TopWindow &m_rWin;
};
/// Command to raise all windows
class CmdRaiseAll: public CmdGeneric
{
public:
CmdRaiseAll( intf_thread_t *pIntf, WindowManager &rWinManager ):
CmdGeneric( pIntf ), m_rWinManager( rWinManager ) {}
virtual ~CmdRaiseAll() {}
/// This method does the real job of the command
virtual void execute() { m_rWinManager.raiseAll(); }
/// Return the type of the command
virtual string getType() const { return "raise all windows"; }
private:
/// Reference to the window manager
WindowManager &m_rWinManager;
public:
CmdRaiseAll( intf_thread_t *pIntf, WindowManager &rWinManager ):
CmdGeneric( pIntf ), m_rWinManager( rWinManager ) { }
virtual ~CmdRaiseAll() { }
virtual void execute() { m_rWinManager.raiseAll(); }
virtual string getType() const { return "raise all windows"; }
private:
/// Reference to the window manager
WindowManager &m_rWinManager;
};
/// Command to show a popup menu
class CmdShowPopup: public CmdGeneric
{
public:
CmdShowPopup( intf_thread_t *pIntf, Popup &rPopup ):
CmdGeneric( pIntf ), m_rPopup( rPopup ) {}
virtual ~CmdShowPopup() {}
/// This method does the real job of the command
virtual void execute()
{
int x, y;
OSFactory::instance( getIntf() )->getMousePos( x, y );
m_rPopup.show( x, y );
}
/// Return the type of the command
virtual string getType() const { return "show popup"; }
private:
/// Reference to the popup
Popup &m_rPopup;
public:
CmdShowPopup( intf_thread_t *pIntf, Popup &rPopup ):
CmdGeneric( pIntf ), m_rPopup( rPopup ) { }
virtual ~CmdShowPopup() { }
virtual void execute()
{
int x, y;
OSFactory::instance( getIntf() )->getMousePos( x, y );
m_rPopup.show( x, y );
}
virtual string getType() const { return "show popup"; }
private:
/// Reference to the popup
Popup &m_rPopup;
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_UPDATE_ITEM_HPP
......@@ -31,19 +31,15 @@
/// Udate item command
class CmdUpdateItem: public CmdGeneric
{
public:
CmdUpdateItem( intf_thread_t *pIntf, VarText &rStreamName, VarText &rStreamURI ) :
CmdGeneric( pIntf ), m_rStreamName(rStreamName), m_rStreamURI(rStreamURI) {}
virtual ~CmdUpdateItem() {}
public:
CmdUpdateItem( intf_thread_t *I,VarText &N,VarText &U )
: CmdGeneric(I), m_rStreamName(N), m_rStreamURI(U) { }
virtual ~CmdUpdateItem() { }
virtual void execute();
virtual string getType() const { return "update item"; }
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "update item"; }
private:
VarText &m_rStreamName;
VarText &m_rStreamURI;
private:
VarText &m_rStreamName;
VarText &m_rStreamURI;
};
#endif
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_VARS_HPP
......@@ -40,130 +40,101 @@ DEFINE_COMMAND( PlaytreeChanged, "playtree changed" )
/// Command to notify the playtree of an item update
class CmdPlaytreeUpdate: public CmdGeneric
{
public:
CmdPlaytreeUpdate( intf_thread_t *pIntf, int id ):
CmdGeneric( pIntf ), m_id( id ) {}
virtual ~CmdPlaytreeUpdate() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playtree update"; }
/// Only accept removal of command if they concern the same item
virtual bool checkRemove( CmdGeneric * ) const;
private:
/// Playlist item ID
int m_id;
public:
CmdPlaytreeUpdate( intf_thread_t *pIntf, int id ):
CmdGeneric( pIntf ), m_id( id ) { }
virtual ~CmdPlaytreeUpdate() { }
virtual void execute();
virtual string getType() const { return "playtree update"; }
/// Only accept removal of command if they concern the same item
virtual bool checkRemove( CmdGeneric * ) const;
private:
/// Playlist item ID
int m_id;
};
/// Command to notify the playtree of an item append
class CmdPlaytreeAppend: public CmdGeneric
{
public:
CmdPlaytreeAppend( intf_thread_t *pIntf, playlist_add_t *p_add ) :
CmdGeneric( pIntf ), m_pAdd( p_add ) {}
virtual ~CmdPlaytreeAppend() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playtree append"; }
private:
playlist_add_t * m_pAdd;
public:
CmdPlaytreeAppend( intf_thread_t *pIntf, playlist_add_t *p_add ):
CmdGeneric( pIntf ), m_pAdd( p_add ) { }
virtual ~CmdPlaytreeAppend() { }
virtual void execute();
virtual string getType() const { return "playtree append"; }
private:
playlist_add_t * m_pAdd;
};
/// Command to notify the playtree of an item deletion
class CmdPlaytreeDelete: public CmdGeneric
{
public:
CmdPlaytreeDelete( intf_thread_t *pIntf, int i_id ) :
CmdGeneric( pIntf ), m_id( i_id ) {}
virtual ~CmdPlaytreeDelete() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playtree append"; }
private:
int m_id;
public:
CmdPlaytreeDelete( intf_thread_t *pIntf, int i_id ):
CmdGeneric( pIntf ), m_id( i_id ) { }
virtual ~CmdPlaytreeDelete() { }
virtual void execute();
virtual string getType() const { return "playtree append"; }
private:
int m_id;
};
/// Command to set a text variable
class CmdSetText: public CmdGeneric
{
public:
CmdSetText( intf_thread_t *pIntf, VarText &rText,
const UString &rValue ):
CmdGeneric( pIntf ), m_rText( rText ), m_value( rValue ) {}
virtual ~CmdSetText() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "set text"; }
private:
/// Text variable to set
VarText &m_rText;
/// Value to set
const UString m_value;
public:
CmdSetText( intf_thread_t *pIntf, VarText &rText, const UString &rValue ):
CmdGeneric( pIntf ), m_rText( rText ), m_value( rValue ) { }
virtual ~CmdSetText() { }
virtual void execute();
virtual string getType() const { return "set text"; }
private:
/// Text variable to set
VarText &m_rText;
/// Value to set
const UString m_value;
};
/// Command to set the equalizer preamp
class CmdSetEqPreamp: public CmdGeneric
{
public:
CmdSetEqPreamp( intf_thread_t *pIntf, EqualizerPreamp &rPreamp,
float value ):
CmdGeneric( pIntf ), m_rPreamp( rPreamp ), m_value( value ) {}
virtual ~CmdSetEqPreamp() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "set equalizer preamp"; }
private:
/// Preamp variable to set
EqualizerPreamp &m_rPreamp;
/// Value to set
float m_value;
public:
CmdSetEqPreamp( intf_thread_t *I, EqualizerPreamp &P, float v )
: CmdGeneric( I ), m_rPreamp( P ), m_value( v ) { }
virtual ~CmdSetEqPreamp() { }
virtual void execute();
virtual string getType() const { return "set equalizer preamp"; }
private:
/// Preamp variable to set
EqualizerPreamp &m_rPreamp;
/// Value to set
float m_value;
};
/// Command to set the equalizerbands
class CmdSetEqBands: public CmdGeneric
{
public:
CmdSetEqBands( intf_thread_t *pIntf, EqualizerBands &rEqBands,
const string &rValue ):
CmdGeneric( pIntf ), m_rEqBands( rEqBands ), m_value( rValue ) {}
virtual ~CmdSetEqBands() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "set equalizer bands"; }
private:
/// Equalizer variable to set
EqualizerBands &m_rEqBands;
/// Value to set
const string m_value;
public:
CmdSetEqBands( intf_thread_t *I, EqualizerBands &B, const string &V )
: CmdGeneric( I ), m_rEqBands( B ), m_value( V ) { }
virtual ~CmdSetEqBands() { }
virtual void execute();
virtual string getType() const { return "set equalizer bands"; }
private:
/// Equalizer variable to set
EqualizerBands &m_rEqBands;
/// Value to set
const string m_value;
};
......
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_VOUTWINDOW_HPP
......@@ -31,38 +31,30 @@
/// Command to create a vout window
class CmdNewVoutWindow: public CmdGeneric
{
public:
/// Create a vout window
CmdNewVoutWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
virtual ~CmdNewVoutWindow() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "new vout window"; }
private:
vout_window_t* m_pWnd;
public:
/// Create a vout window
CmdNewVoutWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
virtual ~CmdNewVoutWindow() { }
virtual void execute();
virtual string getType() const { return "new vout window"; }
private:
vout_window_t* m_pWnd;
};
/// Command to release a vout window
class CmdReleaseVoutWindow: public CmdGeneric
{
public:
/// Release a vout window
CmdReleaseVoutWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
virtual ~CmdReleaseVoutWindow() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "new vout window"; }
private:
vout_window_t* m_pWnd;
public:
/// Release a vout window
CmdReleaseVoutWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
virtual ~CmdReleaseVoutWindow() { }
virtual void execute();
virtual string getType() const { return "new vout window"; }
private:
vout_window_t* m_pWnd;
};
#endif
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CTRL_BUTTON_HPP
......@@ -36,59 +36,58 @@ class CmdGeneric;
/// Base class for button controls
class CtrlButton: public CtrlGeneric, public Observer<AnimBitmap>
{
public:
/// Create a button with 3 images
CtrlButton( intf_thread_t *pIntf, const GenericBitmap &rBmpUp,
const GenericBitmap &rBmpOver,
const GenericBitmap &rBmpDown,
CmdGeneric &rCommand, const UString &rTooltip,
const UString &rHelp, VarBool *pVisible );
virtual ~CtrlButton();
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the text of the tooltip
virtual UString getTooltipText() const { return m_tooltip; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "button"; }
private:
/// Finite state machine of the control
FSM m_fsm;
/// Command triggered by the button
CmdGeneric &m_rCommand;
/// Tooltip text
const UString m_tooltip;
/// Images of the button in the different states
AnimBitmap m_imgUp, m_imgOver, m_imgDown;
/// Current image
AnimBitmap *m_pImg;
/// Callback objects
DEFINE_CALLBACK( CtrlButton, UpOverDownOver )
DEFINE_CALLBACK( CtrlButton, DownOverUpOver )
DEFINE_CALLBACK( CtrlButton, DownOverDown )
DEFINE_CALLBACK( CtrlButton, DownDownOver )
DEFINE_CALLBACK( CtrlButton, UpOverUp )
DEFINE_CALLBACK( CtrlButton, UpUpOver )
DEFINE_CALLBACK( CtrlButton, DownUp )
DEFINE_CALLBACK( CtrlButton, UpHidden )
DEFINE_CALLBACK( CtrlButton, HiddenUp )
/// Change the current image
void setImage( AnimBitmap *pImg );
/// Method called when an animated bitmap changes
virtual void onUpdate( Subject<AnimBitmap> &rBitmap, void* );
public:
/// Create a button with 3 images
CtrlButton( intf_thread_t *pIntf, const GenericBitmap &rBmpUp,
const GenericBitmap &rBmpOver, const GenericBitmap &rBmpDown,
CmdGeneric &rCommand, const UString &rTooltip,
const UString &rHelp, VarBool *pVisible );
virtual ~CtrlButton();
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the text of the tooltip
virtual UString getTooltipText() const { return m_tooltip; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "button"; }
private:
/// Finite state machine of the control
FSM m_fsm;
/// Command triggered by the button
CmdGeneric &m_rCommand;
/// Tooltip text
const UString m_tooltip;
/// Images of the button in the different states
AnimBitmap m_imgUp, m_imgOver, m_imgDown;
/// Current image
AnimBitmap *m_pImg;
/// Callback objects
DEFINE_CALLBACK( CtrlButton, UpOverDownOver )
DEFINE_CALLBACK( CtrlButton, DownOverUpOver )
DEFINE_CALLBACK( CtrlButton, DownOverDown )
DEFINE_CALLBACK( CtrlButton, DownDownOver )
DEFINE_CALLBACK( CtrlButton, UpOverUp )
DEFINE_CALLBACK( CtrlButton, UpUpOver )
DEFINE_CALLBACK( CtrlButton, DownUp )
DEFINE_CALLBACK( CtrlButton, UpHidden )
DEFINE_CALLBACK( CtrlButton, HiddenUp )
/// Change the current image
void setImage( AnimBitmap *pImg );
/// Method called when an animated bitmap changes
virtual void onUpdate( Subject<AnimBitmap> &rBitmap, void* );
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CTRL_CHECKBOX_HPP
......@@ -38,84 +38,84 @@ class CmdGeneric;
/// Base class for checkbox controls
class CtrlCheckbox: public CtrlGeneric, public Observer<AnimBitmap>
{
public:
/// Create a checkbox with 6 images
CtrlCheckbox( intf_thread_t *pIntf,
const GenericBitmap &rBmpUp1,
const GenericBitmap &rBmpOver1,
const GenericBitmap &rBmpDown1,
const GenericBitmap &rBmpUp2,
const GenericBitmap &rBmpOver2,
const GenericBitmap &rBmpDown2,
CmdGeneric &rCommand1, CmdGeneric &rCommand2,
const UString &rTooltip1, const UString &rTooltip2,
VarBool &rVariable, const UString &rHelp,
VarBool *pVisible);
virtual ~CtrlCheckbox();
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the text of the tooltip XXX
virtual UString getTooltipText() const { return *m_pTooltip; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "checkbox"; }
private:
/// Finite state machine of the control
FSM m_fsm;
/// Observed variable
VarBool &m_rVariable;
/// Commands for the 2 states
CmdGeneric &m_rCommand1, &m_rCommand2;
/// Current command
CmdGeneric *m_pCommand;
/// Tooltip texts for the 2 states
const UString m_tooltip1, m_tooltip2;
/// Current tooltip
const UString *m_pTooltip;
/// Images of the checkbox in the different states
AnimBitmap m_imgUp1, m_imgOver1, m_imgDown1;
AnimBitmap m_imgUp2, m_imgOver2, m_imgDown2;
/// Current set of images (pointing to 1 or 2)
/// In fact, we consider here that a checkbox acts like 2 buttons, in a
/// symetric way; this is a small trick to avoid multiplicating the
/// callbacks (and it could be extended easily to support 3 buttons or
/// more...)
AnimBitmap *m_pImgUp, *m_pImgOver, *m_pImgDown;
/// Current image
AnimBitmap *m_pImgCurrent;
/// Callback objects
DEFINE_CALLBACK( CtrlCheckbox, UpOverDownOver )
DEFINE_CALLBACK( CtrlCheckbox, DownOverUpOver )
DEFINE_CALLBACK( CtrlCheckbox, DownOverDown )
DEFINE_CALLBACK( CtrlCheckbox, DownDownOver )
DEFINE_CALLBACK( CtrlCheckbox, UpOverUp )
DEFINE_CALLBACK( CtrlCheckbox, UpUpOver )
DEFINE_CALLBACK( CtrlCheckbox, DownUp )
DEFINE_CALLBACK( CtrlCheckbox, UpHidden )
DEFINE_CALLBACK( CtrlCheckbox, HiddenUp )
/// Method called when the observed variable is modified
virtual void onVarBoolUpdate( VarBool &rVariable );
/// Method called when an animated bitmap changes
virtual void onUpdate( Subject<AnimBitmap> &rBitmap, void* );
/// Change the current image
void setImage( AnimBitmap *pImg );
/// Helper function to update the current state of images
void changeButton();
public:
/// Create a checkbox with 6 images
CtrlCheckbox( intf_thread_t *pIntf,
const GenericBitmap &rBmpUp1,
const GenericBitmap &rBmpOver1,
const GenericBitmap &rBmpDown1,
const GenericBitmap &rBmpUp2,
const GenericBitmap &rBmpOver2,
const GenericBitmap &rBmpDown2,
CmdGeneric &rCommand1, CmdGeneric &rCommand2,
const UString &rTooltip1, const UString &rTooltip2,
VarBool &rVariable, const UString &rHelp,
VarBool *pVisible);
virtual ~CtrlCheckbox();
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the text of the tooltip XXX
virtual UString getTooltipText() const { return *m_pTooltip; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "checkbox"; }
private:
/// Finite state machine of the control
FSM m_fsm;
/// Observed variable
VarBool &m_rVariable;
/// Commands for the 2 states
CmdGeneric &m_rCommand1, &m_rCommand2;
/// Current command
CmdGeneric *m_pCommand;
/// Tooltip texts for the 2 states
const UString m_tooltip1, m_tooltip2;
/// Current tooltip
const UString *m_pTooltip;
/// Images of the checkbox in the different states
AnimBitmap m_imgUp1, m_imgOver1, m_imgDown1;
AnimBitmap m_imgUp2, m_imgOver2, m_imgDown2;
/// Current set of images (pointing to 1 or 2)
/// In fact, we consider here that a checkbox acts like 2 buttons, in a
/// symetric way; this is a small trick to avoid multiplicating the
/// callbacks (and it could be extended easily to support 3 buttons or
/// more...)
AnimBitmap *m_pImgUp, *m_pImgOver, *m_pImgDown;
/// Current image
AnimBitmap *m_pImgCurrent;
/// Callback objects
DEFINE_CALLBACK( CtrlCheckbox, UpOverDownOver )
DEFINE_CALLBACK( CtrlCheckbox, DownOverUpOver )
DEFINE_CALLBACK( CtrlCheckbox, DownOverDown )
DEFINE_CALLBACK( CtrlCheckbox, DownDownOver )
DEFINE_CALLBACK( CtrlCheckbox, UpOverUp )
DEFINE_CALLBACK( CtrlCheckbox, UpUpOver )
DEFINE_CALLBACK( CtrlCheckbox, DownUp )
DEFINE_CALLBACK( CtrlCheckbox, UpHidden )
DEFINE_CALLBACK( CtrlCheckbox, HiddenUp )
/// Method called when the observed variable is modified
virtual void onVarBoolUpdate( VarBool &rVariable );
/// Method called when an animated bitmap changes
virtual void onUpdate( Subject<AnimBitmap> &rBitmap, void* );
/// Change the current image
void setImage( AnimBitmap *pImg );
/// Helper function to update the current state of images
void changeButton();
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CTRL_FLAT_HPP
......@@ -31,12 +31,11 @@
/// Base class for "mover controls" and images
class CtrlFlat: public CtrlGeneric
{
protected:
CtrlFlat( intf_thread_t *pIntf, const UString &rHelp,
VarBool *pVisible ):
CtrlGeneric( pIntf, rHelp, pVisible ) {}
protected:
CtrlFlat( intf_thread_t *pIntf, const UString &rHelp, VarBool *pVisible )
: CtrlGeneric( pIntf, rHelp, pVisible ) { }
virtual ~CtrlFlat() {}
virtual ~CtrlFlat() { }
};
#endif
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CTRL_GENERIC_HPP
......@@ -43,102 +43,102 @@ class VarBool;
/// Base class for controls
class CtrlGeneric: public SkinObject, public Observer<VarBool>
{
public:
virtual ~CtrlGeneric();
public:
virtual ~CtrlGeneric();
/// Handle an event on the control
virtual void handleEvent( EvtGeneric &rEvent ) {}
/// Handle an event on the control
virtual void handleEvent( EvtGeneric &rEvent ) { }
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const { return false; }
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const { return false; }
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest ) {}
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest ) { }
/// Set the position and the associated layout of the control
virtual void setLayout( GenericLayout *pLayout,
const Position &rPosition );
/// Set the position and the associated layout of the control
virtual void setLayout( GenericLayout *pLayout,
const Position &rPosition );
/// Get the position of the control in the layout, if any
virtual const Position *getPosition() const { return m_pPosition; }
/// Get the position of the control in the layout, if any
virtual const Position *getPosition() const { return m_pPosition; }
/// Get the text of the tooltip
virtual UString getTooltipText() const
{ return UString( getIntf(), "" ); }
/// Get the text of the tooltip
virtual UString getTooltipText() const
{ return UString( getIntf(), "" ); }
/**
* Overload this method if you want to do something special when
* the layout is resized
*/
virtual void onResize() {}
/**
* Overload this method if you want to do something special when
* the layout is resized
*/
virtual void onResize() { }
/// Get the help text
virtual const UString &getHelpText() const { return m_help; }
/// Get the help text
virtual const UString &getHelpText() const { return m_help; }
/// Return true if the control can gain the focus
virtual bool isFocusable() const { return false; }
/// Return true if the control can gain the focus
virtual bool isFocusable() const { return false; }
/// Return true if the control is visible
virtual bool isVisible() const;
/// Return true if the control is visible
virtual bool isVisible() const;
/// Get the type of control (custom RTTI)
virtual string getType() const { return ""; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return ""; }
protected:
// If pVisible is NULL, the control is always visible
CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp,
VarBool *pVisible = NULL );
protected:
// If pVisible is NULL, the control is always visible
CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp,
VarBool *pVisible = NULL );
/**
* Tell the layout when the image has changed, with the size of the
* rectangle to repaint and its offset.
* Use the default values to repaint the whole window
*/
virtual void notifyLayout( int witdh = -1, int height = -1,
int xOffSet = 0, int yOffSet = 0 ) const;
/**
* Tell the layout when the image has changed, with the size of the
* rectangle to repaint and its offset.
* Use the default values to repaint the whole window
*/
virtual void notifyLayout( int witdh = -1, int height = -1,
int xOffSet = 0, int yOffSet = 0 ) const;
/**
* Same as notifyLayout(), but takes optional images as parameters.
* The maximum size(s) of the images will be used for repainting.
*/
void notifyLayoutMaxSize( const Box *pImg1 = NULL,
const Box *pImg2 = NULL );
/**
* Same as notifyLayout(), but takes optional images as parameters.
* The maximum size(s) of the images will be used for repainting.
*/
void notifyLayoutMaxSize( const Box *pImg1 = NULL,
const Box *pImg2 = NULL );
/// Ask the layout to capture the mouse
virtual void captureMouse() const;
/// Ask the layout to capture the mouse
virtual void captureMouse() const;
/// Ask the layout to release the mouse
virtual void releaseMouse() const;
/// Ask the layout to release the mouse
virtual void releaseMouse() const;
/// Notify the window the tooltip has changed
virtual void notifyTooltipChange() const;
/// Notify the window the tooltip has changed
virtual void notifyTooltipChange() const;
/// Get the associated window, if any
virtual TopWindow *getWindow() const;
/// Get the associated window, if any
virtual TopWindow *getWindow() const;
/**
* Overload this method if you want to do something special when
* the Position object is set
*/
virtual void onPositionChange() {}
/**
* Overload this method if you want to do something special when
* the Position object is set
*/
virtual void onPositionChange() { }
/// Overload this method to get notified of bool variable changes
virtual void onVarBoolUpdate( VarBool &rVar ) {}
/// Overload this method to get notified of bool variable changes
virtual void onVarBoolUpdate( VarBool &rVar ) { }
/// Method called when an observed bool variable is changed
virtual void onUpdate( Subject<VarBool> &rVariable , void* );
/// Method called when an observed bool variable is changed
virtual void onUpdate( Subject<VarBool> &rVariable , void* );
/// Associated layout
GenericLayout *m_pLayout;
/// Associated layout
GenericLayout *m_pLayout;
/// Visibility variable
VarBool *m_pVisible;
/// Visibility variable
VarBool *m_pVisible;
private:
/// Position in the layout
Position *m_pPosition;
/// Help text
UString m_help;
private:
/// Position in the layout
Position *m_pPosition;
/// Help text
UString m_help;
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CTRL_IMAGE_HPP
......@@ -36,41 +36,41 @@ class CmdGeneric;
/// Control image
class CtrlImage: public CtrlFlat
{
public:
/// Resize methods
enum resize_t
{
kMosaic, // Repeat the base image in a mosaic
kScale // Scale the base image
};
public:
/// Resize methods
enum resize_t
{
kMosaic, // Repeat the base image in a mosaic
kScale // Scale the base image
};
// Create an image with the given bitmap (which is NOT copied)
CtrlImage( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
CmdGeneric &rCommand, resize_t resizeMethod,
const UString &rHelp, VarBool *pVisible );
virtual ~CtrlImage();
// Create an image with the given bitmap (which is NOT copied)
CtrlImage( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
CmdGeneric &rCommand, resize_t resizeMethod,
const UString &rHelp, VarBool *pVisible );
virtual ~CtrlImage();
/// Handle an event on the control
virtual void handleEvent( EvtGeneric &rEvent );
/// Handle an event on the control
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "image"; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "image"; }
private:
/// Bitmap
const GenericBitmap &m_rBitmap;
/// Buffer to stored the rendered bitmap
OSGraphics *m_pImage;
/// Command triggered by a double-click on the image
CmdGeneric &m_rCommand;
/// Resize method
resize_t m_resizeMethod;
private:
/// Bitmap
const GenericBitmap &m_rBitmap;
/// Buffer to stored the rendered bitmap
OSGraphics *m_pImage;
/// Command triggered by a double-click on the image
CmdGeneric &m_rCommand;
/// Resize method
resize_t m_resizeMethod;
};
#endif
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CTRL_LIST_HPP
......@@ -38,69 +38,69 @@ class GenericBitmap;
class CtrlList: public CtrlGeneric, public Observer<VarList>,
public Observer<VarPercent>
{
public:
CtrlList( intf_thread_t *pIntf, VarList &rList,
const GenericFont &rFont, const GenericBitmap *pBitmap,
uint32_t fgcolor, uint32_t playcolor, uint32_t bgcolor1,
uint32_t bgcolor2, uint32_t selColor,
const UString &rHelp, VarBool *pVisible );
virtual ~CtrlList();
/// Handle an event on the control.
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control.
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Called when the layout is resized
virtual void onResize();
/// Return true if the control can gain the focus
virtual bool isFocusable() const { return true; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "list"; }
private:
/// List associated to the control
VarList &m_rList;
/// Font
const GenericFont &m_rFont;
/// Background bitmap
/** If NULL, the 2 background colors defined below will be used */
const GenericBitmap *m_pBitmap;
/// Color of normal text
uint32_t m_fgColor;
/// Color of the playing item
uint32_t m_playColor;
/// Background colors, used when no background bitmap is given
uint32_t m_bgColor1, m_bgColor2;
/// Background of selected items
uint32_t m_selColor;
/// Pointer on the last selected item in the list
VarList::Elem_t *m_pLastSelected;
/// Image of the control
OSGraphics *m_pImage;
/// Last position
int m_lastPos;
/// Method called when the list variable is modified
virtual void onUpdate( Subject<VarList> &rList, void* );
/// Method called when the position variable of the list is modified
virtual void onUpdate( Subject<VarPercent> &rPercent, void* );
/// Called when the position is set
virtual void onPositionChange();
/// Check if the list must be scrolled
void autoScroll();
/// Draw the image of the control
void makeImage();
public:
CtrlList( intf_thread_t *pIntf, VarList &rList,
const GenericFont &rFont, const GenericBitmap *pBitmap,
uint32_t fgcolor, uint32_t playcolor, uint32_t bgcolor1,
uint32_t bgcolor2, uint32_t selColor,
const UString &rHelp, VarBool *pVisible );
virtual ~CtrlList();
/// Handle an event on the control.
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control.
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Called when the layout is resized
virtual void onResize();
/// Return true if the control can gain the focus
virtual bool isFocusable() const { return true; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "list"; }
private:
/// List associated to the control
VarList &m_rList;
/// Font
const GenericFont &m_rFont;
/// Background bitmap
/** If NULL, the 2 background colors defined below will be used */
const GenericBitmap *m_pBitmap;
/// Color of normal text
uint32_t m_fgColor;
/// Color of the playing item
uint32_t m_playColor;
/// Background colors, used when no background bitmap is given
uint32_t m_bgColor1, m_bgColor2;
/// Background of selected items
uint32_t m_selColor;
/// Pointer on the last selected item in the list
VarList::Elem_t *m_pLastSelected;
/// Image of the control
OSGraphics *m_pImage;
/// Last position
int m_lastPos;
/// Method called when the list variable is modified
virtual void onUpdate( Subject<VarList> &rList, void* );
/// Method called when the position variable of the list is modified
virtual void onUpdate( Subject<VarPercent> &rPercent, void* );
/// Called when the position is set
virtual void onPositionChange();
/// Check if the list must be scrolled
void autoScroll();
/// Draw the image of the control
void makeImage();
};
#endif
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CTRL_MOVE_HPP
......@@ -36,51 +36,51 @@ class WindowManager;
/// Control for moving windows
class CtrlMove: public CtrlFlat
{
public:
CtrlMove( intf_thread_t *pIntf, WindowManager &rWindowManager,
CtrlFlat &rCtrl, TopWindow &rWindow,
const UString &rHelp, VarBool *pVisible );
virtual ~CtrlMove() {}
public:
CtrlMove( intf_thread_t *pIntf, WindowManager &rWindowManager,
CtrlFlat &rCtrl, TopWindow &rWindow,
const UString &rHelp, VarBool *pVisible );
virtual ~CtrlMove() { }
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the decorated control
virtual bool mouseOver( int x, int y ) const;
/// Check whether coordinates are inside the decorated control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Set the position and the associated layout of the decorated control
virtual void setLayout( GenericLayout *pLayout,
const Position &rPosition );
/// Set the position and the associated layout of the decorated control
virtual void setLayout( GenericLayout *pLayout,
const Position &rPosition );
/// Get the position of the decorated control in the layout, if any
virtual const Position *getPosition() const;
/// Get the position of the decorated control in the layout, if any
virtual const Position *getPosition() const;
/// Method called when the control is resized
virtual void onResize();
/// Method called when the control is resized
virtual void onResize();
/// Get the type of control (custom RTTI)
virtual string getType() const { return m_rCtrl.getType(); }
/// Get the type of control (custom RTTI)
virtual string getType() const { return m_rCtrl.getType(); }
private:
FSM m_fsm;
/// Window manager
WindowManager &m_rWindowManager;
/// Decorated CtrlFlat
CtrlFlat &m_rCtrl;
/// The window moved by this control
TopWindow &m_rWindow;
/// The last received event
EvtGeneric *m_pEvt;
/// Position of the click that started the move
int m_xPos, m_yPos;
private:
FSM m_fsm;
/// Window manager
WindowManager &m_rWindowManager;
/// Decorated CtrlFlat
CtrlFlat &m_rCtrl;
/// The window moved by this control
TopWindow &m_rWindow;
/// The last received event
EvtGeneric *m_pEvt;
/// Position of the click that started the move
int m_xPos, m_yPos;
/// Callback objects
DEFINE_CALLBACK( CtrlMove, MovingMoving )
DEFINE_CALLBACK( CtrlMove, StillMoving )
DEFINE_CALLBACK( CtrlMove, MovingStill )
};
/// Callback objects
DEFINE_CALLBACK( CtrlMove, MovingMoving )
DEFINE_CALLBACK( CtrlMove, StillMoving )
DEFINE_CALLBACK( CtrlMove, MovingStill )
};
#endif
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CTRL_RADIALSLIDER_HPP
......@@ -38,60 +38,60 @@ class VarPercent;
/// Radial slider
class CtrlRadialSlider: public CtrlGeneric, public Observer<VarPercent>
{
public:
/// Create a radial slider with the given image, which must be
/// composed of numImg subimages of the same size
CtrlRadialSlider( intf_thread_t *pIntf, const GenericBitmap &rBmpSeq,
int numImg, VarPercent &rVariable, float minAngle,
float maxAngle, const UString &rHelp,
VarBool *pVisible );
virtual ~CtrlRadialSlider();
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "radial_slider"; }
private:
/// Finite state machine of the control
FSM m_fsm;
/// Number of sub-images in the slider image
int m_numImg;
/// Variable associated to the slider
VarPercent &m_rVariable;
/// Min and max angles of the button
float m_minAngle, m_maxAngle;
/// Position of the cursor
int m_position;
/// Size of an image
int m_width, m_height;
/// The last received event
EvtGeneric *m_pEvt;
/// Sequence of images
OSGraphics *m_pImgSeq;
/// Last saved position
int m_lastPos;
/// Callback objects
DEFINE_CALLBACK( CtrlRadialSlider, UpDown )
DEFINE_CALLBACK( CtrlRadialSlider, DownUp )
DEFINE_CALLBACK( CtrlRadialSlider, Move )
/// Method called when the observed variable is modified
virtual void onUpdate( Subject<VarPercent> &rVariable, void* );
/// Change the position of the cursor, with the given position of
/// the mouse (relative to the layout). Is blocking is true, the
/// the cursor cannot do more than a half turn
void setCursor( int posX, int posY, bool blocking );
public:
/// Create a radial slider with the given image, which must be
/// composed of numImg subimages of the same size
CtrlRadialSlider( intf_thread_t *pIntf, const GenericBitmap &rBmpSeq,
int numImg, VarPercent &rVariable, float minAngle,
float maxAngle, const UString &rHelp,
VarBool *pVisible );
virtual ~CtrlRadialSlider();
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "radial_slider"; }
private:
/// Finite state machine of the control
FSM m_fsm;
/// Number of sub-images in the slider image
int m_numImg;
/// Variable associated to the slider
VarPercent &m_rVariable;
/// Min and max angles of the button
float m_minAngle, m_maxAngle;
/// Position of the cursor
int m_position;
/// Size of an image
int m_width, m_height;
/// The last received event
EvtGeneric *m_pEvt;
/// Sequence of images
OSGraphics *m_pImgSeq;
/// Last saved position
int m_lastPos;
/// Callback objects
DEFINE_CALLBACK( CtrlRadialSlider, UpDown )
DEFINE_CALLBACK( CtrlRadialSlider, DownUp )
DEFINE_CALLBACK( CtrlRadialSlider, Move )
/// Method called when the observed variable is modified
virtual void onUpdate( Subject<VarPercent> &rVariable, void* );
/// Change the position of the cursor, with the given position of
/// the mouse (relative to the layout). Is blocking is true, the
/// the cursor cannot do more than a half turn
void setCursor( int posX, int posY, bool blocking );
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CTRL_RESIZE_HPP
......@@ -36,63 +36,63 @@ class WindowManager;
/// Control decorator for resizing windows
class CtrlResize: public CtrlFlat
{
public:
CtrlResize( intf_thread_t *pIntf, WindowManager &rWindowManager,
CtrlFlat &rCtrl, GenericLayout &rLayout,
const UString &rHelp, VarBool *pVisible,
WindowManager::Direction_t direction );
virtual ~CtrlResize() {}
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the decorated control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Set the position and the associated layout of the decorated control
virtual void setLayout( GenericLayout *pLayout,
const Position &rPosition );
/// Get the position of the decorated control in the layout, if any
virtual const Position *getPosition() const;
/// Method called when the control is resized
virtual void onResize();
/// Get the type of control (custom RTTI)
virtual string getType() const { return m_rCtrl.getType(); }
private:
FSM m_fsm;
/// Window manager
WindowManager &m_rWindowManager;
/// Decorated CtrlFlat
CtrlFlat &m_rCtrl;
/// The layout resized by this control
GenericLayout &m_rLayout;
/// The last received event
EvtGeneric *m_pEvt;
/// Position of the click that started the resizing
int m_xPos, m_yPos;
/// Direction of the resizing
WindowManager::Direction_t m_direction;
/// Change the cursor, based on the given direction
void changeCursor( WindowManager::Direction_t direction ) const;
/// Callback objects
DEFINE_CALLBACK( CtrlResize, OutStill )
DEFINE_CALLBACK( CtrlResize, StillOut )
DEFINE_CALLBACK( CtrlResize, StillStill )
DEFINE_CALLBACK( CtrlResize, StillResize )
DEFINE_CALLBACK( CtrlResize, ResizeStill )
DEFINE_CALLBACK( CtrlResize, ResizeResize )
// Size of the layout, before resizing
int m_width, m_height;
public:
CtrlResize( intf_thread_t *pIntf, WindowManager &rWindowManager,
CtrlFlat &rCtrl, GenericLayout &rLayout,
const UString &rHelp, VarBool *pVisible,
WindowManager::Direction_t direction );
virtual ~CtrlResize() { }
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the decorated control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Set the position and the associated layout of the decorated control
virtual void setLayout( GenericLayout *pLayout,
const Position &rPosition );
/// Get the position of the decorated control in the layout, if any
virtual const Position *getPosition() const;
/// Method called when the control is resized
virtual void onResize();
/// Get the type of control (custom RTTI)
virtual string getType() const { return m_rCtrl.getType(); }
private:
FSM m_fsm;
/// Window manager
WindowManager &m_rWindowManager;
/// Decorated CtrlFlat
CtrlFlat &m_rCtrl;
/// The layout resized by this control
GenericLayout &m_rLayout;
/// The last received event
EvtGeneric *m_pEvt;
/// Position of the click that started the resizing
int m_xPos, m_yPos;
/// Direction of the resizing
WindowManager::Direction_t m_direction;
/// Change the cursor, based on the given direction
void changeCursor( WindowManager::Direction_t direction ) const;
/// Callback objects
DEFINE_CALLBACK( CtrlResize, OutStill )
DEFINE_CALLBACK( CtrlResize, StillOut )
DEFINE_CALLBACK( CtrlResize, StillStill )
DEFINE_CALLBACK( CtrlResize, StillResize )
DEFINE_CALLBACK( CtrlResize, ResizeStill )
DEFINE_CALLBACK( CtrlResize, ResizeResize )
// Size of the layout, before resizing
int m_width, m_height;
};
#endif
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CTRL_SLIDER_HPP
......@@ -39,131 +39,131 @@ class VarPercent;
/// Cursor of a slider
class CtrlSliderCursor: public CtrlGeneric, public Observer<VarPercent>
{
public:
/// Create a cursor with 3 images (which are NOT copied, be careful)
/// If pVisible is NULL, the control is always visible
CtrlSliderCursor( intf_thread_t *pIntf, const GenericBitmap &rBmpUp,
const GenericBitmap &rBmpOver,
const GenericBitmap &rBmpDown,
const Bezier &rCurve, VarPercent &rVariable,
VarBool *pVisible, const UString &rTooltip,
const UString &rHelp );
virtual ~CtrlSliderCursor();
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the text of the tooltip
virtual UString getTooltipText() const { return m_tooltip; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "slider_cursor"; }
private:
/// Finite state machine of the control
FSM m_fsm;
/// Variable associated to the cursor
VarPercent &m_rVariable;
/// Tooltip text
const UString m_tooltip;
/// Initial size of the control
int m_width, m_height;
/// Position of the cursor
int m_xPosition, m_yPosition;
/// Callback objects
DEFINE_CALLBACK( CtrlSliderCursor, OverDown )
DEFINE_CALLBACK( CtrlSliderCursor, DownOver )
DEFINE_CALLBACK( CtrlSliderCursor, OverUp )
DEFINE_CALLBACK( CtrlSliderCursor, UpOver )
DEFINE_CALLBACK( CtrlSliderCursor, Move )
DEFINE_CALLBACK( CtrlSliderCursor, Scroll )
/// Last saved position of the cursor (stored as a percentage)
float m_lastPercentage;
/// Offset between the mouse pointer and the center of the cursor
int m_xOffset, m_yOffset;
/// The last received event
EvtGeneric *m_pEvt;
/// Images of the cursor in the differents states
OSGraphics *m_pImgUp, *m_pImgOver, *m_pImgDown;
/// Current image
OSGraphics *m_pImg;
/// Bezier curve of the slider
const Bezier &m_rCurve;
/// Method called when the position variable is modified
virtual void onUpdate( Subject<VarPercent> &rVariable, void * );
/// Method to compute the resize factors
void getResizeFactors( float &rFactorX, float &rFactorY ) const;
/// Call notifyLayout
void refreshLayout();
public:
/// Create a cursor with 3 images (which are NOT copied, be careful)
/// If pVisible is NULL, the control is always visible
CtrlSliderCursor( intf_thread_t *pIntf, const GenericBitmap &rBmpUp,
const GenericBitmap &rBmpOver,
const GenericBitmap &rBmpDown,
const Bezier &rCurve, VarPercent &rVariable,
VarBool *pVisible, const UString &rTooltip,
const UString &rHelp );
virtual ~CtrlSliderCursor();
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the text of the tooltip
virtual UString getTooltipText() const { return m_tooltip; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "slider_cursor"; }
private:
/// Finite state machine of the control
FSM m_fsm;
/// Variable associated to the cursor
VarPercent &m_rVariable;
/// Tooltip text
const UString m_tooltip;
/// Initial size of the control
int m_width, m_height;
/// Position of the cursor
int m_xPosition, m_yPosition;
/// Callback objects
DEFINE_CALLBACK( CtrlSliderCursor, OverDown )
DEFINE_CALLBACK( CtrlSliderCursor, DownOver )
DEFINE_CALLBACK( CtrlSliderCursor, OverUp )
DEFINE_CALLBACK( CtrlSliderCursor, UpOver )
DEFINE_CALLBACK( CtrlSliderCursor, Move )
DEFINE_CALLBACK( CtrlSliderCursor, Scroll )
/// Last saved position of the cursor (stored as a percentage)
float m_lastPercentage;
/// Offset between the mouse pointer and the center of the cursor
int m_xOffset, m_yOffset;
/// The last received event
EvtGeneric *m_pEvt;
/// Images of the cursor in the differents states
OSGraphics *m_pImgUp, *m_pImgOver, *m_pImgDown;
/// Current image
OSGraphics *m_pImg;
/// Bezier curve of the slider
const Bezier &m_rCurve;
/// Method called when the position variable is modified
virtual void onUpdate( Subject<VarPercent> &rVariable, void * );
/// Method to compute the resize factors
void getResizeFactors( float &rFactorX, float &rFactorY ) const;
/// Call notifyLayout
void refreshLayout();
};
/// Slider background
class CtrlSliderBg: public CtrlGeneric, public Observer<VarPercent>
{
public:
CtrlSliderBg( intf_thread_t *pIntf,
const Bezier &rCurve, VarPercent &rVariable,
int thickness, GenericBitmap *pBackground, int nbHoriz,
int nbVert, int padHoriz, int padVert, VarBool *pVisible,
const UString &rHelp );
virtual ~CtrlSliderBg();
/// Tell whether the mouse is over the control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Method called when the control is resized
virtual void onResize();
/// Get the type of control (custom RTTI)
virtual string getType() const { return "slider_bg"; }
/// Associate a cursor to this background
void associateCursor( CtrlSliderCursor &rCursor );
private:
/// Cursor of the slider
CtrlSliderCursor *m_pCursor;
/// Variable associated to the slider
VarPercent &m_rVariable;
/// Thickness of the curve
int m_thickness;
/// Bezier curve of the slider
const Bezier &m_rCurve;
/// Initial size of the control
int m_width, m_height;
/// Background image sequence (optional)
GenericBitmap *m_pImgSeq;
/// Number of images in the background bitmap
int m_nbHoriz, m_nbVert;
/// Number of pixels between two images
int m_padHoriz, m_padVert;
/// Size of a background image
int m_bgWidth, m_bgHeight;
/// Index of the current background image
int m_position;
/// Method called when the observed variable is modified
virtual void onUpdate( Subject<VarPercent> &rVariable, void* );
/// Method to compute the resize factors
void getResizeFactors( float &rFactorX, float &rFactorY ) const;
public:
CtrlSliderBg( intf_thread_t *pIntf,
const Bezier &rCurve, VarPercent &rVariable,
int thickness, GenericBitmap *pBackground, int nbHoriz,
int nbVert, int padHoriz, int padVert, VarBool *pVisible,
const UString &rHelp );
virtual ~CtrlSliderBg();
/// Tell whether the mouse is over the control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Method called when the control is resized
virtual void onResize();
/// Get the type of control (custom RTTI)
virtual string getType() const { return "slider_bg"; }
/// Associate a cursor to this background
void associateCursor( CtrlSliderCursor &rCursor );
private:
/// Cursor of the slider
CtrlSliderCursor *m_pCursor;
/// Variable associated to the slider
VarPercent &m_rVariable;
/// Thickness of the curve
int m_thickness;
/// Bezier curve of the slider
const Bezier &m_rCurve;
/// Initial size of the control
int m_width, m_height;
/// Background image sequence (optional)
GenericBitmap *m_pImgSeq;
/// Number of images in the background bitmap
int m_nbHoriz, m_nbVert;
/// Number of pixels between two images
int m_padHoriz, m_padVert;
/// Size of a background image
int m_bgWidth, m_bgHeight;
/// Index of the current background image
int m_position;
/// Method called when the observed variable is modified
virtual void onUpdate( Subject<VarPercent> &rVariable, void* );
/// Method to compute the resize factors
void getResizeFactors( float &rFactorX, float &rFactorY ) const;
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CTRL_TEXT_HPP
......@@ -40,100 +40,100 @@ class VarText;
/// Class for control text
class CtrlText: public CtrlGeneric, public Observer<VarText>
{
public:
enum Align_t
{
kLeft,
kCenter,
kRight
};
enum Scrolling_t
{
// The text starts scrolling automatically if it is larger than the
// width of the control. The user can still stop it or make it
// scroll manually with the mouse.
kAutomatic,
// Only manual scrolling is allowed (with the mouse)
kManual,
// No scrolling of the text is allowed
kNone
};
/// Create a text control with the optional given color
CtrlText( intf_thread_t *pIntf, VarText &rVariable,
const GenericFont &rFont, const UString &rHelp,
uint32_t color, VarBool *pVisible, Scrolling_t scrollMode,
Align_t alignment);
virtual ~CtrlText();
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Set the text of the control, with an optional color
/// This takes effect immediatly
void setText( const UString &rText, uint32_t color = 0xFFFFFFFF );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "text"; }
private:
/// Finite state machine of the control
FSM m_fsm;
/// Variable associated to the control
VarText &m_rVariable;
/// Callback objects
DEFINE_CALLBACK( CtrlText, ToManual )
DEFINE_CALLBACK( CtrlText, ManualMoving )
DEFINE_CALLBACK( CtrlText, ManualStill )
DEFINE_CALLBACK( CtrlText, Move )
/// The last received event
EvtGeneric *m_pEvt;
/// Font used to render the text
const GenericFont &m_rFont;
/// Color of the text
uint32_t m_color;
/// Scrolling mode
Scrolling_t m_scrollMode;
/// Type of alignment
Align_t m_alignment;
/// Image of the text
GenericBitmap *m_pImg;
/// Image of the text, repeated twice and with some blank between;
/// useful to display a 'circular' moving text...
GenericBitmap *m_pImgDouble;
/// Current image (should always be equal to m_pImg or m_pImgDouble)
GenericBitmap *m_pCurrImg;
/// Position of the left side of the moving text (always <= 0)
int m_xPos;
/// Offset between the mouse pointer and the left side of the
/// moving text
int m_xOffset;
/// Timer to move the text
OSTimer *m_pTimer;
/// Callback for the timer
DEFINE_CALLBACK( CtrlText, UpdateText );
/// Method called when the observed variable is modified
virtual void onUpdate( Subject<VarText> &rVariable, void* );
/// Display the text on the control
void displayText( const UString &rText );
/// Helper function to set the position in the correct interval
void adjust( int &position );
/// Update the behaviour of the text whenever the control size changes
virtual void onPositionChange();
/// Update the behaviour of the text whenever the control size changes
virtual void onResize();
public:
enum Align_t
{
kLeft,
kCenter,
kRight
};
enum Scrolling_t
{
// The text starts scrolling automatically if it is larger than the
// width of the control. The user can still stop it or make it
// scroll manually with the mouse.
kAutomatic,
// Only manual scrolling is allowed (with the mouse)
kManual,
// No scrolling of the text is allowed
kNone
};
/// Create a text control with the optional given color
CtrlText( intf_thread_t *pIntf, VarText &rVariable,
const GenericFont &rFont, const UString &rHelp,
uint32_t color, VarBool *pVisible, Scrolling_t scrollMode,
Align_t alignment);
virtual ~CtrlText();
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Set the text of the control, with an optional color
/// This takes effect immediatly
void setText( const UString &rText, uint32_t color = 0xFFFFFFFF );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "text"; }
private:
/// Finite state machine of the control
FSM m_fsm;
/// Variable associated to the control
VarText &m_rVariable;
/// Callback objects
DEFINE_CALLBACK( CtrlText, ToManual )
DEFINE_CALLBACK( CtrlText, ManualMoving )
DEFINE_CALLBACK( CtrlText, ManualStill )
DEFINE_CALLBACK( CtrlText, Move )
/// The last received event
EvtGeneric *m_pEvt;
/// Font used to render the text
const GenericFont &m_rFont;
/// Color of the text
uint32_t m_color;
/// Scrolling mode
Scrolling_t m_scrollMode;
/// Type of alignment
Align_t m_alignment;
/// Image of the text
GenericBitmap *m_pImg;
/// Image of the text, repeated twice and with some blank between;
/// useful to display a 'circular' moving text...
GenericBitmap *m_pImgDouble;
/// Current image (should always be equal to m_pImg or m_pImgDouble)
GenericBitmap *m_pCurrImg;
/// Position of the left side of the moving text (always <= 0)
int m_xPos;
/// Offset between the mouse pointer and the left side of the
/// moving text
int m_xOffset;
/// Timer to move the text
OSTimer *m_pTimer;
/// Callback for the timer
DEFINE_CALLBACK( CtrlText, UpdateText );
/// Method called when the observed variable is modified
virtual void onUpdate( Subject<VarText> &rVariable, void* );
/// Display the text on the control
void displayText( const UString &rText );
/// Helper function to set the position in the correct interval
void adjust( int &position );
/// Update the behaviour of the text whenever the control size changes
virtual void onPositionChange();
/// Update the behaviour of the text whenever the control size changes
virtual void onResize();
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CTRL_TREE_HPP
......@@ -37,119 +37,119 @@ class GenericBitmap;
class CtrlTree: public CtrlGeneric, public Observer<VarTree, tree_update>,
public Observer<VarPercent>
{
public:
CtrlTree( intf_thread_t *pIntf,
VarTree &rTree,
const GenericFont &rFont,
const GenericBitmap *pBgBitmap,
const GenericBitmap *pItemBitmap,
const GenericBitmap *pOpenBitmap,
const GenericBitmap *pClosedBitmap,
uint32_t fgColor,
uint32_t playColor,
uint32_t bgColor1,
uint32_t bgColor2,
uint32_t selColor,
const UString &rHelp,
VarBool *pVisible,
VarBool *pFlat );
virtual ~CtrlTree();
/// Handle an event on the control
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Called when the layout is resized
virtual void onResize();
/// Return true if the control can gain the focus
virtual bool isFocusable() const { return true; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "tree"; }
/// Make sure an item is visible
/// \param item an iterator to a tree item
/// \return true if it changed the position
bool ensureVisible( VarTree::Iterator item );
/// Make sure an item is visible
/// \param itemIndex the absolute index in the tree
/// \return true if it changed the position
bool ensureVisible( int itemIndex );
private:
/// Tree associated to the control
VarTree &m_rTree;
/// Font
const GenericFont &m_rFont;
/// Background bitmap
const GenericBitmap *m_pBgBitmap;
/// Item (leaf) bitmap
// (TODO : add different bitmaps for different item types
// like in the wx playlist)
const GenericBitmap *m_pItemBitmap;
/// Open (expanded) node bitmap
const GenericBitmap *m_pOpenBitmap;
/// Closed node bitmap
const GenericBitmap *m_pClosedBitmap;
/// Color of normal test
uint32_t m_fgColor;
/// Color of the playing item
uint32_t m_playColor;
/// Background colors, used when no background bitmap is given
uint32_t m_bgColor1, m_bgColor2;
/// Background of selected items
uint32_t m_selColor;
/// Pointer on the last selected item in the tree
VarTree *m_pLastSelected;
/// Image of the control
OSGraphics *m_pImage;
/// First item in the visible area
VarTree::Iterator m_firstPos;
/// Don't move if the position variable is updated
bool m_dontMove;
/// Do we want to "flaten" the tree ?
bool m_flat;
/// Method called when the tree variable is modified
virtual void onUpdate( Subject<VarTree, tree_update> &rTree ,
tree_update *);
// Method called when the position variable of the tree is modified
virtual void onUpdate( Subject<VarPercent> &rPercent , void *);
/// Called when the position is set
virtual void onPositionChange();
/// Compute the number of lines that can be displayed
int maxItems();
/// Compute the item's height (depends on fonts and images used)
int itemHeight();
/// Compute the width of an item's bitmap
int itemImageWidth();
/// Check if the tree must be scrolled
void autoScroll();
/// Draw the image of the control
void makeImage();
/// Return the n'th displayed item (starting at position 0)
/**
* Return m_rTree.end() if such an item cannot be found (n < 0, or
* n too big)
*/
VarTree::Iterator findItemAtPos( int n );
public:
CtrlTree( intf_thread_t *pIntf,
VarTree &rTree,
const GenericFont &rFont,
const GenericBitmap *pBgBitmap,
const GenericBitmap *pItemBitmap,
const GenericBitmap *pOpenBitmap,
const GenericBitmap *pClosedBitmap,
uint32_t fgColor,
uint32_t playColor,
uint32_t bgColor1,
uint32_t bgColor2,
uint32_t selColor,
const UString &rHelp,
VarBool *pVisible,
VarBool *pFlat );
virtual ~CtrlTree();
/// Handle an event on the control
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Called when the layout is resized
virtual void onResize();
/// Return true if the control can gain the focus
virtual bool isFocusable() const { return true; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "tree"; }
/// Make sure an item is visible
/// \param item an iterator to a tree item
/// \return true if it changed the position
bool ensureVisible( VarTree::Iterator item );
/// Make sure an item is visible
/// \param itemIndex the absolute index in the tree
/// \return true if it changed the position
bool ensureVisible( int itemIndex );
private:
/// Tree associated to the control
VarTree &m_rTree;
/// Font
const GenericFont &m_rFont;
/// Background bitmap
const GenericBitmap *m_pBgBitmap;
/// Item (leaf) bitmap
// (TODO : add different bitmaps for different item types
// like in the wx playlist)
const GenericBitmap *m_pItemBitmap;
/// Open (expanded) node bitmap
const GenericBitmap *m_pOpenBitmap;
/// Closed node bitmap
const GenericBitmap *m_pClosedBitmap;
/// Color of normal test
uint32_t m_fgColor;
/// Color of the playing item
uint32_t m_playColor;
/// Background colors, used when no background bitmap is given
uint32_t m_bgColor1, m_bgColor2;
/// Background of selected items
uint32_t m_selColor;
/// Pointer on the last selected item in the tree
VarTree *m_pLastSelected;
/// Image of the control
OSGraphics *m_pImage;
/// First item in the visible area
VarTree::Iterator m_firstPos;
/// Don't move if the position variable is updated
bool m_dontMove;
/// Do we want to "flaten" the tree ?
bool m_flat;
/// Method called when the tree variable is modified
virtual void onUpdate( Subject<VarTree, tree_update> &rTree ,
tree_update *);
// Method called when the position variable of the tree is modified
virtual void onUpdate( Subject<VarPercent> &rPercent , void *);
/// Called when the position is set
virtual void onPositionChange();
/// Compute the number of lines that can be displayed
int maxItems();
/// Compute the item's height (depends on fonts and images used)
int itemHeight();
/// Compute the width of an item's bitmap
int itemImageWidth();
/// Check if the tree must be scrolled
void autoScroll();
/// Draw the image of the control
void makeImage();
/// Return the n'th displayed item (starting at position 0)
/**
* Return m_rTree.end() if such an item cannot be found (n < 0, or
* n too big)
*/
VarTree::Iterator findItemAtPos( int n );
};
#endif
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CTRL_VIDEO_HPP
......@@ -33,79 +33,79 @@
/// Control video
class CtrlVideo: public CtrlGeneric, public Observer<VarBox>
{
public:
CtrlVideo( intf_thread_t *pIntf, GenericLayout &rLayout,
bool autoResize, const UString &rHelp, VarBool *pVisible );
virtual ~CtrlVideo();
public:
CtrlVideo( intf_thread_t *pIntf, GenericLayout &rLayout,
bool autoResize, const UString &rHelp, VarBool *pVisible );
virtual ~CtrlVideo();
/// Handle an event on the control
virtual void handleEvent( EvtGeneric &rEvent );
/// Handle an event on the control
virtual void handleEvent( EvtGeneric &rEvent );
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
/// Callback for layout resize
virtual void onResize();
/// Callback for layout resize
virtual void onResize();
/// Called when the Position is set
virtual void onPositionChange();
/// Called when the Position is set
virtual void onPositionChange();
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Draw the control on the given graphics
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
/// Get the type of control (custom RTTI)
virtual string getType() const { return "video"; }
/// Get the type of control (custom RTTI)
virtual string getType() const { return "video"; }
/// Method called when the vout size is updated
virtual void onUpdate( Subject<VarBox> &rVoutSize, void* );
/// Method called when the vout size is updated
virtual void onUpdate( Subject<VarBox> &rVoutSize, void* );
/// Method called when visibility or ActiveLayout is updated
virtual void onUpdate( Subject<VarBool> &rVariable , void* );
/// Method called when visibility or ActiveLayout is updated
virtual void onUpdate( Subject<VarBool> &rVariable , void* );
// Attach a voutWindow to a Video Control
void attachVoutWindow( VoutWindow* pVoutWindow,
int width = -1, int height = -1 );
// Attach a voutWindow to a Video Control
void attachVoutWindow( VoutWindow* pVoutWindow,
int width = -1, int height = -1 );
// Detach a voutWindow from a Video Control
void detachVoutWindow( );
// Detach a voutWindow from a Video Control
void detachVoutWindow( );
// Update the inner part of the Video Control
void resizeInnerVout( );
// Update the inner part of the Video Control
void resizeInnerVout( );
// Get TopWindow associated with the video control
virtual TopWindow* getWindow() { return CtrlGeneric::getWindow(); }
// Get TopWindow associated with the video control
virtual TopWindow* getWindow() { return CtrlGeneric::getWindow(); }
// Get the VoutWindow associated with the video control
virtual VoutWindow* getVoutWindow() { return m_pVoutWindow; }
// Get the VoutWindow associated with the video control
virtual VoutWindow* getVoutWindow() { return m_pVoutWindow; }
/// Set the position and the associated layout of the control
virtual void setLayout( GenericLayout *pLayout,
const Position &rPosition );
/// Set the position and the associated layout of the control
virtual void setLayout( GenericLayout *pLayout,
const Position &rPosition );
// resize the video Control
virtual void resizeControl( int width, int height );
// resize the video Control
virtual void resizeControl( int width, int height );
// Is this control useable (visibility requirements)
virtual bool isUseable() { return m_bIsUseable; }
// Is this control useable (visibility requirements)
virtual bool isUseable() { return m_bIsUseable; }
// Is this control used
virtual bool isUsed() { return m_pVoutWindow ? true : false; }
// Is this control used
virtual bool isUsed() { return m_pVoutWindow ? true : false; }
private:
/// Associated layout
GenericLayout &m_rLayout;
private:
/// Associated layout
GenericLayout &m_rLayout;
/// Autoresize parameter
bool m_bAutoResize;
/// Autoresize parameter
bool m_bAutoResize;
/// Difference between layout size and video size
int m_xShift, m_yShift;
/// Difference between layout size and video size
int m_xShift, m_yShift;
/// Is the video Control useable
bool m_bIsUseable;
/// Is the video Control useable
bool m_bIsUseable;
/// Vout window
VoutWindow *m_pVoutWindow;
/// Vout window
VoutWindow *m_pVoutWindow;
};
#endif
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EVT_ENTER_HPP
......@@ -31,12 +31,10 @@
/// Mouse enter event
class EvtEnter: public EvtInput
{
public:
EvtEnter( intf_thread_t *pIntf ): EvtInput( pIntf ) {}
virtual ~EvtEnter() {}
/// Return the type of event
virtual const string getAsString() const { return "enter"; }
public:
EvtEnter( intf_thread_t *pIntf ): EvtInput( pIntf ) { }
virtual ~EvtEnter() { }
virtual const string getAsString() const { return "enter"; }
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EVT_FOCUS_HPP
......@@ -31,20 +31,19 @@
/// Focus change event
class EvtFocus: public EvtGeneric
{
public:
EvtFocus( intf_thread_t *pIntf, bool focus ): EvtGeneric( pIntf ),
m_focus( focus ) {}
virtual ~EvtFocus() {}
/// Return the type of event
virtual const string getAsString() const
{
return ( m_focus ? "focus:in" : "focus:out" );
}
private:
/// true for a focus in, and false for a focus out
bool m_focus;
public:
EvtFocus( intf_thread_t *pIntf, bool focus )
: EvtGeneric( pIntf ), m_focus( focus ) { }
virtual ~EvtFocus() { }
virtual const string getAsString() const
{
return ( m_focus ? "focus:in" : "focus:out" );
}
private:
/// true for a focus in, and false for a focus out
bool m_focus;
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EVT_GENERIC_HPP
......@@ -32,14 +32,14 @@
/// Base class for OS events
class EvtGeneric: public SkinObject
{
public:
virtual ~EvtGeneric() {}
public:
virtual ~EvtGeneric() { }
/// Return the type of the event
virtual const string getAsString() const = 0;
/// Return the type of the event
virtual const string getAsString() const = 0;
protected:
EvtGeneric( intf_thread_t *pIntf ): SkinObject( pIntf ) {}
protected:
EvtGeneric( intf_thread_t *pIntf ): SkinObject( pIntf ) { }
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EVT_INPUT_HPP
......@@ -31,27 +31,27 @@
/// Base class for mouse and key events
class EvtInput: public EvtGeneric
{
public:
virtual ~EvtInput() {}
public:
virtual ~EvtInput() { }
/// Masks for modifier keys
static const int kModNone;
static const int kModAlt;
static const int kModCtrl;
static const int kModShift;
/// Masks for modifier keys
static const int kModNone;
static const int kModAlt;
static const int kModCtrl;
static const int kModShift;
/// Get the modifiers
virtual int getMod() const { return m_mod; }
/// Get the modifiers
virtual int getMod() const { return m_mod; }
protected:
EvtInput( intf_thread_t *pIntf, int mod = kModNone );
protected:
EvtInput( intf_thread_t *pIntf, int mod = kModNone );
/// Add the modifier to the event string
virtual void addModifier( string &rEvtString ) const;
/// Add the modifier to the event string
virtual void addModifier( string &rEvtString ) const;
private:
/// Modifiers (special key(s) pressed during the mouse event)
int m_mod;
private:
/// Modifiers (special key(s) pressed during the mouse event)
int m_mod;
};
#endif
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EVT_KEY_HPP
......@@ -31,29 +31,26 @@
/// Class for keyboard events
class EvtKey: public EvtInput
{
public:
enum ActionType_t
{
kDown,
kUp
};
EvtKey( intf_thread_t *pIntf, int key, ActionType_t action,
int mod = kModNone ):
EvtInput( pIntf, mod ), m_key( key ), m_action( action ) {}
virtual ~EvtKey() {}
/// Return the type of event
virtual const string getAsString() const;
int getKey() const { return m_key; }
private:
/// The concerned key, stored according to the '#define's in vlc_keys.h
/// but without the modifiers (which are stored in EvtInput)
int m_key;
/// Type of action
ActionType_t m_action;
public:
enum ActionType_t
{
kDown,
kUp
};
EvtKey( intf_thread_t *I, int key, ActionType_t actn, int mod = kModNone )
: EvtInput( I, mod ), m_key( key ), m_action( actn ) { }
virtual ~EvtKey() { }
virtual const string getAsString() const;
int getKey() const { return m_key; }
private:
/// The concerned key, stored according to the '#define's in vlc_keys.h
/// but without the modifiers (which are stored in EvtInput)
int m_key;
/// Type of action
ActionType_t m_action;
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EVT_LEAVE_HPP
......@@ -31,12 +31,10 @@
/// Mouse leave event
class EvtLeave: public EvtInput
{
public:
EvtLeave( intf_thread_t *pIntf ): EvtInput( pIntf ) {}
virtual ~EvtLeave() {}
/// Return the type of event
virtual const string getAsString() const { return "leave"; }
public:
EvtLeave( intf_thread_t *pIntf ): EvtInput( pIntf ) { }
virtual ~EvtLeave() { }
virtual const string getAsString() const { return "leave"; }
};
......
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EVT_MENU_HPP
......@@ -30,20 +30,17 @@
/// Mouse move event
class EvtMenu: public EvtGeneric
{
public:
EvtMenu( intf_thread_t *pIntf, int itemId ):
EvtGeneric( pIntf ), m_itemId( itemId ) {}
virtual ~EvtMenu() {}
public:
EvtMenu( intf_thread_t *pIntf, int itemId )
: EvtGeneric( pIntf ), m_itemId( itemId ) { }
virtual ~EvtMenu() { }
virtual const string getAsString() const { return "menu"; }
/// Return the type of event
virtual const string getAsString() const { return "menu"; }
int getItemId() const { return m_itemId; }
// Getter
int getItemId() const { return m_itemId; }
private:
/// Coordinates of the mouse (absolute or relative)
int m_itemId;
private:
/// Coordinates of the mouse (absolute or relative)
int m_itemId;
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EVT_MOTION_HPP
......@@ -31,26 +31,24 @@
/// Mouse move event
class EvtMotion: public EvtInput
{
public:
EvtMotion( intf_thread_t *pIntf, int xPos, int yPos ):
EvtInput( pIntf ), m_xPos( xPos ), m_yPos( yPos ) {}
virtual ~EvtMotion() {}
/// Return the type of event
virtual const string getAsString() const { return "motion"; }
// Getters
int getXPos() const { return m_xPos; }
int getYPos() const { return m_yPos; }
private:
/// Coordinates of the mouse (absolute or relative)
/**
* The coordinates are absolute when the event is sent to the
* GenericWindow, but are relative to the window when the event is
* forwarded to the controls
*/
int m_xPos, m_yPos;
public:
EvtMotion( intf_thread_t *pIntf, int xPos, int yPos )
: EvtInput( pIntf ), m_xPos( xPos ), m_yPos( yPos ) { }
virtual ~EvtMotion() { }
virtual const string getAsString() const { return "motion"; }
// Getters
int getXPos() const { return m_xPos; }
int getYPos() const { return m_yPos; }
private:
/// Coordinates of the mouse (absolute or relative)
/**
* The coordinates are absolute when the event is sent to the
* GenericWindow, but are relative to the window when the event is
* forwarded to the controls
*/
int m_xPos, m_yPos;
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EVT_MOUSE_HPP
......@@ -31,44 +31,43 @@
/// Class for mouse button events
class EvtMouse: public EvtInput
{
public:
enum ButtonType_t
{
kLeft,
kMiddle,
kRight
};
public:
enum ButtonType_t
{
kLeft,
kMiddle,
kRight
};
enum ActionType_t
{
kDown,
kUp,
kDblClick
};
enum ActionType_t
{
kDown,
kUp,
kDblClick
};
EvtMouse( intf_thread_t *pIntf, int xPos, int yPos, ButtonType_t button,
ActionType_t action, int mod = kModNone ):
EvtInput( pIntf, mod ), m_xPos( xPos ), m_yPos( yPos ),
m_button( button ), m_action( action ) {}
virtual ~EvtMouse() {}
EvtMouse( intf_thread_t *pIntf, int xPos, int yPos, ButtonType_t button,
ActionType_t action, int mod = kModNone )
: EvtInput( pIntf, mod ), m_xPos( xPos ), m_yPos( yPos ),
m_button( button ), m_action( action ) { }
virtual ~EvtMouse() { }
virtual const string getAsString() const;
// Return the event coordinates
int getXPos() const { return m_xPos; }
int getYPos() const { return m_yPos; }
// Return the event coordinates
int getXPos() const { return m_xPos; }
int getYPos() const { return m_yPos; }
// Return the button and the action
ButtonType_t getButton() const { return m_button; }
ActionType_t getAction() const { return m_action; }
// Return the button and the action
ButtonType_t getButton() const { return m_button; }
ActionType_t getAction() const { return m_action; }
virtual const string getAsString() const;
private:
/// Coordinates of the mouse relative to the window
int m_xPos, m_yPos;
/// Mouse button involved in the event
ButtonType_t m_button;
/// Type of action
ActionType_t m_action;
private:
/// Coordinates of the mouse relative to the window
int m_xPos, m_yPos;
/// Mouse button involved in the event
ButtonType_t m_button;
/// Type of action
ActionType_t m_action;
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EVT_REFRESH_HPP
......@@ -31,27 +31,25 @@
/// Refresh window event
class EvtRefresh: public EvtGeneric
{
public:
/// Constructor with the coordinates of the area to refresh
EvtRefresh( intf_thread_t *pIntf, int xStart, int yStart, int width,
int height ):
EvtGeneric( pIntf ), m_xStart( xStart ), m_yStart( yStart ),
m_width( width ), m_height( height ) {}
virtual ~EvtRefresh() {}
/// Return the type of event
virtual const string getAsString() const { return "refresh"; }
/// Getters
int getXStart() const { return m_xStart; }
int getYStart() const { return m_yStart; }
int getWidth() const { return m_width; }
int getHeight() const { return m_height; }
private:
/// Coordinates and size of the area to refresh
int m_xStart, m_yStart, m_width, m_height;
public:
/// Constructor with the coordinates of the area to refresh
EvtRefresh( intf_thread_t *pIntf, int xStart, int yStart,
int width, int height )
: EvtGeneric( pIntf ), m_xStart( xStart ), m_yStart( yStart ),
m_width( width ), m_height( height ) { }
virtual ~EvtRefresh() { }
virtual const string getAsString() const { return "refresh"; }
/// Getters
int getXStart() const { return m_xStart; }
int getYStart() const { return m_yStart; }
int getWidth() const { return m_width; }
int getHeight() const { return m_height; }
private:
/// Coordinates and size of the area to refresh
int m_xStart, m_yStart, m_width, m_height;
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EVT_SCROLL_HPP
......@@ -31,33 +31,32 @@
/// Class for mouse scroll events
class EvtScroll: public EvtInput
{
public:
enum Direction_t
{
kUp,
kDown
};
EvtScroll( intf_thread_t *pIntf, int xPos, int yPos,
Direction_t direction, int mod = kModNone ):
EvtInput( pIntf, mod ), m_xPos( xPos ), m_yPos( yPos ),
m_direction( direction ) {}
virtual ~EvtScroll() {}
// Return the event coordinates
int getXPos() const { return m_xPos; }
int getYPos() const { return m_yPos; }
// Return the direction
Direction_t getDirection() const { return m_direction; }
virtual const string getAsString() const;
private:
/// Coordinates of the mouse relative to the window
int m_xPos, m_yPos;
/// Scroll direction
Direction_t m_direction;
public:
enum Direction_t
{
kUp,
kDown
};
EvtScroll( intf_thread_t *pIntf, int xPos, int yPos,
Direction_t direction, int mod = kModNone )
: EvtInput( pIntf, mod ), m_xPos( xPos ), m_yPos( yPos ),
m_direction( direction ) { }
virtual ~EvtScroll() { }
virtual const string getAsString() const;
// Return the event coordinates
int getXPos() const { return m_xPos; }
int getYPos() const { return m_yPos; }
// Return the direction
Direction_t getDirection() const { return m_direction; }
private:
/// Coordinates of the mouse relative to the window
int m_xPos, m_yPos;
/// Scroll direction
Direction_t m_direction;
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EVT_SPECIAL_HPP
......@@ -31,25 +31,23 @@
/// Class for non-genuine events
class EvtSpecial: public EvtGeneric
{
public:
enum ActionType_t
{
kShow,
kHide,
kEnable,
kDisable
};
EvtSpecial( intf_thread_t *pIntf, ActionType_t action ):
EvtGeneric( pIntf ), m_action( action ) {}
virtual ~EvtSpecial() {}
/// Return the type of event
virtual const string getAsString() const;
private:
/// Type of action
ActionType_t m_action;
public:
enum ActionType_t
{
kShow,
kHide,
kEnable,
kDisable
};
EvtSpecial( intf_thread_t *pIntf, ActionType_t action )
: EvtGeneric( pIntf ), m_action( action ) { }
virtual ~EvtSpecial() { }
virtual const string getAsString() const;
private:
/// Type of action
ActionType_t m_action;
};
......
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef MACOSX_DRAGDROP_HPP
......@@ -28,15 +28,15 @@
class MacOSXDragDrop: public SkinObject
{
public:
typedef long ldata_t[5];
public:
typedef long ldata_t[5];
MacOSXDragDrop( intf_thread_t *pIntf, bool playOnDrop );
virtual ~MacOSXDragDrop() {}
MacOSXDragDrop( intf_thread_t *pIntf, bool playOnDrop );
virtual ~MacOSXDragDrop() { }
private:
/// Indicates whether the file(s) must be played immediately
bool m_playOnDrop;
private:
/// Indicates whether the file(s) must be played immediately
bool m_playOnDrop;
};
......
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef MACOSX_FACTORY_HPP
......@@ -30,82 +30,82 @@
/// Class used to instanciate MacOSX specific objects
class MacOSXFactory: public OSFactory
{
public:
MacOSXFactory( intf_thread_t *pIntf );
virtual ~MacOSXFactory();
public:
MacOSXFactory( intf_thread_t *pIntf );
virtual ~MacOSXFactory();
/// Initialization method
virtual bool init();
/// Initialization method
virtual bool init();
/// Instantiate an object OSGraphics
virtual OSGraphics *createOSGraphics( int width, int height );
/// Instantiate an object OSGraphics
virtual OSGraphics *createOSGraphics( int width, int height );
/// Get the instance of the singleton OSLoop
virtual OSLoop *getOSLoop();
/// Get the instance of the singleton OSLoop
virtual OSLoop *getOSLoop();
/// Destroy the instance of OSLoop
virtual void destroyOSLoop();
/// Destroy the instance of OSLoop
virtual void destroyOSLoop();
/// Instantiate an OSTimer with the given callback
virtual OSTimer *createOSTimer( CmdGeneric &rCmd );
/// Instantiate an OSTimer with the given callback
virtual OSTimer *createOSTimer( CmdGeneric &rCmd );
/// Minimize all the windows
virtual void minimize();
/// Minimize all the windows
virtual void minimize();
/// Restore the minimized windows
virtual void restore();
/// Restore the minimized windows
virtual void restore();
/// Add an icon in the system tray
virtual void addInTray();
/// Add an icon in the system tray
virtual void addInTray();
/// Remove the icon from the system tray
virtual void removeFromTray();
/// Remove the icon from the system tray
virtual void removeFromTray();
/// Show the task in the task bar
virtual void addInTaskBar();
/// Show the task in the task bar
virtual void addInTaskBar();
/// Remove the task from the task bar
virtual void removeFromTaskBar();
/// Remove the task from the task bar
virtual void removeFromTaskBar();
/// Instantiate an OSWindow object
virtual OSWindow *createOSWindow( GenericWindow &rWindow,
bool dragDrop, bool playOnDrop,
OSWindow *pParent );
/// Instantiate an OSWindow object
virtual OSWindow *createOSWindow( GenericWindow &rWindow,
bool dragDrop, bool playOnDrop,
OSWindow *pParent );
/// Instantiate an object OSTooltip
virtual OSTooltip *createOSTooltip();
/// Instantiate an object OSTooltip
virtual OSTooltip *createOSTooltip();
/// Instantiate an object OSPopup
virtual OSPopup *createOSPopup();
/// Instantiate an object OSPopup
virtual OSPopup *createOSPopup();
/// Get the directory separator
virtual const string &getDirSeparator() const { return m_dirSep; }
/// Get the directory separator
virtual const string &getDirSeparator() const { return m_dirSep; }
/// Get the resource path
virtual const list<string> &getResourcePath() const
{ return m_resourcePath; }
/// Get the resource path
virtual const list<string> &getResourcePath() const
{ return m_resourcePath; }
/// Get the screen size
virtual int getScreenWidth() const;
virtual int getScreenHeight() const;
/// Get the screen size
virtual int getScreenWidth() const;
virtual int getScreenHeight() const;
/// Get the work area (screen area without taskbars)
virtual SkinsRect getWorkArea() const;
/// Get the work area (screen area without taskbars)
virtual SkinsRect getWorkArea() const;
/// Get the position of the mouse
virtual void getMousePos( int &rXPos, int &rYPos ) const;
/// Get the position of the mouse
virtual void getMousePos( int &rXPos, int &rYPos ) const;
/// Change the cursor
virtual void changeCursor( CursorType_t type ) const { /*TODO*/ }
/// Change the cursor
virtual void changeCursor( CursorType_t type ) const { /*TODO*/ }
/// Delete a directory recursively
virtual void rmDir( const string &rPath );
/// Delete a directory recursively
virtual void rmDir( const string &rPath );
private:
/// Directory separator
const string m_dirSep;
/// Resource path
list<string> m_resourcePath;
private:
/// Directory separator
const string m_dirSep;
/// Resource path
list<string> m_resourcePath;
};
#endif
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef MACOSX_GRAPHICS_HPP
......@@ -33,51 +33,51 @@ class GenericBitmap;
/// MacOSX implementation of OSGraphics
class MacOSXGraphics: public OSGraphics
{
public:
MacOSXGraphics( intf_thread_t *pIntf, int width, int height);
public:
MacOSXGraphics( intf_thread_t *pIntf, int width, int height);
virtual ~MacOSXGraphics();
virtual ~MacOSXGraphics();
/// Clear the graphics
virtual void clear();
/// Clear the graphics
virtual void clear();
/// Draw another graphics on this one
virtual void drawGraphics( const OSGraphics &rGraphics, int xSrc = 0,
int ySrc = 0, int xDest = 0, int yDest = 0,
int width = -1, int height = -1 );
/// Draw another graphics on this one
virtual void drawGraphics( const OSGraphics &rGraphics, int xSrc = 0,
int ySrc = 0, int xDest = 0, int yDest = 0,
int width = -1, int height = -1 );
/// Render a bitmap on this graphics
virtual void drawBitmap( const GenericBitmap &rBitmap, int xSrc = 0,
int ySrc = 0, int xDest = 0, int yDest = 0,
int width = -1, int height = -1,
bool blend = false );
/// Render a bitmap on this graphics
virtual void drawBitmap( const GenericBitmap &rBitmap, int xSrc = 0,
int ySrc = 0, int xDest = 0, int yDest = 0,
int width = -1, int height = -1,
bool blend = false );
/// Draw a filled rectangle on the grahics (color is #RRGGBB)
virtual void fillRect( int left, int top, int width, int height,
uint32_t color );
/// Draw a filled rectangle on the grahics (color is #RRGGBB)
virtual void fillRect( int left, int top, int width, int height,
uint32_t color );
/// Draw an empty rectangle on the grahics (color is #RRGGBB)
virtual void drawRect( int left, int top, int width, int height,
uint32_t color );
/// Draw an empty rectangle on the grahics (color is #RRGGBB)
virtual void drawRect( int left, int top, int width, int height,
uint32_t color );
/// Set the shape of a window with the mask of this graphics.
virtual void applyMaskToWindow( OSWindow &rWindow );
/// Set the shape of a window with the mask of this graphics.
virtual void applyMaskToWindow( OSWindow &rWindow );
/// Copy the graphics on a window
virtual void copyToWindow( OSWindow &rWindow, int xSrc,
int ySrc, int width, int height,
int xDest, int yDest );
/// Copy the graphics on a window
virtual void copyToWindow( OSWindow &rWindow, int xSrc,
int ySrc, int width, int height,
int xDest, int yDest );
/// Tell whether the pixel at the given position is visible
virtual bool hit( int x, int y ) const;
/// Tell whether the pixel at the given position is visible
virtual bool hit( int x, int y ) const;
/// Getters
virtual int getWidth() const { return m_width; }
virtual int getHeight() const { return m_height; }
/// Getters
virtual int getWidth() const { return m_width; }
virtual int getHeight() const { return m_height; }
private:
/// Size of the image
int m_width, m_height;
private:
/// Size of the image
int m_width, m_height;
};
......
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef MACOSX_LOOP_HPP
......@@ -33,28 +33,28 @@ class GenericWindow;
/// Main event loop for MacOSX (singleton)
class MacOSXLoop: public OSLoop
{
public:
/// Get the instance of MacOSXLoop
static OSLoop *instance( intf_thread_t *pIntf );
public:
/// Get the instance of MacOSXLoop
static OSLoop *instance( intf_thread_t *pIntf );
/// Destroy the instance of MacOSXLoop
static void destroy( intf_thread_t *pIntf );
/// Destroy the instance of MacOSXLoop
static void destroy( intf_thread_t *pIntf );
/// Enter the event loop
virtual void run();
/// Enter the event loop
virtual void run();
/// Exit the main loop
virtual void exit();
/// Exit the main loop
virtual void exit();
// Handle a window event
void registerWindow( GenericWindow &rGenWin, WindowRef win );
// Handle a window event
void registerWindow( GenericWindow &rGenWin, WindowRef win );
private:
// Private because it's a singleton
MacOSXLoop( intf_thread_t *pIntf );
virtual ~MacOSXLoop();
// Flag set to exit the loop
bool m_exit;
private:
// Private because it's a singleton
MacOSXLoop( intf_thread_t *pIntf );
virtual ~MacOSXLoop();
// Flag set to exit the loop
bool m_exit;
};
#endif
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef MACOSX_POPUP_HPP
......@@ -30,25 +30,25 @@
/// MacOSX implementation of OSPopup
class MacOSXPopup: public OSPopup
{
public:
MacOSXPopup( intf_thread_t *pIntf );
public:
MacOSXPopup( intf_thread_t *pIntf );
virtual ~MacOSXPopup();
virtual ~MacOSXPopup();
/// Show the popup menu at the given (absolute) corrdinates
virtual void show( int xPos, int yPos );
/// Show the popup menu at the given (absolute) corrdinates
virtual void show( int xPos, int yPos );
/// Hide the popup menu
virtual void hide();
/// Hide the popup menu
virtual void hide();
/// Append a new menu item with the given label to the popup menu
virtual void addItem( const string &rLabel, int pos );
/// Append a new menu item with the given label to the popup menu
virtual void addItem( const string &rLabel, int pos );
/// Create a dummy menu item to separate sections
virtual void addSeparator( int pos );
/// Create a dummy menu item to separate sections
virtual void addSeparator( int pos );
/// Return the position of the item identified by the given id
virtual int getPosFromId( int id ) const;
/// Return the position of the item identified by the given id
virtual int getPosFromId( int id ) const;
};
......
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef MACOSX_TIMER_HPP
......@@ -34,20 +34,20 @@ class CmdGeneric;
// MacOSX specific timer
class MacOSXTimer: public OSTimer
{
public:
MacOSXTimer( intf_thread_t *pIntf, CmdGeneric &rCmd );
virtual ~MacOSXTimer();
public:
MacOSXTimer( intf_thread_t *pIntf, CmdGeneric &rCmd );
virtual ~MacOSXTimer();
/// (Re)start the timer with the given delay (in ms). If oneShot is
/// true, stop it after the first execution of the callback.
virtual void start( int delay, bool oneShot );
/// (Re)start the timer with the given delay (in ms). If oneShot is
/// true, stop it after the first execution of the callback.
virtual void start( int delay, bool oneShot );
/// Stop the timer
virtual void stop();
/// Stop the timer
virtual void stop();
private:
/// Command to execute
CmdGeneric &m_rCommand;
private:
/// Command to execute
CmdGeneric &m_rCommand;
};
......
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef MACOSX_TOOLTIP_HPP
......@@ -32,18 +32,16 @@ class MacOSXDisplay;
/// MacOSX implementation of OSTooltip
class MacOSXTooltip: public OSTooltip
{
public:
MacOSXTooltip( intf_thread_t *pIntf );
public:
MacOSXTooltip( intf_thread_t *pIntf );
virtual ~MacOSXTooltip();
virtual ~MacOSXTooltip();
/// Show the tooltip
virtual void show( int left, int top, OSGraphics &rText );
/// Show the tooltip
virtual void show( int left, int top, OSGraphics &rText );
/// Hide the tooltip
virtual void hide();
private:
/// Hide the tooltip
virtual void hide();
};
......
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef MACOSX_WINDOW_HPP
......@@ -34,42 +34,42 @@ class MacOSXDragDrop;
/// MacOSX implementation of OSWindow
class MacOSXWindow: public OSWindow
{
public:
MacOSXWindow( intf_thread_t *pIntf, GenericWindow &rWindow,
bool dragDrop, bool playOnDrop,
MacOSXWindow *pParentWindow );
public:
MacOSXWindow( intf_thread_t *pIntf, GenericWindow &rWindow,
bool dragDrop, bool playOnDrop,
MacOSXWindow *pParentWindow );
virtual ~MacOSXWindow();
virtual ~MacOSXWindow();
// Show the window
virtual void show( int left, int top ) const;
// Show the window
virtual void show( int left, int top ) const;
// Hide the window
virtual void hide() const;
// Hide the window
virtual void hide() const;
/// Move the window
virtual void moveResize( int left, int top,
int width, int height ) const;
/// Move the window
virtual void moveResize( int left, int top,
int width, int height ) const;
/// Bring the window on top
virtual void raise() const;
/// Bring the window on top
virtual void raise() const;
/// Set the opacity of the window (0 = transparent, 255 = opaque)
virtual void setOpacity( uint8_t value ) const;
/// Set the opacity of the window (0 = transparent, 255 = opaque)
virtual void setOpacity( uint8_t value ) const;
/// Toggle the window on top
virtual void toggleOnTop( bool onTop ) const;
/// Toggle the window on top
virtual void toggleOnTop( bool onTop ) const;
/// Get the Carbon window handle
WindowRef getWindowRef() const { return m_win; };
/// Get the Carbon window handle
WindowRef getWindowRef() const { return m_win; };
private:
/// Parent window
MacOSXWindow *m_pParent;
/// Indicates whether the window handles drag&drop events
bool m_dragDrop;
/// Carbon Window object
WindowRef m_win;
private:
/// Parent window
MacOSXWindow *m_pParent;
/// Indicates whether the window handles drag&drop events
bool m_dragDrop;
/// Carbon Window object
WindowRef m_win;
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
......@@ -47,72 +47,72 @@ class GenericRect;
/// Class for skin construction
class Builder: public SkinObject
{
public:
Builder( intf_thread_t *pIntf, const BuilderData &rData,
const string &rPath );
virtual ~Builder();
/// Create a Theme object, ready to use.
/// Return NULL in case of problem
Theme *build();
/// Parse an action tag and returns a command
CmdGeneric *parseAction( const string &rAction );
private:
/// Data from the XML
const BuilderData &m_rData;
/// Path of the theme
const string m_path;
/// Theme under construction
Theme *m_pTheme;
void addTheme( const BuilderData::Theme &rData );
void addIniFile( const BuilderData::IniFile &rData );
void addBitmap( const BuilderData::Bitmap &rData );
void addSubBitmap( const BuilderData::SubBitmap &rData );
void addBitmapFont( const BuilderData::BitmapFont &rData );
void addFont( const BuilderData::Font &rData );
void addPopupMenu( const BuilderData::PopupMenu &rData );
void addMenuItem( const BuilderData::MenuItem &rData );
void addMenuSeparator( const BuilderData::MenuSeparator &rData );
void addWindow( const BuilderData::Window &rData );
void addLayout( const BuilderData::Layout &rData );
void addAnchor( const BuilderData::Anchor &rData );
void addButton( const BuilderData::Button &rData );
void addCheckbox( const BuilderData::Checkbox &rData );
void addImage( const BuilderData::Image &rData );
void addPanel( const BuilderData::Panel &rData );
void addText( const BuilderData::Text &rData );
void addRadialSlider( const BuilderData::RadialSlider &rData );
void addSlider( const BuilderData::Slider &rData );
void addList( const BuilderData::List &rData );
void addTree( const BuilderData::Tree &rData );
void addVideo( const BuilderData::Video &rData );
/// Compute the position of a control
const Position makePosition( const string &rLeftTop,
const string &rRightBottom,
int xPos, int yPos, int width, int height,
const GenericRect &rRect,
bool xKeepRatio = false,
bool yKeepRatio = false ) const;
// Build the full path of a file
string getFilePath( const string &fileName ) const;
/// Get a font from its id
GenericFont *getFont( const string &fontId );
/// Function to parse "points" tags
Bezier *getPoints( const char *pTag ) const;
/// Compute a color value
uint32_t getColor( const string &rVal ) const;
/// Image handler (used to load image files)
image_handler_t *m_pImageHandler;
public:
Builder( intf_thread_t *pIntf, const BuilderData &rData,
const string &rPath );
virtual ~Builder();
/// Create a Theme object, ready to use.
/// Return NULL in case of problem
Theme *build();
/// Parse an action tag and returns a command
CmdGeneric *parseAction( const string &rAction );
private:
/// Data from the XML
const BuilderData &m_rData;
/// Path of the theme
const string m_path;
/// Theme under construction
Theme *m_pTheme;
void addTheme( const BuilderData::Theme &rData );
void addIniFile( const BuilderData::IniFile &rData );
void addBitmap( const BuilderData::Bitmap &rData );
void addSubBitmap( const BuilderData::SubBitmap &rData );
void addBitmapFont( const BuilderData::BitmapFont &rData );
void addFont( const BuilderData::Font &rData );
void addPopupMenu( const BuilderData::PopupMenu &rData );
void addMenuItem( const BuilderData::MenuItem &rData );
void addMenuSeparator( const BuilderData::MenuSeparator &rData );
void addWindow( const BuilderData::Window &rData );
void addLayout( const BuilderData::Layout &rData );
void addAnchor( const BuilderData::Anchor &rData );
void addButton( const BuilderData::Button &rData );
void addCheckbox( const BuilderData::Checkbox &rData );
void addImage( const BuilderData::Image &rData );
void addPanel( const BuilderData::Panel &rData );
void addText( const BuilderData::Text &rData );
void addRadialSlider( const BuilderData::RadialSlider &rData );
void addSlider( const BuilderData::Slider &rData );
void addList( const BuilderData::List &rData );
void addTree( const BuilderData::Tree &rData );
void addVideo( const BuilderData::Video &rData );
/// Compute the position of a control
const Position makePosition( const string &rLeftTop,
const string &rRightBottom,
int xPos, int yPos, int width, int height,
const GenericRect &rRect,
bool xKeepRatio = false,
bool yKeepRatio = false ) const;
// Build the full path of a file
string getFilePath( const string &fileName ) const;
/// Get a font from its id
GenericFont *getFont( const string &fontId );
/// Function to parse "points" tags
Bezier *getPoints( const char *pTag ) const;
/// Compute a color value
uint32_t getColor( const string &rVal ) const;
/// Image handler (used to load image files)
image_handler_t *m_pImageHandler;
};
#endif
......
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EXPR_EVALUATOR_HPP
......@@ -31,26 +31,23 @@
/// Expression evaluator using Reverse Polish Notation
class ExprEvaluator: public SkinObject
{
public:
/// Constructor
ExprEvaluator( intf_thread_t *pIntf ): SkinObject( pIntf ) {}
public:
ExprEvaluator( intf_thread_t *pIntf ): SkinObject( pIntf ) { }
~ExprEvaluator() { }
/// Destructor
~ExprEvaluator() {}
/// Clear the RPN stack and parse an expression
void parse( const string &rExpr );
/// Clear the RPN stack and parse an expression
void parse( const string &rExpr );
/// Pop the first token from the RPN stack.
/// Return NULL when the stack is empty.
string getToken();
/// Pop the first token from the RPN stack.
/// Return NULL when the stack is empty.
string getToken();
private:
/// RPN stack
list<string> m_stack;
private:
/// RPN stack
list<string> m_stack;
/// Returns true if op1 has precedency over op2
bool hasPrecedency( const string &op1, const string &op2 ) const;
/// Returns true if op1 has precedency over op2
bool hasPrecedency( const string &op1, const string &op2 ) const;
};
#endif
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef INTERPRETER_HPP
......@@ -38,41 +38,41 @@ class VarPercent;
/// Command interpreter for scripts in the XML
class Interpreter: public SkinObject
{
public:
/// Get the instance of Interpreter
static Interpreter *instance( intf_thread_t *pIntf );
public:
/// Get the instance of Interpreter
static Interpreter *instance( intf_thread_t *pIntf );
/// Delete the instance of Interpreter
static void destroy( intf_thread_t *pIntf );
/// Delete the instance of Interpreter
static void destroy( intf_thread_t *pIntf );
/// Parse an action tag and returns a pointer on a command
/// (the intepreter takes care of deleting it, don't do it
/// yourself !)
CmdGeneric *parseAction( const string &rAction, Theme *pTheme );
/// Parse an action tag and returns a pointer on a command
/// (the intepreter takes care of deleting it, don't do it
/// yourself !)
CmdGeneric *parseAction( const string &rAction, Theme *pTheme );
/// Returns the boolean variable corresponding to the given name
VarBool *getVarBool( const string &rName, Theme *pTheme );
/// Returns the boolean variable corresponding to the given name
VarBool *getVarBool( const string &rName, Theme *pTheme );
/// Returns the percent variable corresponding to the given name
VarPercent *getVarPercent( const string &rName, Theme *pTheme );
/// Returns the percent variable corresponding to the given name
VarPercent *getVarPercent( const string &rName, Theme *pTheme );
/// Returns the list variable corresponding to the given name
VarList *getVarList( const string &rName, Theme *pTheme );
/// Returns the list variable corresponding to the given name
VarList *getVarList( const string &rName, Theme *pTheme );
/// Returns the tree variable corresponding to the given name
VarTree *getVarTree( const string &rName, Theme *pTheme );
/// Returns the tree variable corresponding to the given name
VarTree *getVarTree( const string &rName, Theme *pTheme );
/// Get a constant value
string getConstant( const string &rValue );
/// Get a constant value
string getConstant( const string &rValue );
private:
/// Map of global commands
map<string, CmdGenericPtr> m_commandMap;
private:
/// Map of global commands
map<string, CmdGenericPtr> m_commandMap;
// Private because it is a singleton
Interpreter( intf_thread_t *pIntf );
virtual ~Interpreter() {}
// Private because it is a singleton
Interpreter( intf_thread_t *pIntf );
virtual ~Interpreter() { }
};
#endif
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef SKIN_PARSER_HPP
......@@ -32,61 +32,61 @@
/// Parser for the skin DTD
class SkinParser: public XMLParser
{
public:
SkinParser( intf_thread_t *pIntf, const string &rFileName,
const string &rPath, bool useDTD = true,
BuilderData *pData = NULL );
virtual ~SkinParser();
public:
SkinParser( intf_thread_t *pIntf, const string &rFileName,
const string &rPath, bool useDTD = true,
BuilderData *pData = NULL );
virtual ~SkinParser();
const BuilderData &getData() const { return *m_pData; }
const BuilderData &getData() const { return *m_pData; }
static int convertColor( const char *transcolor );
static int convertColor( const char *transcolor );
private:
/// Path of the theme
const string m_path;
/// Container for mapping data from the XML
BuilderData *m_pData;
/// Indicate whether the class owns the data
bool m_ownData;
/// Current IDs
string m_curBitmapId;
string m_curWindowId;
string m_curLayoutId;
string m_curPopupId;
string m_curListId;
string m_curTreeId;
/// Current position of menu items in the popups
list<int> m_popupPosList;
/// Current offset of the controls
int m_xOffset, m_yOffset;
list<int> m_xOffsetList, m_yOffsetList;
/// Stack of panel ids
list<string> m_panelStack;
/// Layer of the current control in the layout
int m_curLayer;
/// Set of used id
set<string> m_idSet;
private:
/// Path of the theme
const string m_path;
/// Container for mapping data from the XML
BuilderData *m_pData;
/// Indicate whether the class owns the data
bool m_ownData;
/// Current IDs
string m_curBitmapId;
string m_curWindowId;
string m_curLayoutId;
string m_curPopupId;
string m_curListId;
string m_curTreeId;
/// Current position of menu items in the popups
list<int> m_popupPosList;
/// Current offset of the controls
int m_xOffset, m_yOffset;
list<int> m_xOffsetList, m_yOffsetList;
/// Stack of panel ids
list<string> m_panelStack;
/// Layer of the current control in the layout
int m_curLayer;
/// Set of used id
set<string> m_idSet;
/// Callbacks
virtual void handleBeginElement( const string &rName,
AttrList_t &attr );
virtual void handleEndElement( const string &rName );
/// Callbacks
virtual void handleBeginElement( const string &rName,
AttrList_t &attr );
virtual void handleEndElement( const string &rName );
/// Helper functions
//@{
bool convertBoolean( const char *value ) const;
/// Transform to int, and check that it is in the given range (if not,
/// the closest range boundary will be used)
int convertInRange( const char *value, int minValue, int maxValue,
const string &rAttribute ) const;
//@}
/// Helper functions
//@{
bool convertBoolean( const char *value ) const;
/// Transform to int, and check that it is in the given range (if not,
/// the closest range boundary will be used)
int convertInRange( const char *value, int minValue, int maxValue,
const string &rAttribute ) const;
//@}
/// Generate a new id
const string generateId() const;
/// Generate a new id
const string generateId() const;
/// Check if the id is unique, and if not generate a new one
const string uniqueId( const string &id );
/// Check if the id is unique, and if not generate a new one
const string uniqueId( const string &id );
};
#endif
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef XMLPARSER_HPP
......@@ -36,41 +36,41 @@
/// XML parser using libxml2 text reader API
class XMLParser: public SkinObject
{
public:
XMLParser( intf_thread_t *pIntf, const string &rFileName,
bool useDTD = true );
virtual ~XMLParser();
public:
XMLParser( intf_thread_t *pIntf, const string &rFileName,
bool useDTD = true );
virtual ~XMLParser();
/// Parse the file. Returns true on success
bool parse();
/// Parse the file. Returns true on success
bool parse();
protected:
// Key comparison function for type "const char*"
struct ltstr
protected:
// Key comparison function for type "const char*"
struct ltstr
{
bool operator()(const char* s1, const char* s2) const
{
bool operator()(const char* s1, const char* s2) const
{
return strcmp(s1, s2) < 0;
}
};
/// Type for attribute lists
typedef map<const char*, const char*, ltstr> AttrList_t;
return strcmp(s1, s2) < 0;
}
};
/// Type for attribute lists
typedef map<const char*, const char*, ltstr> AttrList_t;
/// Flag for validation errors
bool m_errors;
/// Flag for validation errors
bool m_errors;
/// Callbacks
virtual void handleBeginElement( const string &rName,
AttrList_t &attr ) {}
virtual void handleEndElement( const string &rName ) {}
/// Callbacks
virtual void handleBeginElement( const string &rName,
AttrList_t &attr ) { }
virtual void handleEndElement( const string &rName ) { }
private:
void LoadCatalog();
private:
void LoadCatalog();
/// Reader context
xml_t *m_pXML;
xml_reader_t *m_pReader;
stream_t *m_pStream;
/// Reader context
xml_t *m_pXML;
xml_reader_t *m_pReader;
stream_t *m_pStream;
};
#endif
This diff is collapsed.
This diff is collapsed.
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef BITMAP_FONT_HPP
......@@ -33,39 +33,39 @@ class GenericBitmap;
/// Class to handle bitmap fonts
class BitmapFont: public GenericFont
{
public:
BitmapFont( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
const string &rType );
virtual ~BitmapFont() {}
public:
BitmapFont( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
const string &rType );
virtual ~BitmapFont() { }
virtual bool init() { return true; }
virtual bool init() { return true; }
/// Render a string on a bitmap.
/// If maxWidth != -1, the text is truncated with '...'
virtual GenericBitmap *drawString( const UString &rString,
uint32_t color, int maxWidth = -1 ) const;
/// Render a string on a bitmap.
/// If maxWidth != -1, the text is truncated with '...'
virtual GenericBitmap *drawString( const UString &rString,
uint32_t color, int maxWidth = -1 ) const;
/// Get the font size
virtual int getSize() const { return m_height; }
/// Get the font size
virtual int getSize() const { return m_height; }
private:
/// Description of a glyph
struct Glyph_t
{
Glyph_t(): m_xPos( -1 ), m_yPos( 0 ) {}
int m_xPos, m_yPos;
};
private:
/// Description of a glyph
struct Glyph_t
{
Glyph_t(): m_xPos( -1 ), m_yPos( 0 ) { }
int m_xPos, m_yPos;
};
/// Bitmap
const GenericBitmap &m_rBitmap;
/// Glyph size
int m_width, m_height;
/// Horizontal advance between two characters
int m_advance;
/// Horizontal advance for non-displayable characters
int m_skip;
/// Character table
Glyph_t m_table[256];
/// Bitmap
const GenericBitmap &m_rBitmap;
/// Glyph size
int m_width, m_height;
/// Horizontal advance between two characters
int m_advance;
/// Horizontal advance for non-displayable characters
int m_skip;
/// Character table
Glyph_t m_table[256];
};
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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