controls/ctrl_video.hpp \
\
events/evt_enter.hpp \
- events/evt_generic.hpp \
events/evt_focus.hpp \
+ events/evt_generic.hpp \
events/evt_input.cpp \
events/evt_input.hpp \
events/evt_key.cpp \
events/evt_key.hpp \
events/evt_leave.hpp \
+ events/evt_menu.hpp \
events/evt_motion.hpp \
events/evt_mouse.cpp \
events/evt_mouse.hpp \
src/os_factory.hpp \
src/os_graphics.hpp \
src/os_loop.hpp \
+ src/os_popup.hpp \
src/os_timer.hpp \
src/os_window.hpp \
src/os_tooltip.hpp \
+ src/popup.cpp \
+ src/popup.hpp \
src/scaled_bitmap.cpp \
src/scaled_bitmap.hpp \
src/skin_main.cpp \
win32/win32_graphics.hpp \
win32/win32_loop.cpp \
win32/win32_loop.hpp \
+ win32/win32_popup.cpp \
+ win32/win32_popup.hpp \
win32/win32_timer.cpp \
win32/win32_timer.hpp \
win32/win32_tooltip.cpp \
x11/x11_graphics.hpp \
x11/x11_loop.cpp \
x11/x11_loop.hpp \
+ x11/x11_popup.cpp \
+ x11/x11_popup.hpp \
x11/x11_timer.cpp \
x11/x11_timer.hpp \
x11/x11_window.cpp \
macosx/macosx_graphics.hpp \
macosx/macosx_loop.cpp \
macosx/macosx_loop.hpp \
+ macosx/macosx_popup.cpp \
+ macosx/macosx_popup.hpp \
macosx/macosx_timer.cpp \
macosx/macosx_timer.hpp \
macosx/macosx_window.cpp \
#define CMD_SHOW_WINDOW_HPP
#include "cmd_generic.hpp"
+#include "../src/os_factory.hpp"
#include "../src/top_window.hpp"
#include "../src/window_manager.hpp"
+#include "../src/popup.hpp"
/// Command to show a window
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;
+};
+
+
#endif
--- /dev/null
+/*****************************************************************************
+ * evt_menu.hpp
+ *****************************************************************************
+ * Copyright (C) 2003 the VideoLAN team
+ * $Id:$
+ *
+ * Authors: Olivier Teulière <ipkiss@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 EVT_MENU_HPP
+#define EVT_MENU_HPP
+
+#include "evt_generic.hpp"
+
+
+/// Mouse move event
+class EvtMenu: public EvtGeneric
+{
+ public:
+ EvtMenu( intf_thread_t *pIntf, int itemId ):
+ EvtGeneric( pIntf ), m_itemId( itemId ) {}
+ virtual ~EvtMenu() {}
+
+ /// Return the type of event
+ virtual const string getAsString() const { return "menu"; }
+
+ // Getter
+ int getItemId() const { return m_itemId; }
+
+ private:
+ /// Coordinates of the mouse (absolute or relative)
+ int m_itemId;
+};
+
+
+#endif
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
+ /**
+ * 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;
};
}
+OSPopup *MacOSXFactory::createOSPopup()
+{
+ return new MacOSXPopup( getIntf() );
+}
+
+
int MacOSXFactory::getScreenWidth() const
{
// TODO
/// Initialization method
virtual bool init();
- /// Instantiate an object OSGraphics.
+ /// Instantiate an object OSGraphics
virtual OSGraphics *createOSGraphics( int width, int height );
- /// Get the instance of the singleton OSLoop.
+ /// Get the instance of the singleton OSLoop
virtual OSLoop *getOSLoop();
- /// Destroy the instance of OSLoop.
+ /// Destroy the instance of OSLoop
virtual void destroyOSLoop();
/// Instantiate an OSTimer with the given callback
bool dragDrop, bool playOnDrop,
OSWindow *pParent );
- /// Instantiate an object OSTooltip.
+ /// Instantiate an object OSTooltip
virtual OSTooltip *createOSTooltip();
+ /// Instantiate an object OSPopup
+ virtual OSPopup *createOSPopup();
+
/// Get the directory separator
virtual const string &getDirSeparator() const { return m_dirSep; }
--- /dev/null
+/*****************************************************************************
+ * macosx_popup.cpp
+ *****************************************************************************
+ * Copyright (C) 2003 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Olivier Teulière <ipkiss@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_popup.hpp"
+
+
+MacOSXPopup::MacOSXPopup( intf_thread_t *pIntf )
+ : OSPopup( pIntf )
+{
+ // TODO
+}
+
+
+MacOSXPopup::~MacOSXPopup()
+{
+ // TODO
+}
+
+
+void MacOSXPopup::show( int xPos, int yPos )
+{
+ // TODO
+}
+
+
+void MacOSXPopup::hide()
+{
+ // TODO
+}
+
+
+void MacOSXPopup::addItem( const string &rLabel, int pos )
+{
+ // TODO
+}
+
+
+void MacOSXPopup::addSeparator( int pos )
+{
+ // TODO
+}
+
+
+int MacOSXPopup::getPosFromId( int id ) const
+{
+ // TODO
+}
+
+
+#endif
+
--- /dev/null
+/*****************************************************************************
+ * macosx_popup.hpp
+ *****************************************************************************
+ * Copyright (C) 2003 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Olivier Teulière <ipkiss@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_POPUP_HPP
+#define MACOSX_POPUP_HPP
+
+#include "../src/os_popup.hpp"
+
+
+/// MacOSX implementation of OSPopup
+class MacOSXPopup: public OSPopup
+{
+ public:
+ MacOSXPopup( intf_thread_t *pIntf );
+
+ virtual ~MacOSXPopup();
+
+ /// Show the popup menu at the given (absolute) corrdinates
+ virtual void show( int xPos, int yPos );
+
+ /// 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 );
+
+ /// 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;
+};
+
+
+#endif
virtual ~MacOSXTooltip();
- // Show the tooltip
+ /// Show the tooltip
virtual void show( int left, int top, OSGraphics &rText );
- // Hide the tooltip
+ /// Hide the tooltip
virtual void hide();
private:
#include "../src/anchor.hpp"
#include "../src/bitmap_font.hpp"
#include "../src/ft2_font.hpp"
+#include "../src/generic_layout.hpp"
+#include "../src/popup.hpp"
#include "../src/theme.hpp"
+#include "../commands/cmd_generic.hpp"
#include "../controls/ctrl_button.hpp"
#include "../controls/ctrl_checkbox.hpp"
#include "../controls/ctrl_image.hpp"
#include "../controls/ctrl_text.hpp"
#include "../controls/ctrl_tree.hpp"
#include "../controls/ctrl_video.hpp"
+#include "../utils/bezier.hpp"
#include "../utils/position.hpp"
#include "../utils/var_bool.hpp"
#include "../utils/var_text.hpp"
ADD_OBJECTS( BitmapFont );
ADD_OBJECTS( Font );
ADD_OBJECTS( Window );
+ // XXX: PopupMenus are created after the windows, so that the Win32Factory
+ // (at least) can give a valid window handle to the OSPopup objects
+ ADD_OBJECTS( PopupMenu );
ADD_OBJECTS( Layout );
ADD_OBJECTS( Anchor );
ADD_OBJECTS( Button );
ADD_OBJECTS( List );
ADD_OBJECTS( Tree );
ADD_OBJECTS( Video );
+ // MenuItems must be created after all the rest, so that the IDs of the
+ // other elements exist and can be parsed in the actions
+ ADD_OBJECTS( MenuItem );
+ ADD_OBJECTS( MenuSeparator );
return m_pTheme;
}
}
+void Builder::addPopupMenu( const BuilderData::PopupMenu &rData )
+{
+ Popup *pPopup = new Popup( getIntf(), m_pTheme->getWindowManager() );
+
+ m_pTheme->m_popups[rData.m_id] = PopupPtr( pPopup );
+}
+
+
+void Builder::addMenuItem( const BuilderData::MenuItem &rData )
+{
+ Popup *pPopup = m_pTheme->getPopupById( rData.m_popupId );
+ if( pPopup == NULL )
+ {
+ msg_Err( getIntf(), "Unknown popup id: %s", rData.m_popupId.c_str() );
+ return;
+ }
+
+ CmdGeneric *pCommand = parseAction( rData.m_action );
+ if( pCommand == NULL )
+ {
+ msg_Err( getIntf(), "Invalid action: %s", rData.m_action.c_str() );
+ return;
+ }
+
+ pPopup->addItem( rData.m_label, *pCommand, rData.m_pos );
+}
+
+
+void Builder::addMenuSeparator( const BuilderData::MenuSeparator &rData )
+{
+ Popup *pPopup = m_pTheme->getPopupById( rData.m_popupId );
+ if( pPopup == NULL )
+ {
+ msg_Err( getIntf(), "Unknown popup id: %s", rData.m_popupId.c_str() );
+ return;
+ }
+
+ pPopup->addSeparator( rData.m_pos );
+}
+
+
void Builder::addWindow( const BuilderData::Window &rData )
{
TopWindow *pWin =
void Builder::addLayout( const BuilderData::Layout &rData )
{
- TopWindow *pWin = m_pTheme->getWindowById(rData.m_windowId);
+ TopWindow *pWin = m_pTheme->getWindowById( rData.m_windowId );
if( pWin == NULL )
{
msg_Err( getIntf(), "unknown window id: %s", rData.m_windowId.c_str() );
void Builder::addAnchor( const BuilderData::Anchor &rData )
{
- GenericLayout *pLayout = m_pTheme->getLayoutById(rData.m_layoutId);
+ GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
if( pLayout == NULL )
{
msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
GenericBitmap *pBmpOver = pBmpUp;
GET_BMP( pBmpOver, rData.m_overId );
- GenericLayout *pLayout = m_pTheme->getLayoutById(rData.m_layoutId);
+ GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
if( pLayout == NULL )
{
msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
GenericBitmap *pBmpOver2 = pBmpUp2;
GET_BMP( pBmpOver2, rData.m_over2Id );
- GenericLayout *pLayout = m_pTheme->getLayoutById(rData.m_layoutId);
+ GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
if( pLayout == NULL )
{
msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
GenericBitmap *pBmp = NULL;
GET_BMP( pBmp, rData.m_bmpId );
- GenericLayout *pLayout = m_pTheme->getLayoutById(rData.m_layoutId);
+ GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
if( pLayout == NULL )
{
msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
return;
}
- TopWindow *pWindow = m_pTheme->getWindowById(rData.m_windowId);
+ TopWindow *pWindow = m_pTheme->getWindowById( rData.m_windowId );
if( pWindow == NULL )
{
msg_Err( getIntf(), "unknown window id: %s", rData.m_windowId.c_str() );
void Builder::addText( const BuilderData::Text &rData )
{
- GenericLayout *pLayout = m_pTheme->getLayoutById(rData.m_layoutId);
+ GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
if( pLayout == NULL )
{
msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
GenericBitmap *pSeq = NULL;
GET_BMP( pSeq, rData.m_sequence );
- GenericLayout *pLayout = m_pTheme->getLayoutById(rData.m_layoutId);
+ GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
if( pLayout == NULL )
{
msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
GET_BMP( pBgImage, rData.m_imageId );
}
- GenericLayout *pLayout = m_pTheme->getLayoutById(rData.m_layoutId);
+ GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
if( pLayout == NULL )
{
msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
GenericBitmap *pBgBmp = NULL;
GET_BMP( pBgBmp, rData.m_bgImageId );
- GenericLayout *pLayout = m_pTheme->getLayoutById(rData.m_layoutId);
+ GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
if( pLayout == NULL )
{
msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
GET_BMP( pOpenBmp, rData.m_openImageId );
GET_BMP( pClosedBmp, rData.m_closedImageId );
- GenericLayout *pLayout = m_pTheme->getLayoutById(rData.m_layoutId);
+ GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
if( pLayout == NULL )
{
msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
void Builder::addVideo( const BuilderData::Video &rData )
{
- GenericLayout *pLayout = m_pTheme->getLayoutById(rData.m_layoutId);
+ GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
if( pLayout == NULL )
{
msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
#define BUILDER_HPP
#include "builder_data.hpp"
-#include "../src/os_graphics.hpp"
-#include "../src/generic_window.hpp"
-#include "../src/generic_layout.hpp"
-#include "../src/generic_bitmap.hpp"
-#include "../src/generic_font.hpp"
-#include "../commands/cmd_generic.hpp"
-#include "../controls/ctrl_generic.hpp"
-#include "../utils/bezier.hpp"
+#include "../src/skin_common.hpp"
#include <string>
#include <list>
#include <map>
class Theme;
+class Bezier;
+class CmdGeneric;
+class GenericFont;
+class Position;
+class Box;
/// Class for skin construction
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 addTree( const BuilderData::Tree &rData );
void addVideo( const BuilderData::Video &rData );
- /// Compute the position of a control
+ /// Compute the position of a control
const Position makePosition( const string &rLeftTop,
const string &rRightBottom,
int xPos, int yPos, int width, int height,
SubBitmap id:string parent:string x:int y:int width:int height:int nbFrames:int fps:int
BitmapFont id:string file:string type:string
Font id:string fontFile:string size:int
+PopupMenu id:string
+MenuItem label:string action:string pos:int popupId:string
+MenuSeparator pos:int popupId:string
Window id:string xPos:int yPos:int visible:bool dragDrop:bool playOnDrop:bool
Layout id:string width:int height:int minWidth:int maxWidth:int minHeight:int maxHeight:int windowId:string
Anchor xPos:int yPos:int range:int priority:int points:string layoutId:string
/// List
list<Font> m_listFont;
+ /// Type definition
+ struct PopupMenu
+ {
+ PopupMenu( const string & id ):
+m_id( id ) {}
+
+ string m_id;
+ };
+ /// List
+ list<PopupMenu> m_listPopupMenu;
+
+ /// Type definition
+ struct MenuItem
+ {
+ MenuItem( const string & label, const string & action, int pos, const string & popupId ):
+m_label( label ), m_action( action ), m_pos( pos ), m_popupId( popupId ) {}
+
+ string m_label;
+ string m_action;
+ int m_pos;
+ string m_popupId;
+ };
+ /// List
+ list<MenuItem> m_listMenuItem;
+
+ /// Type definition
+ struct MenuSeparator
+ {
+ MenuSeparator( int pos, const string & popupId ):
+m_pos( pos ), m_popupId( popupId ) {}
+
+ int m_pos;
+ string m_popupId;
+ };
+ /// List
+ list<MenuSeparator> m_listMenuSeparator;
+
/// Type definition
struct Window
{
}
else
{
- msg_Err( getIntf(), "Unknown window (%s)", windowId.c_str() );
+ // It was maybe the id of a popup
+ Popup *pPopup = pTheme->getPopupById( windowId );
+ if( pPopup )
+ {
+ pCommand = new CmdShowPopup( getIntf(), *pPopup );
+ }
+ else
+ {
+ msg_Err( getIntf(), "Unknown window or popup (%s)",
+ windowId.c_str() );
+ }
}
}
else if( rAction.find( ".hide()" ) != string::npos )
m_pData->m_listBitmapFont.push_back( font );
}
+ else if( rName == "PopupMenu" )
+ {
+ RequireDefault( "id" );
+
+ m_popupPosList.push_back(0);
+ m_curPopupId = uniqueId( attr["id"] );
+ const BuilderData::PopupMenu popup( m_curPopupId );
+ m_pData->m_listPopupMenu.push_back( popup );
+ }
+
+ else if( rName == "MenuItem" )
+ {
+ RequireDefault( "label" );
+ CheckDefault( "action", "none" );
+
+ const BuilderData::MenuItem item( attr["label"], attr["action"],
+ m_popupPosList.back(),
+ m_curPopupId );
+ m_pData->m_listMenuItem.push_back( item );
+ m_popupPosList.back()++;
+ }
+
+ else if( rName == "MenuSeparator" )
+ {
+ const BuilderData::MenuSeparator sep( m_popupPosList.back(),
+ m_curPopupId );
+ m_pData->m_listMenuSeparator.push_back( sep );
+ m_popupPosList.back()++;
+ }
+
else if( rName == "Button" )
{
RequireDefault( "up" );
{
m_curTreeId = "";
}
+ else if( rName == "Popup" )
+ {
+ m_curPopupId = "";
+ m_popupPosList.pop_back();
+ }
}
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;
SkinObject( pIntf ), m_left( left ), m_top( top ), m_width( 0 ),
m_height( 0 ), m_varVisible( pIntf )
{
- // Get the OSFactory
+ // Get the OSFactory
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
// Get the parent OSWindow, if any
class EvtGeneric;
class EvtFocus;
class EvtLeave;
+class EvtMenu;
class EvtMotion;
class EvtMouse;
class EvtKey;
/// Methods to process OS events.
virtual void processEvent( EvtFocus &rEvtFocus ) {}
+ virtual void processEvent( EvtMenu &rEvtMenu ) {}
virtual void processEvent( EvtMotion &rEvtMotion ) {}
virtual void processEvent( EvtMouse &rEvtMouse ) {}
virtual void processEvent( EvtLeave &rEvtLeave ) {}
class OSLoop;
class OSWindow;
class OSTooltip;
+class OSPopup;
class OSTimer;
kResizeNESW
};
- /// Initialization method overloaded in derived classes.
- /// It must return false if the init failed.
+ /**
+ * Initialization method overloaded in derived classes.
+ * It must return false if the init failed.
+ */
virtual bool init() { return true; }
- /// Get the right instance of OSFactory.
- /// Returns NULL if initialization of the concrete factory failed.
+ /**
+ * Get the right instance of OSFactory.
+ * Returns NULL if initialization of the concrete factory failed.
+ */
static OSFactory *instance( intf_thread_t *pIntf );
- /// Delete the instance of OSFactory.
+ /// Delete the instance of OSFactory
static void destroy( intf_thread_t *pIntf );
- /// Instantiate an object OSGraphics.
+ /// Instantiate an object OSGraphics
virtual OSGraphics *createOSGraphics( int width, int height ) = 0;
- /// Get the instance of the singleton OSLoop.
+ /// Get the instance of the singleton OSLoop
virtual OSLoop *getOSLoop() = 0;
- /// Destroy the instance of OSLoop.
+ /// Destroy the instance of OSLoop
virtual void destroyOSLoop() = 0;
///
/// Instantiate an OSTimer with the given command
virtual OSTimer *createOSTimer( CmdGeneric &rCmd ) = 0;
- /// Instantiate an object OSWindow.
+ /// Instantiate an object OSWindow
virtual OSWindow *createOSWindow( GenericWindow &rWindow,
bool dragDrop, bool playOnDrop,
OSWindow *pParent ) = 0;
- /// Instantiate an object OSTooltip.
+ /// Instantiate an object OSTooltip
virtual OSTooltip *createOSTooltip() = 0;
+ /// Instantiate an object OSPopup
+ virtual OSPopup *createOSPopup() = 0;
+
/// Get the directory separator
virtual const string &getDirSeparator() const = 0;
virtual void rmDir( const string &rPath ) = 0;
protected:
- // Protected because it's a singleton.
+ // Protected because it's a singleton
OSFactory( intf_thread_t* pIntf ): SkinObject( pIntf ) {}
virtual ~OSFactory() {}
};
--- /dev/null
+/*****************************************************************************
+ * os_popup.hpp
+ *****************************************************************************
+ * Copyright (C) 2003 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Cyril Deguet <asmax@via.ecp.fr>
+ * Olivier Teulière <ipkiss@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 OS_POPUP_HPP
+#define OS_POPUP_HPP
+
+#include "skin_common.hpp"
+#include <string>
+
+class OSGraphics;
+
+
+/// Base class for OS specific Popup Windows
+class OSPopup: public SkinObject
+{
+ public:
+ virtual ~OSPopup() {}
+
+ /// Show the popup menu at the given (absolute) corrdinates
+ virtual void show( int xPos, int yPos ) = 0;
+
+ /// Hide the popup menu
+ virtual void hide() = 0;
+
+ /// Append a new menu item with the given label to the popup menu
+ virtual void addItem( const string &rLabel, int pos ) = 0;
+
+ /// Create a dummy menu item to separate sections
+ virtual void addSeparator( int pos ) = 0;
+
+ /// Return the position of the item identified by the given id
+ virtual int getPosFromId( int id ) const = 0;
+
+ protected:
+ OSPopup( intf_thread_t *pIntf ): SkinObject( pIntf ) {}
+};
+
+#endif
public:
virtual ~OSTooltip() {}
- // Show the tooltip
+ /// Show the tooltip
virtual void show( int left, int top, OSGraphics &rText ) = 0;
- // Hide the tooltip
+ /// Hide the tooltip
virtual void hide() = 0;
protected:
--- /dev/null
+/*****************************************************************************
+ * popup.cpp
+ *****************************************************************************
+ * Copyright (C) 2003 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Olivier Teulière <ipkiss@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.
+ *****************************************************************************/
+
+#include "popup.hpp"
+#include "os_factory.hpp"
+#include "os_popup.hpp"
+#include "window_manager.hpp"
+#include "../commands/cmd_generic.hpp"
+#include "../events/evt_menu.hpp"
+
+
+Popup::Popup( intf_thread_t *pIntf, WindowManager &rWindowManager )
+ : SkinObject( pIntf ), m_rWindowManager( rWindowManager )
+{
+ // Get the OSFactory
+ OSFactory *pOsFactory = OSFactory::instance( getIntf() );
+
+ // Create an OSPopup to handle OS specific processing
+ m_pOsPopup = pOsFactory->createOSPopup();
+}
+
+
+void Popup::show( int xPos, int yPos )
+{
+ // Notify that we are the active popup menu, so that the window which
+ // receives our menu events knows whom to forward them
+ m_rWindowManager.setActivePopup( *this );
+
+ m_pOsPopup->show( xPos, yPos );
+}
+
+
+void Popup::hide()
+{
+ m_pOsPopup->hide();
+}
+
+
+void Popup::addItem( const string &rLabel, CmdGeneric &rCmd, int pos )
+{
+ m_pOsPopup->addItem( rLabel, pos );
+ m_actions[pos] = &rCmd;
+}
+
+
+void Popup::addSeparator( int pos )
+{
+ m_pOsPopup->addSeparator( pos );
+ m_actions[pos] = NULL;
+}
+
+
+void Popup::handleEvent( const EvtMenu &rEvent )
+{
+ unsigned int n = m_pOsPopup->getPosFromId( rEvent.getItemId() );
+ if( n >= 0 && n < m_actions.size() && m_actions[n] )
+ {
+ m_actions[n]->execute();
+ }
+ else
+ {
+ // Should never happen
+ msg_Warn( getIntf(), "Problem in the popup implementation" );
+ }
+}
+
--- /dev/null
+/*****************************************************************************
+ * popup.hpp
+ *****************************************************************************
+ * Copyright (C) 2003 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Olivier Teulière <ipkiss@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 POPUP_HPP
+#define POPUP_HPP
+
+#include "skin_common.hpp"
+#include "../utils/pointer.hpp"
+#include <string>
+#include <map>
+
+class OSPopup;
+class TopWindow;
+class CmdGeneric;
+class WindowManager;
+class EvtMenu;
+
+
+/// Class handling a popup menu
+class Popup: public SkinObject
+{
+ public:
+ Popup( intf_thread_t *pIntf, WindowManager &rWindowManager );
+ virtual ~Popup() {}
+
+ void show( int xPos, int yPos );
+ void hide();
+
+ // XXX: it would be nice to use a UString here, if X11 supports it for
+ // its menu items (Windows doesn't, unfortunately)
+ /// Insert a new menu item to the popup menu, at the position pos
+ void addItem( const string &rLabel, CmdGeneric &rCmd, int pos );
+
+ /// Create a dummy menu item to separate sections
+ void addSeparator( int pos );
+
+ /// Execute the action corresponding to the chosen menu item
+ void handleEvent( const EvtMenu &rEvent );
+
+ private:
+ /// OS specific implementation
+ OSPopup *m_pOsPopup;
+
+ /// Window manager
+ WindowManager &m_rWindowManager;
+
+ /// Actions for the menu items, indexed by the position in the menu
+ map<int, CmdGeneric *> m_actions;
+};
+
+typedef CountedPtr<Popup> PopupPtr;
+
+
+#endif
FIND_FIRST_OBJECT( GenericFontPtr, m_fonts );
}
+Popup *Theme::getPopupById( const string &id )
+{
+ FIND_OBJECT( PopupPtr, m_popups );
+}
+
TopWindow *Theme::getWindowById( const string &id )
{
FIND_OBJECT( TopWindowPtr, m_windows );
#ifndef THEME_HPP
#define THEME_HPP
-#include "../src/generic_bitmap.hpp"
-#include "../src/generic_font.hpp"
-#include "../src/generic_layout.hpp"
+#include "generic_bitmap.hpp"
+#include "generic_font.hpp"
+#include "generic_layout.hpp"
+#include "popup.hpp"
#include "../src/window_manager.hpp"
#include "../commands/cmd_generic.hpp"
#include "../utils/bezier.hpp"
GenericBitmap *getBitmapById( const string &id );
GenericFont *getFontById( const string &id );
+ Popup *getPopupById( const string &id );
TopWindow *getWindowById( const string &id );
GenericLayout *getLayoutById( const string &id );
CtrlGeneric *getControlById( const string &id );
map<string, GenericBitmapPtr> m_bitmaps;
/// Store the fonts by ID
map<string, GenericFontPtr> m_fonts;
+ /// Store the popups by ID
+ map<string, PopupPtr> m_popups;
/// Store the windows by ID
map<string, TopWindowPtr> m_windows;
/// Store the layouts by ID
#include "../events/evt_enter.hpp"
#include "../events/evt_focus.hpp"
#include "../events/evt_leave.hpp"
+#include "../events/evt_menu.hpp"
#include "../events/evt_motion.hpp"
#include "../events/evt_mouse.hpp"
#include "../events/evt_key.hpp"
void TopWindow::processEvent( EvtFocus &rEvtFocus )
{
-// fprintf(stderr, rEvtFocus.getAsString().c_str()) ;
+// fprintf(stderr, rEvtFocus.getAsString().c_str());
+}
+
+
+void TopWindow::processEvent( EvtMenu &rEvtMenu )
+{
+ Popup *pPopup = m_rWindowManager.getActivePopup();
+ // We should never receive a menu event when there is no active popup!
+ if( pPopup == NULL )
+ {
+ msg_Warn( getIntf(), "Unexpected menu event, ignoring" );
+ return;
+ }
+
+ pPopup->handleEvent( rEvtMenu );
}
/// Methods to process OS events.
virtual void processEvent( EvtRefresh &rEvtRefresh );
virtual void processEvent( EvtFocus &rEvtFocus );
+ virtual void processEvent( EvtMenu &rEvtMenu );
virtual void processEvent( EvtMotion &rEvtMotion );
virtual void processEvent( EvtMouse &rEvtMouse );
virtual void processEvent( EvtLeave &rEvtLeave );
WindowManager::WindowManager( intf_thread_t *pIntf ):
- SkinObject( pIntf ), m_magnet( 0 ), m_pTooltip( NULL )
+ SkinObject( pIntf ), m_magnet( 0 ), m_pTooltip( NULL ), m_pPopup( NULL )
{
// Create and register a variable for the "on top" status
VarManager *pVarManager = VarManager::instance( getIntf() );
class GenericLayout;
class Anchor;
class Tooltip;
+class Popup;
/// Window manager for skin windows
/// Change the active layout of the given window
void setActiveLayout( TopWindow &rWindow, GenericLayout &rLayout );
+ /// Mark the given popup as active
+ void setActivePopup( Popup &rPopup ) { m_pPopup = &rPopup; }
+
+ /// Return the active popup, or NULL if none is active
+ Popup * getActivePopup() const { return m_pPopup; }
+
private:
/// Some useful typedefs for lazy people like me
typedef set<TopWindow*> WinSet_t;
typedef list<Anchor*> AncList_t;
- /// This map represents the graph of anchored windows: it associates
- /// to a given window all the windows that are directly anchored by it.
- /// This is not transitive, i.e. if a is in m_dep[b] and if b is in
- /// m_dep[c], it doesn't mean that a is in m_dep[c] (in fact, it
- /// would be extremely rare...)
+ /// Dependencies map
+ /**
+ * This map represents the graph of anchored windows: it associates
+ * to a given window all the windows that are directly anchored by it.
+ * This is not transitive, i.e. if a is in m_dep[b] and if b is in
+ * m_dep[c], it doesn't mean that a is in m_dep[c] (in fact, it
+ * would be extremely rare...)
+ */
map<TopWindow*, WinSet_t> m_dependencies;
/// Store all the windows
WinSet_t m_allWindows;
int m_moveAlpha;
/// Tooltip
Tooltip *m_pTooltip;
+ /// Active popup, if any
+ Popup *m_pPopup;
/// Recursively build a set of windows anchored to the one given.
void buildDependSet( WinSet_t &rWinSet, TopWindow *pWindow );
- /// Check anchoring: this function updates xOffset and yOffset,
- /// to take care of a new anchoring (if any)
+ /// Check anchoring
+ /**
+ * This function updates xOffset and yOffset, to take care of a new
+ * anchoring (if any)
+ */
void checkAnchors( TopWindow *pWindow,
int &xOffset, int &yOffset ) const;
};
#include "win32_timer.hpp"
#include "win32_window.hpp"
#include "win32_tooltip.hpp"
+#include "win32_popup.hpp"
#include "win32_loop.hpp"
#include "../src/theme.hpp"
}
+OSPopup *Win32Factory::createOSPopup()
+{
+ // XXX FIXME: this way of getting the handle really sucks!
+ // In fact, the clean way would be to have in Builder::addPopup() a call
+ // to pPopup->associateToWindow() (to be written)... but the problem is
+ // that there is no way to access the OS-dependent window handle from a
+ // GenericWindow (we cannot eevn access the OSWindow).
+ if( m_windowMap.begin() == m_windowMap.end() )
+ {
+ msg_Err( getIntf(), "No window has been created before the popup!" );
+ return NULL;
+ }
+
+ return new Win32Popup( getIntf(), m_windowMap.begin()->first );
+}
+
+
int Win32Factory::getScreenWidth() const
{
return GetSystemMetrics(SM_CXSCREEN);
/// Initialization method
virtual bool init();
- /// Instantiate an object OSGraphics.
+ /// Instantiate an object OSGraphics
virtual OSGraphics *createOSGraphics( int width, int height );
- /// Get the instance of the singleton OSLoop.
+ /// Get the instance of the singleton OSLoop
virtual OSLoop *getOSLoop();
- /// Destroy the instance of OSLoop.
+ /// Destroy the instance of OSLoop
virtual void destroyOSLoop();
///
bool dragDrop, bool playOnDrop,
OSWindow *pParent );
- /// Instantiate an object OSTooltip.
+ /// Instantiate an object OSTooltip
virtual OSTooltip *createOSTooltip();
+ /// Instantiate an object OSPopup
+ virtual OSPopup *createOSPopup();
+
/// Get the directory separator
virtual const string &getDirSeparator() const { return m_dirSep; }
#include "../src/generic_window.hpp"
#include "../events/evt_key.hpp"
#include "../events/evt_leave.hpp"
+#include "../events/evt_menu.hpp"
#include "../events/evt_motion.hpp"
#include "../events/evt_mouse.hpp"
#include "../events/evt_refresh.hpp"
win.processEvent( evt );
break;
}
+ case WM_COMMAND:
+ {
+ EvtMenu evt( getIntf(), LOWORD( msg.wParam ) );
+ win.processEvent( evt );
+ break;
+ }
case WM_MOUSEMOVE:
{
// Needed to generate WM_MOUSELEAVE events
--- /dev/null
+/*****************************************************************************
+ * win32_popup.cpp
+ *****************************************************************************
+ * Copyright (C) 2003 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Olivier Teulière <ipkiss@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 WIN32_SKINS
+
+#include "win32_popup.hpp"
+#include "win32_factory.hpp"
+
+#ifndef TPM_NOANIMATION
+const UINT TPM_NOANIMATION = 0x4000L;
+#endif
+
+
+Win32Popup::Win32Popup( intf_thread_t *pIntf, HWND hAssociatedWindow )
+ : OSPopup( pIntf ), m_hWnd( hAssociatedWindow )
+{
+ // Create the popup menu
+ m_hMenu = CreatePopupMenu();
+
+ if( !m_hMenu )
+ {
+ msg_Err( getIntf(), "CreatePopupMenu failed" );
+ return;
+ }
+}
+
+
+Win32Popup::~Win32Popup()
+{
+ if( m_hMenu )
+ DestroyMenu( m_hMenu );
+}
+
+
+void Win32Popup::show( int xPos, int yPos )
+{
+ TrackPopupMenuEx( m_hMenu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON
+ | TPM_HORIZONTAL | TPM_NOANIMATION,
+ xPos, yPos, m_hWnd, NULL );
+}
+
+
+void Win32Popup::hide()
+{
+ SendMessage( m_hWnd, WM_CANCELMODE, 0, 0 );
+}
+
+
+void Win32Popup::addItem( const string &rLabel, int pos )
+{
+ MENUITEMINFO menuItem;
+ menuItem.cbSize = sizeof( MENUITEMINFO );
+// menuItem.fMask = MIIM_FTYPE | MIIM_ID | MIIM_TYPE | MIIM_STRING;
+// menuItem.fType = MFT_STRING;
+ menuItem.fMask = MIIM_ID | MIIM_STRING;
+ menuItem.wID = pos;
+ menuItem.dwTypeData = (char*)rLabel.c_str();
+ menuItem.cch = rLabel.size();
+
+ InsertMenuItem( m_hMenu, findInsertionPoint( pos ), TRUE, &menuItem );
+}
+
+
+void Win32Popup::addSeparator( int pos )
+{
+ MENUITEMINFO sepItem;
+ sepItem.cbSize = sizeof( MENUITEMINFO );
+ sepItem.fMask = MIIM_FTYPE;
+ sepItem.fType = MFT_SEPARATOR;
+
+ InsertMenuItem( m_hMenu, findInsertionPoint( pos ), TRUE, &sepItem );
+}
+
+
+unsigned int Win32Popup::findInsertionPoint( unsigned int pos ) const
+{
+ // For this simple algorithm, we rely on the fact that in the final state
+ // of the menu, the ID of each item is equal to its position in the menu
+ int i = 0;
+ while( i < GetMenuItemCount( m_hMenu ) &&
+ GetMenuItemID( m_hMenu, i ) < pos )
+ {
+ i++;
+ }
+ return i;
+}
+
+
+#endif
+
--- /dev/null
+/*****************************************************************************
+ * win32_popup.hpp
+ *****************************************************************************
+ * Copyright (C) 2003 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Olivier Teulière <ipkiss@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 WIN32_POPUP_HPP
+#define WIN32_POPUP_HPP
+
+#include "../src/os_popup.hpp"
+#include <windows.h>
+
+
+/// Win32 implementation of OSPopup
+class Win32Popup: public OSPopup
+{
+ public:
+ Win32Popup( intf_thread_t *pIntf, HWND hAssociatedWindow );
+
+ virtual ~Win32Popup();
+
+ /// Show the popup menu at the given (absolute) corrdinates
+ virtual void show( int xPos, int yPos );
+
+ /// 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 );
+
+ /// 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 id; }
+
+ private:
+ /// Menu handle
+ HMENU m_hMenu;
+ /// Handle of the window which will receive the menu events
+ HWND m_hWnd;
+
+ /**
+ * Find the item before which to insert another item so that the
+ * newly added item is at the position pos _when the whole menu has
+ * been built_ (no assumption is made for the order of insertion of the
+ * items)
+ */
+ unsigned int findInsertionPoint( unsigned int pos ) const;
+};
+
+
+#endif
virtual ~Win32Tooltip();
- // Show the tooltip
+ /// Show the tooltip
virtual void show( int left, int top, OSGraphics &rText );
- // Hide the tooltip
+ /// Hide the tooltip
virtual void hide();
private:
}
+OSPopup *X11Factory::createOSPopup()
+{
+ return new X11Popup( getIntf(), *m_pDisplay );
+}
+
+
int X11Factory::getScreenWidth() const
{
Display *pDisplay = m_pDisplay->getDisplay();
/// Initialization method
virtual bool init();
- /// Instantiate an object OSGraphics.
+ /// Instantiate an object OSGraphics
virtual OSGraphics *createOSGraphics( int width, int height );
- /// Get the instance of the singleton OSLoop.
+ /// Get the instance of the singleton OSLoop
virtual OSLoop *getOSLoop();
- /// Destroy the instance of OSLoop.
+ /// Destroy the instance of OSLoop
virtual void destroyOSLoop();
/// Instantiate an OSTimer with the given command
bool dragDrop, bool playOnDrop,
OSWindow *pParent );
- /// Instantiate an object OSTooltip.
+ /// Instantiate an object OSTooltip
virtual OSTooltip *createOSTooltip();
+ /// Instantiate an object OSPopup
+ virtual OSPopup *createOSPopup();
+
/// Get the directory separator
virtual const string &getDirSeparator() const { return m_dirSep; }
--- /dev/null
+/*****************************************************************************
+ * x11_popup.cpp
+ *****************************************************************************
+ * Copyright (C) 2003 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Olivier Teulière <ipkiss@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 X11_SKINS
+
+#include "x11_popup.hpp"
+
+
+X11Popup::X11Popup( intf_thread_t *pIntf )
+ : OSPopup( pIntf )
+{
+ // TODO
+}
+
+
+X11Popup::~X11Popup()
+{
+ // TODO
+}
+
+
+void X11Popup::show( int xPos, int yPos )
+{
+ // TODO
+}
+
+
+void X11Popup::hide()
+{
+ // TODO
+}
+
+
+void X11Popup::addItem( const string &rLabel, int pos )
+{
+ // TODO
+}
+
+
+void X11Popup::addSeparator( int pos )
+{
+ // TODO
+}
+
+
+int X11Popup::getPosFromId( int id ) const
+{
+ // TODO
+}
+
+
+#endif
+
--- /dev/null
+/*****************************************************************************
+ * x11_popup.hpp
+ *****************************************************************************
+ * Copyright (C) 2003 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Olivier Teulière <ipkiss@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 X11_POPUP_HPP
+#define X11_POPUP_HPP
+
+#include "../src/os_popup.hpp"
+
+
+/// X11 implementation of OSPopup
+class X11Popup: public OSPopup
+{
+ public:
+ X11Popup( intf_thread_t *pIntf );
+
+ virtual ~X11Popup();
+
+ /// Show the popup menu at the given (absolute) corrdinates
+ virtual void show( int xPos, int yPos );
+
+ /// 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 );
+
+ /// 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;
+};
+
+
+#endif
virtual ~X11Tooltip();
- // Show the tooltip
+ /// Show the tooltip
virtual void show( int left, int top, OSGraphics &rText );
- // Hide the tooltip
+ /// Hide the tooltip
virtual void hide();
private:
-->
-<!ELEMENT Theme (ThemeInfo,(Include|Bitmap|BitmapFont|Font|Window)*)>
+<!ELEMENT Theme (ThemeInfo,(Include|Bitmap|BitmapFont|Font|PopupMenu|Window)*)>
<!ATTLIST Theme
version CDATA #REQUIRED
tooltipfont CDATA "defaultfont"
file CDATA #REQUIRED
type CDATA "digits"
>
+<!ELEMENT PopupMenu (MenuItem|MenuSeparator)+>
+ <!ATTLIST PopupMenu
+ id CDATA #REQUIRED
+ >
+<!ELEMENT MenuItem EMPTY>
+ <!ATTLIST MenuItem
+ label CDATA #REQUIRED
+ action CDATA "none"
+ >
+<!ELEMENT MenuSeparator EMPTY>
<!ELEMENT ThemeInfo EMPTY>
<!ATTLIST ThemeInfo
name CDATA #IMPLIED