Commit 93cdb2f1 authored by Cyril Deguet's avatar Cyril Deguet

- all: skeleton for a MacOSX port of skins2 (happy new year ;)

parent 4aae8a68
......@@ -190,4 +190,19 @@ SOURCES_skins2 = \
x11/x11_window.hpp \
x11/x11_tooltip.cpp \
x11/x11_tooltip.hpp \
\
macosx/macosx_dragdrop.cpp \
macosx/macosx_dragdrop.hpp \
macosx/macosx_factory.cpp \
macosx/macosx_factory.hpp \
macosx/macosx_graphics.cpp \
macosx/macosx_graphics.hpp \
macosx/macosx_loop.cpp \
macosx/macosx_loop.hpp \
macosx/macosx_timer.cpp \
macosx/macosx_timer.hpp \
macosx/macosx_window.cpp \
macosx/macosx_window.hpp \
macosx/macosx_tooltip.cpp \
macosx/macosx_tooltip.hpp \
$(NULL)
/*****************************************************************************
* macosx_dragdrop.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifdef MACOSX_SKINS
#include "macosx_dragdrop.hpp"
MacOSXDragDrop::MacOSXDragDrop( intf_thread_t *pIntf, bool playOnDrop ):
SkinObject( pIntf ), m_playOnDrop( playOnDrop )
{
// TODO
}
#endif
/*****************************************************************************
* macosx_dragdrop.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef MACOSX_DRAGDROP_HPP
#define MACOSX_DRAGDROP_HPP
#include "../src/skin_common.hpp"
class MacOSXDragDrop: public SkinObject
{
public:
typedef long ldata_t[5];
MacOSXDragDrop( intf_thread_t *pIntf, bool playOnDrop );
virtual ~MacOSXDragDrop() {}
private:
/// Indicates whether the file(s) must be played immediately
bool m_playOnDrop;
};
#endif
/*****************************************************************************
* macosx_factory.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifdef MACOSX_SKINS
#include "macosx_factory.hpp"
#include "macosx_graphics.hpp"
#include "macosx_loop.hpp"
#include "macosx_timer.hpp"
#include "macosx_window.hpp"
#include "macosx_tooltip.hpp"
MacOSXFactory::MacOSXFactory( intf_thread_t *pIntf ): OSFactory( pIntf ),
m_dirSep( "/" )
{
// TODO
}
MacOSXFactory::~MacOSXFactory()
{
// TODO
}
bool MacOSXFactory::init()
{
// TODO
return true;
}
OSGraphics *MacOSXFactory::createOSGraphics( int width, int height )
{
return new MacOSXGraphics( getIntf(), width, height );
}
OSLoop *MacOSXFactory::getOSLoop()
{
return MacOSXLoop::instance( getIntf() );
}
void MacOSXFactory::destroyOSLoop()
{
MacOSXLoop::destroy( getIntf() );
}
void MacOSXFactory::minimize()
{
// TODO
}
OSTimer *MacOSXFactory::createOSTimer( const Callback &rCallback )
{
return new MacOSXTimer( getIntf(), rCallback );
}
OSWindow *MacOSXFactory::createOSWindow( GenericWindow &rWindow, bool dragDrop,
bool playOnDrop, OSWindow *pParent )
{
return new MacOSXWindow( getIntf(), rWindow, dragDrop,
playOnDrop, (MacOSXWindow*)pParent );
}
OSTooltip *MacOSXFactory::createOSTooltip()
{
return new MacOSXTooltip( getIntf() );
}
int MacOSXFactory::getScreenWidth() const
{
// TODO
return 0;
}
int MacOSXFactory::getScreenHeight() const
{
// TODO
return 0;
}
Rect MacOSXFactory::getWorkArea() const
{
// XXX
return Rect( 0, 0, getScreenWidth(), getScreenHeight() );
}
void MacOSXFactory::getMousePos( int &rXPos, int &rYPos ) const
{
// TODO
}
void MacOSXFactory::rmDir( const string &rPath )
{
// TODO
}
#endif
/*****************************************************************************
* macosx_factory.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef MACOSX_FACTORY_HPP
#define MACOSX_FACTORY_HPP
#include "../src/os_factory.hpp"
/// Class used to instanciate MacOSX specific objects
class MacOSXFactory: public OSFactory
{
public:
MacOSXFactory( intf_thread_t *pIntf );
virtual ~MacOSXFactory();
/// Initialization method
virtual bool init();
/// Instantiate an object OSGraphics.
virtual OSGraphics *createOSGraphics( int width, int height );
/// Get the instance of the singleton OSLoop.
virtual OSLoop *getOSLoop();
/// Destroy the instance of OSLoop.
virtual void destroyOSLoop();
/// Instantiate an OSTimer with the given callback
virtual OSTimer *createOSTimer( const Callback &rCallback );
///
virtual void minimize();
/// Instantiate an OSWindow object
virtual OSWindow *createOSWindow( GenericWindow &rWindow,
bool dragDrop, bool playOnDrop,
OSWindow *pParent );
/// Instantiate an object OSTooltip.
virtual OSTooltip *createOSTooltip();
/// 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 screen size
virtual int getScreenWidth() const;
virtual int getScreenHeight() const;
/// Get the work area (screen area without taskbars)
virtual Rect getWorkArea() 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*/ }
/// Delete a directory recursively
virtual void rmDir( const string &rPath );
private:
/// Directory separator
const string m_dirSep;
/// Resource path
list<string> m_resourcePath;
};
#endif
/*****************************************************************************
* macosx_graphics.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifdef MACOSX_SKINS
#include "macosx_graphics.hpp"
MacOSXGraphics::MacOSXGraphics( intf_thread_t *pIntf, int width, int height ):
OSGraphics( pIntf ), m_width( width ), m_height( height )
{
// TODO
}
MacOSXGraphics::~MacOSXGraphics()
{
// TODO
}
void MacOSXGraphics::clear()
{
// TODO
}
void MacOSXGraphics::drawGraphics( const OSGraphics &rGraphics, int xSrc,
int ySrc, int xDest, int yDest, int width,
int height )
{
// TODO
}
void MacOSXGraphics::drawBitmap( const GenericBitmap &rBitmap, int xSrc,
int ySrc, int xDest, int yDest, int width,
int height )
{
// TODO
}
void MacOSXGraphics::fillRect( int left, int top, int width, int height,
uint32_t color )
{
// TODO
}
void MacOSXGraphics::drawRect( int left, int top, int width, int height,
uint32_t color )
{
// TODO
}
void MacOSXGraphics::applyMaskToWindow( OSWindow &rWindow )
{
// TODO
}
void MacOSXGraphics::copyToWindow( OSWindow &rWindow, int xSrc, int ySrc,
int width, int height, int xDest, int yDest )
{
// TODO
}
bool MacOSXGraphics::hit( int x, int y ) const
{
// TODO
return false;
}
#endif
/*****************************************************************************
* macosx_graphics.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef MACOSX_GRAPHICS_HPP
#define MACOSX_GRAPHICS_HPP
#include "../src/os_graphics.hpp"
class GenericWindow;
class GenericBitmap;
/// MacOSX implementation of OSGraphics
class MacOSXGraphics: public OSGraphics
{
public:
MacOSXGraphics( intf_thread_t *pIntf, int width, int height);
virtual ~MacOSXGraphics();
/// 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 );
/// 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 );
/// 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 );
/// 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 );
/// 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; }
private:
/// Size of the image
int m_width, m_height;
};
#endif
/*****************************************************************************
* macosx_loop.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifdef MACOSX_SKINS
#include "macosx_loop.hpp"
MacOSXLoop::MacOSXLoop( intf_thread_t *pIntf ):
OSLoop( pIntf )
{
// TODO
}
MacOSXLoop::~MacOSXLoop()
{
// TODO
}
OSLoop *MacOSXLoop::instance( intf_thread_t *pIntf )
{
if( pIntf->p_sys->p_osLoop == NULL )
{
OSLoop *pOsLoop = new MacOSXLoop( pIntf );
pIntf->p_sys->p_osLoop = pOsLoop;
}
return pIntf->p_sys->p_osLoop;
}
void MacOSXLoop::destroy( intf_thread_t *pIntf )
{
if( pIntf->p_sys->p_osLoop )
{
delete pIntf->p_sys->p_osLoop;
pIntf->p_sys->p_osLoop = NULL;
}
}
void MacOSXLoop::run()
{
// TODO
}
void MacOSXLoop::exit()
{
// TODO
}
#endif
/*****************************************************************************
* MacOSX_loop.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef MACOSX_LOOP_HPP
#define MACOSX_LOOP_HPP
#include "../src/os_loop.hpp"
class MacOSXDisplay;
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 );
/// Destroy the instance of MacOSXLoop
static void destroy( intf_thread_t *pIntf );
/// Enter the event loop
virtual void run();
/// Exit the main loop
virtual void exit();
private:
// Private because it's a singleton
MacOSXLoop( intf_thread_t *pIntf );
virtual ~MacOSXLoop();
};
#endif
/*****************************************************************************
* macosx_timer.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifdef MACOSX_SKINS
#include "macosx_timer.hpp"
MacOSXTimer::MacOSXTimer( intf_thread_t *pIntf, const Callback &rCallback ):
OSTimer( pIntf ), m_callback( rCallback )
{
// TODO
}
MacOSXTimer::~MacOSXTimer()
{
// TODO
stop();
}
void MacOSXTimer::start( int delay, bool oneShot )
{
// TODO
}
void MacOSXTimer::stop()
{
// TODO
}
#endif
/*****************************************************************************
* macosx_timer.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef MACOSX_TIMER_HPP
#define MACOSX_TIMER_HPP
#include "../src/os_timer.hpp"
// Forward declaration
class MacOSXTimerLoop;
// MacOSX specific timer
class MacOSXTimer: public OSTimer
{
public:
MacOSXTimer( intf_thread_t *pIntf, const Callback &rCallback );
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 );