summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svtools/inc/svtools/toolpanel/toolpaneldeck.hxx14
-rw-r--r--svtools/source/toolpanel/paneldecklisteners.cxx16
-rw-r--r--svtools/source/toolpanel/paneldecklisteners.hxx3
-rw-r--r--svtools/source/toolpanel/paneltabbar.cxx14
-rw-r--r--svtools/source/toolpanel/toolpanelcollection.cxx45
-rw-r--r--svtools/source/toolpanel/toolpanelcollection.hxx1
-rw-r--r--svtools/source/toolpanel/toolpaneldeck.cxx29
-rw-r--r--svtools/workben/toolpanel/toolpaneltest.cxx202
8 files changed, 287 insertions, 37 deletions
diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx
index 7119941914b2..eb83fbefef10 100644
--- a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx
+++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx
@@ -53,9 +53,13 @@ namespace svt
*/
virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0;
+ /** called when a panel has been removed from the deck
+ */
+ virtual void PanelRemoved( const size_t i_nPosition ) = 0;
+
/** called when the active panel of the deck changed
*/
- virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ) = 0;
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) = 0;
/** called when the tool panel deck which the listener registered at is dying. The listener is required to
release all references to the deck then.
@@ -78,8 +82,7 @@ namespace svt
*/
virtual PToolPanel GetPanel( const size_t i_nPos ) const = 0;
- /** returns the number of the currently active panel. If the deck does not currently contain any panel,
- the behavior is undefined.
+ /** returns the number of the currently active panel.
*/
virtual ::boost::optional< size_t >
GetActivePanel() const;
@@ -95,6 +98,10 @@ namespace svt
*/
virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0;
+ /** removes a panel specified by its position.
+ */
+ virtual void RemovePanel( const size_t i_nPosition ) = 0;
+
/** adds a new listener to be notified when the container content changes. The caller is responsible
for life time control, i.e. removing the listener before it actually dies.
*/
@@ -126,6 +133,7 @@ namespace svt
GetActivePanel() const;
virtual void ActivatePanel( const size_t i_nPanel );
virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual void RemovePanel( const size_t i_nPosition );
virtual void AddListener( IToolPanelDeckListener& i_rListener );
virtual void RemoveListener( IToolPanelDeckListener& i_rListener );
diff --git a/svtools/source/toolpanel/paneldecklisteners.cxx b/svtools/source/toolpanel/paneldecklisteners.cxx
index 766b3a63428d..26a025f7181f 100644
--- a/svtools/source/toolpanel/paneldecklisteners.cxx
+++ b/svtools/source/toolpanel/paneldecklisteners.cxx
@@ -60,14 +60,26 @@ namespace svt
}
//--------------------------------------------------------------------
- void PanelDeckListeners::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive )
+ void PanelDeckListeners::PanelRemoved( const size_t i_nPosition )
{
for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = m_aListeners.begin();
loop != m_aListeners.end();
++loop
)
{
- (*loop)->ActivePanelChanged( i_rOldActive, i_nNewActive );
+ (*loop)->PanelRemoved( i_nPosition );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void PanelDeckListeners::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+ {
+ for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = m_aListeners.begin();
+ loop != m_aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->ActivePanelChanged( i_rOldActive, i_rNewActive );
}
}
diff --git a/svtools/source/toolpanel/paneldecklisteners.hxx b/svtools/source/toolpanel/paneldecklisteners.hxx
index 56445e892a65..d3178d385e20 100644
--- a/svtools/source/toolpanel/paneldecklisteners.hxx
+++ b/svtools/source/toolpanel/paneldecklisteners.hxx
@@ -52,7 +52,8 @@ namespace svt
// IToolPanelDeckListener equivalents, forward the events to all registered listeners
void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition );
- void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive );
+ void PanelRemoved( const size_t i_nPosition );
+ void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
void Dying();
// listener maintainance
diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx
index 5602d83fdb88..75873f9c6411 100644
--- a/svtools/source/toolpanel/paneltabbar.cxx
+++ b/svtools/source/toolpanel/paneltabbar.cxx
@@ -626,7 +626,14 @@ namespace svt
rTabBar.Invalidate();
}
- virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive );
+ virtual void PanelRemoved( const size_t i_nPosition )
+ {
+ (void)i_nPosition;
+ bItemsDirty = true;
+ rTabBar.Invalidate();
+ }
+
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
virtual void Dying();
public:
@@ -845,13 +852,14 @@ namespace svt
//= PanelTabBar_Data
//==================================================================================================================
//------------------------------------------------------------------------------------------------------------------
- void PanelTabBar_Data::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive )
+ void PanelTabBar_Data::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
{
lcl_ensureItemsCache( *this );
if ( !!i_rOldActive )
lcl_drawItem( *this, *i_rOldActive );
- lcl_drawItem( *this, i_nNewActive );
+ if ( !!i_rNewActive )
+ lcl_drawItem( *this, *i_rNewActive );
}
//------------------------------------------------------------------------------------------------------------------
diff --git a/svtools/source/toolpanel/toolpanelcollection.cxx b/svtools/source/toolpanel/toolpanelcollection.cxx
index 35742f66016c..c92241d34b7c 100644
--- a/svtools/source/toolpanel/toolpanelcollection.cxx
+++ b/svtools/source/toolpanel/toolpanelcollection.cxx
@@ -89,7 +89,7 @@ namespace svt
m_pData->aActivePanel = i_nPanel;
// notify listeners
- m_pData->aListeners.ActivePanelChanged( aOldPanel, *m_pData->aActivePanel );
+ m_pData->aListeners.ActivePanelChanged( aOldPanel, m_pData->aActivePanel );
}
//--------------------------------------------------------------------
@@ -126,6 +126,49 @@ namespace svt
}
//--------------------------------------------------------------------
+ void ToolPanelCollection::RemovePanel( const size_t i_nPosition )
+ {
+ OSL_ENSURE( i_nPosition < m_pData->aPanels.size(), "ToolPanelCollection::RemovePanel: illegal position!" );
+ if ( i_nPosition >= m_pData->aPanels.size() )
+ return;
+
+ // if the active panel is going to be removed, activate another one (before the actual removal)
+ if ( m_pData->aActivePanel == i_nPosition )
+ {
+ const ::boost::optional< size_t > aOldActive( m_pData->aActivePanel );
+
+ if ( i_nPosition + 1 < GetPanelCount() )
+ {
+ ++*m_pData->aActivePanel;
+ }
+ else if ( i_nPosition > 0 )
+ {
+ --*m_pData->aActivePanel;
+ }
+ else
+ {
+ m_pData->aActivePanel.reset();
+ }
+
+ m_pData->aListeners.ActivePanelChanged( aOldActive, m_pData->aActivePanel );
+ }
+
+ // actually remove
+ m_pData->aPanels.erase( m_pData->aPanels.begin() + i_nPosition );
+
+ if ( !!m_pData->aActivePanel )
+ {
+ if ( i_nPosition < *m_pData->aActivePanel )
+ {
+ --*m_pData->aActivePanel;
+ }
+ }
+
+ // notify removed panel
+ m_pData->aListeners.PanelRemoved( i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
void ToolPanelCollection::AddListener( IToolPanelDeckListener& i_rListener )
{
m_pData->aListeners.AddListener( i_rListener );
diff --git a/svtools/source/toolpanel/toolpanelcollection.hxx b/svtools/source/toolpanel/toolpanelcollection.hxx
index eff5a6efb9b2..5c1f7ce3b8e3 100644
--- a/svtools/source/toolpanel/toolpanelcollection.hxx
+++ b/svtools/source/toolpanel/toolpanelcollection.hxx
@@ -54,6 +54,7 @@ namespace svt
GetActivePanel() const;
virtual void ActivatePanel( const size_t i_nPanel );
virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual void RemovePanel( const size_t i_nPosition );
virtual void AddListener( IToolPanelDeckListener& i_rListener );
virtual void RemoveListener( IToolPanelDeckListener& i_rListener );
diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx
index 8c8565d2cad2..b8ca75e74fac 100644
--- a/svtools/source/toolpanel/toolpaneldeck.cxx
+++ b/svtools/source/toolpanel/toolpaneldeck.cxx
@@ -87,6 +87,7 @@ namespace svt
GetActivePanel() const;
void ActivatePanel( const size_t i_nPanel );
size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ void RemovePanel( const size_t i_nPosition );
void AddListener( IToolPanelDeckListener& i_rListener );
void RemoveListener( IToolPanelDeckListener& i_rListener );
@@ -100,7 +101,8 @@ namespace svt
protected:
// IToolPanelDeckListener
virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition );
- virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive );
+ virtual void PanelRemoved( const size_t i_nPosition );
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
virtual void Dying();
private:
@@ -168,6 +170,12 @@ namespace svt
}
//--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::RemovePanel( const size_t i_nPosition )
+ {
+ m_aPanels.RemovePanel( i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
void ToolPanelDeck_Impl::ImplDoLayout()
{
const Rectangle aDeckPlayground( Point(), m_rDeck.GetOutputSizePixel() );
@@ -258,7 +266,14 @@ namespace svt
}
//--------------------------------------------------------------------
- void ToolPanelDeck_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive )
+ void ToolPanelDeck_Impl::PanelRemoved( const size_t i_nPosition )
+ {
+ // multiplex to our own listeners
+ m_aListeners.PanelRemoved( i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
{
// hide the old panel
if ( !!i_rOldActive )
@@ -268,13 +283,13 @@ namespace svt
}
// position and show the new panel
- const PToolPanel pNewActive( m_aPanels.GetPanel( i_nNewActive ) );
+ const PToolPanel pNewActive( !i_rNewActive ? m_pDummyPanel : m_aPanels.GetPanel( *i_rNewActive ) );
pNewActive->SetPosSizePixel( m_aPanelPlayground );
pNewActive->Show();
pNewActive->GrabFocus();
// multiplex to our own listeners
- m_aListeners.ActivePanelChanged( i_rOldActive, i_nNewActive );
+ m_aListeners.ActivePanelChanged( i_rOldActive, i_rNewActive );
}
//--------------------------------------------------------------------
@@ -333,6 +348,12 @@ namespace svt
}
//--------------------------------------------------------------------
+ void ToolPanelDeck::RemovePanel( const size_t i_nPosition )
+ {
+ m_pImpl->RemovePanel( i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
PDeckLayouter ToolPanelDeck::GetLayouter() const
{
return m_pImpl->GetLayouter();
diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx
index f0e12962d1fd..3a593d140670 100644
--- a/svtools/workben/toolpanel/toolpaneltest.cxx
+++ b/svtools/workben/toolpanel/toolpaneltest.cxx
@@ -41,6 +41,7 @@
#include <vcl/edit.hxx>
#include <vcl/fixed.hxx>
#include <vcl/help.hxx>
+#include <vcl/lstbox.hxx>
#include <vcl/svapp.hxx>
#include <vcl/taskpanelist.hxx>
#include <vcl/wrkwin.hxx>
@@ -215,16 +216,32 @@ Image ColoredPanel::GetImage() const
//= OptionsWindow
//=============================================================================
class PanelDemoMainWindow;
-class OptionsWindow : public Window
+class OptionsWindow :public Window
+ ,public ::svt::IToolPanelDeckListener
{
public:
OptionsWindow( PanelDemoMainWindow& i_rParent );
+ ~OptionsWindow();
- virtual void Resize();
- virtual void GetFocus();
+ // Window overridables
+ virtual void Resize();
+ virtual void GetFocus();
+ virtual void StateChanged( StateChangedType i_nStateChange );
+
+ // IToolPanelDeckListener
+ virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual void PanelRemoved( const size_t i_nPosition );
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ virtual void Dying();
private:
DECL_LINK( OnRadioToggled, RadioButton* );
+ DECL_LINK( OnListEntrySelected, ListBox* );
+ DECL_LINK( OnListEntryDoubleClicked, ListBox* );
+ DECL_LINK( OnButtonClicked, PushButton* );
+
+ void impl_initPanelList();
+ void impl_updateRemoveButton();
private:
FixedLine m_aAlignmentHeader;
@@ -235,6 +252,10 @@ private:
RadioButton m_aImagesOnly;
RadioButton m_aTextOnly;
RadioButton m_aAutomaticContent;
+
+ FixedLine m_aPanelsHeader;
+ ListBox m_aPanelList;
+ PushButton m_aRemovePanel;
};
//=============================================================================
@@ -254,6 +275,9 @@ public:
void AlignTabs( const ::svt::TabAlignment i_eAlignment );
void SetTabItemContent( const TabItemContent i_eItemContent );
+ // member access
+ IToolPanelDeck& GetToolPanelDeck();
+
protected:
virtual void GetFocus();
@@ -276,28 +300,41 @@ OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent )
,m_aImagesOnly( this )
,m_aTextOnly( this )
,m_aAutomaticContent( this )
+ ,m_aPanelsHeader( this )
+ ,m_aPanelList( this )
+ ,m_aRemovePanel( this )
{
SetBorderStyle( WINDOW_BORDER_MONO );
- const Color aFaceColor( GetSettings().GetStyleSettings().GetFaceColor() );
- SetBackground( aFaceColor );
-
Window* pControls[] =
{
&m_aAlignmentHeader, &m_aAlignLeft, &m_aAlignRight, &m_aTabItemContent, &m_aImagesAndText, &m_aImagesOnly,
- &m_aTextOnly, &m_aAutomaticContent
+ &m_aTextOnly, &m_aAutomaticContent, &m_aPanelsHeader, &m_aPanelList, &m_aRemovePanel
};
const sal_Char* pTexts[] =
{
- "Tab Bar Alignment", "Left", "Right", "Tab Items", "Images and Text", "Images only", "Text only", "Automatic"
+ "Tab Bar Alignment", "Left", "Right", "Tab Items", "Images and Text", "Images only", "Text only", "Automatic",
+ "Panels", "", "Remove Panel"
};
for ( size_t i=0; i < sizeof( pControls ) / sizeof( pControls[0] ); ++i )
{
+ const WindowType eWindowType = pControls[i]->GetType();
+
pControls[i]->SetText( String::CreateFromAscii( pTexts[i] ) );
- pControls[i]->SetControlBackground( aFaceColor );
pControls[i]->Show();
- if ( pControls[i]->GetType() == WINDOW_RADIOBUTTON )
+ if ( eWindowType == WINDOW_RADIOBUTTON )
static_cast< RadioButton* >( pControls[i] )->SetToggleHdl( LINK( this, OptionsWindow, OnRadioToggled ) );
+
+ if ( eWindowType == WINDOW_LISTBOX )
+ {
+ static_cast< ListBox* >( pControls[i] )->SetSelectHdl( LINK( this, OptionsWindow, OnListEntrySelected ) );
+ static_cast< ListBox* >( pControls[i] )->SetDoubleClickHdl( LINK( this, OptionsWindow, OnListEntryDoubleClicked ) );
+ }
+
+ if ( eWindowType == WINDOW_PUSHBUTTON )
+ {
+ static_cast< PushButton* >( pControls[i] )->SetClickHdl( LINK( this, OptionsWindow, OnButtonClicked ) );
+ }
}
m_aAlignRight.Check();
@@ -307,6 +344,48 @@ OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent )
}
//-----------------------------------------------------------------------------
+OptionsWindow::~OptionsWindow()
+{
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::impl_updateRemoveButton()
+{
+ m_aRemovePanel.Enable( m_aPanelList.GetSelectEntryCount() > 0 );
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::impl_initPanelList()
+{
+ m_aPanelList.Clear();
+
+ PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) );
+ IToolPanelDeck& rPanelDeck( rController.GetToolPanelDeck() );
+
+ for ( size_t i=0; i<rPanelDeck.GetPanelCount(); ++i )
+ {
+ PToolPanel pPanel = rPanelDeck.GetPanel( i );
+ m_aPanelList.InsertEntry( pPanel->GetDisplayName(), pPanel->GetImage() );
+ }
+ ActivePanelChanged( ::boost::optional< size_t >(), rPanelDeck.GetActivePanel() );
+
+ impl_updateRemoveButton();
+
+ rPanelDeck.AddListener( *this );
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::StateChanged( StateChangedType i_nStateChange )
+{
+ Window::StateChanged( i_nStateChange );
+
+ if ( i_nStateChange == STATE_CHANGE_INITSHOW )
+ {
+ impl_initPanelList();
+ }
+}
+
+//-----------------------------------------------------------------------------
void OptionsWindow::GetFocus()
{
Window::GetFocus();
@@ -335,10 +414,10 @@ void OptionsWindow::Resize()
const long nIndent( LogicToPixel( Size( 6, 9 ), MAP_APPFONT ).Width() );
const long nLineHeight( LogicToPixel( Size( 0, 8 ), MAP_APPFONT ).Height() );
- const Size aSuperordinateSize( aOutputSize.Width() - 2 * aSpacing.Width(), nLineHeight );
+ const long nSuperordinateWidth = aOutputSize.Width() - 2 * aSpacing.Width();
const long nSuperordinateX = aSpacing.Width();
- const Size aSubordinateSize( aOutputSize.Width() - 2 * aSpacing.Width() - nIndent, nLineHeight );
+ const long nSubordinateWidth = aOutputSize.Width() - 2 * aSpacing.Width() - nIndent;
const long nSubordinateX = aSpacing.Width() + nIndent;
Point aItemPos( nSuperordinateX, aSpacing.Height() );
@@ -347,7 +426,14 @@ void OptionsWindow::Resize()
{
Window* pWindow;
bool bSubordinate;
- ControlRow( Window& i_rWindow, const bool i_bSubordinate ) : pWindow( &i_rWindow ), bSubordinate( i_bSubordinate ) { }
+ size_t nRows;
+
+ ControlRow( Window& i_rWindow, const bool i_bSubordinate, const size_t i_nRows = 1 )
+ :pWindow( &i_rWindow )
+ ,bSubordinate( i_bSubordinate )
+ ,nRows( i_nRows )
+ {
+ }
};
ControlRow aControlRows[] =
{
@@ -358,7 +444,10 @@ void OptionsWindow::Resize()
ControlRow( m_aImagesAndText, true ),
ControlRow( m_aImagesOnly, true ),
ControlRow( m_aTextOnly, true ),
- ControlRow( m_aAutomaticContent, true )
+ ControlRow( m_aAutomaticContent, true ),
+ ControlRow( m_aPanelsHeader, false ),
+ ControlRow( m_aPanelList, true, 8 ),
+ ControlRow( m_aRemovePanel, true, 2 )
};
bool bPreviousWasSubordinate = false;
for ( size_t i=0; i < sizeof( aControlRows ) / sizeof( aControlRows[0] ); ++i )
@@ -369,11 +458,76 @@ void OptionsWindow::Resize()
aItemPos.Y() += aSpacing.Height();
bPreviousWasSubordinate = aControlRows[i].bSubordinate;
- const Size& rControlSize = ( aControlRows[i].bSubordinate ) ? aSubordinateSize : aSuperordinateSize;
- aControlRows[i].pWindow->SetPosSizePixel( aItemPos, rControlSize );
+ Size aControlSize(
+ aControlRows[i].bSubordinate ? nSubordinateWidth : nSuperordinateWidth,
+ nLineHeight * aControlRows[i].nRows
+ );
+ aControlRows[i].pWindow->SetPosSizePixel( aItemPos, aControlSize );
+
+ aItemPos.Move( 0, aControlSize.Height() + aSpacing.Height() );
+ }
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition )
+{
+ m_aPanelList.InsertEntry( i_pPanel->GetDisplayName(), i_pPanel->GetImage(), USHORT( i_nPosition ) );
+}
- aItemPos.Move( 0, rControlSize.Height() + aSpacing.Height() );
+//-----------------------------------------------------------------------------
+void OptionsWindow::PanelRemoved( const size_t i_nPosition )
+{
+ m_aPanelList.RemoveEntry( USHORT( i_nPosition ) );
+ impl_updateRemoveButton();
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+{
+ (void)i_rOldActive;
+
+ if ( !i_rNewActive )
+ m_aPanelList.SetNoSelection();
+ else
+ m_aPanelList.SelectEntryPos( USHORT( *i_rNewActive ) );
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::Dying()
+{
+ // not interested in
+}
+
+//-----------------------------------------------------------------------------
+IMPL_LINK( OptionsWindow, OnListEntrySelected, ListBox*, i_pListBox )
+{
+ impl_updateRemoveButton();
+ return 0L;
+}
+
+//-----------------------------------------------------------------------------
+IMPL_LINK( OptionsWindow, OnListEntryDoubleClicked, ListBox*, i_pListBox )
+{
+ PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) );
+
+ if ( i_pListBox == &m_aPanelList )
+ {
+ size_t nActivatePanel = size_t( m_aPanelList.GetSelectEntryPos() );
+ rController.GetToolPanelDeck().ActivatePanel( nActivatePanel );
+ }
+
+ return 0L;
+}
+//-----------------------------------------------------------------------------
+IMPL_LINK( OptionsWindow, OnButtonClicked, PushButton*, i_pPushButton )
+{
+ PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) );
+
+ if ( i_pPushButton == &m_aRemovePanel )
+ {
+ rController.GetToolPanelDeck().RemovePanel( size_t( m_aPanelList.GetSelectEntryPos() ) );
}
+ return 0L;
}
//-----------------------------------------------------------------------------
@@ -419,10 +573,6 @@ PanelDemoMainWindow::PanelDemoMainWindow()
,m_aToolPanelDeck( *this, WB_BORDER )
,m_aDemoOptions( *this )
{
- const Color aFaceColor( GetSettings().GetStyleSettings().GetFaceColor() );
-
- SetBackground( aFaceColor );
-
m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), Size( 500, 300 ) );
m_aToolPanelDeck.SetBorderStyle( WINDOW_BORDER_MONO );
@@ -461,13 +611,13 @@ void PanelDemoMainWindow::Resize()
{
WorkWindow::Resize();
Size aSize( GetOutputSizePixel() );
- aSize.Width() -= 190;
+ aSize.Width() -= 240;
aSize.Height() -= 40;
m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), aSize );
m_aDemoOptions.SetPosSizePixel(
Point( 20 + aSize.Width(), 20 ),
- Size( 150, aSize.Height() )
+ Size( 200, aSize.Height() )
);
}
@@ -495,6 +645,12 @@ void PanelDemoMainWindow::SetTabItemContent( const TabItemContent i_eItemContent
pLayouter->SetTabItemContent( i_eItemContent );
}
+//-----------------------------------------------------------------------------
+IToolPanelDeck& PanelDemoMainWindow::GetToolPanelDeck()
+{
+ return m_aToolPanelDeck;
+}
+
//=============================================================================
//= PanelDemo
//=============================================================================