diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-03-01 13:23:12 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-03-01 13:23:12 +0100 |
commit | d648e087014684dd4a930f9f49becb28d28f0560 (patch) | |
tree | 3b7a5c27d546409cab54ac4cf4150a223bfb45e9 /svtools/workben | |
parent | e786c55dfdaf2f4fede00113ab0b32c867c13437 (diff) |
slidecopy: initial version of the tab bar layout
still quite some work ahead, but we have a tab bar now, and can click the tabs to select panes
Diffstat (limited to 'svtools/workben')
-rw-r--r-- | svtools/workben/toolpanel/toolpaneltest.cxx | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 6b02208fbdfe..d717ed9a3fd6 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -35,6 +35,7 @@ #include <cppuhelper/bootstrap.hxx> #include <cppuhelper/servicefactory.hxx> #include <tools/diagnose_ex.h> +#include <vcl/help.hxx> #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> @@ -82,25 +83,40 @@ public: class ColoredPanel : public IToolPanel { public: - ColoredPanel( Window& i_rParent, const Color& i_rColor ); + ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_Char* i_pAsciiPanelName ); ~ColoredPanel(); // IToolPanel virtual void Show(); virtual void Hide(); virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ); + virtual ::rtl::OUString GetDisplayName() const; + virtual Image GetImage() const; + + // IReference + virtual oslInterlockedCount SAL_CALL acquire(); + virtual oslInterlockedCount SAL_CALL release(); private: + oslInterlockedCount m_refCount; ColoredPanelWindow m_aWindow; + ::rtl::OUString m_aPanelName; + BitmapEx m_aPanelIcon; }; //============================================================================= //= ColoredPanel //============================================================================= //----------------------------------------------------------------------------- -ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor ) - :m_aWindow( i_rParent, i_rColor ) +ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_Char* i_pAsciiPanelName ) + :m_refCount(0) + ,m_aWindow( i_rParent, i_rColor ) + ,m_aPanelName( ::rtl::OUString::createFromAscii( i_pAsciiPanelName ) ) + ,m_aPanelIcon() { + Bitmap aBitmap( Size( 16, 16 ), 8 ); + m_aPanelIcon = BitmapEx( aBitmap ); + m_aPanelIcon.Erase( i_rColor ); } //----------------------------------------------------------------------------- @@ -109,6 +125,21 @@ ColoredPanel::~ColoredPanel() } //----------------------------------------------------------------------------- +oslInterlockedCount SAL_CALL ColoredPanel::acquire() +{ + return osl_incrementInterlockedCount( &m_refCount ); +} + +//----------------------------------------------------------------------------- +oslInterlockedCount SAL_CALL ColoredPanel::release() +{ + oslInterlockedCount newCount = osl_decrementInterlockedCount( &m_refCount ); + if ( 0 == newCount ) + delete this; + return newCount; +} + +//----------------------------------------------------------------------------- void ColoredPanel::Show() { m_aWindow.Show(); @@ -126,6 +157,18 @@ void ColoredPanel::SetPosSizePixel( const Rectangle& i_rPanelPlayground ) m_aWindow.SetPosSizePixel( i_rPanelPlayground.TopLeft(), i_rPanelPlayground.GetSize() ); } +//----------------------------------------------------------------------------- +::rtl::OUString ColoredPanel::GetDisplayName() const +{ + return m_aPanelName; +} + +//----------------------------------------------------------------------------- +Image ColoredPanel::GetImage() const +{ + return Image( m_aPanelIcon ); +} + //============================================================================= //= PanelDemoMainWindow //============================================================================= @@ -155,16 +198,20 @@ PanelDemoMainWindow::PanelDemoMainWindow() m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), Size( 500, 300 ) ); m_aToolPanelDeck.SetBorderStyle( WINDOW_BORDER_MONO ); - ToolPanelCollection& rPanels = m_aToolPanelDeck.GetPanels(); - const size_t nFirstPanelPosition = rPanels.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, Color( COL_RED ) ) ), rPanels.GetPanelCount() ); - m_aToolPanelDeck.ActivatePanel( nFirstPanelPosition ); + PToolPanelContainer pPanels( m_aToolPanelDeck.GetPanels() ); + pPanels->InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, Color( COL_RED ), "Red" ) ), pPanels->GetPanelCount() ); + pPanels->InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, Color( COL_GREEN ), "Some flavor of Green" ) ), pPanels->GetPanelCount() ); + pPanels->InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, RGB_COLORDATA( 255, 255, 0 ), "Yellow is ugly" ) ), pPanels->GetPanelCount() ); + m_aToolPanelDeck.ActivatePanel( 0 ); m_aToolPanelDeck.Show(); SetBackground( Color( COL_LIGHTGRAY ) ); SetText( String::CreateFromAscii( "ToolPanelDeck Demo Application" ) ); Show(); + + Help::EnableQuickHelp(); } //----------------------------------------------------------------------------- |