summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2016-07-20 16:08:38 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2016-07-22 08:59:59 +0000
commitb949604b91f77dee3b2737ea09e1ac3ade4eed1c (patch)
tree84b3f65668c933f8fc5e5ce3541df5aa0919c7ef /vcl
parentb5c05876f73c31270bc374e4f481ef1d09a42e5f (diff)
GSoC notebookbar: file menu
+ added icon to the notebookbar, after click the file menu will appear Change-Id: I30e1ed7e2c4a194e150c7196652904fd4e5c9e8e Reviewed-on: https://gerrit.libreoffice.org/27347 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/svids.hrc1
-rw-r--r--vcl/source/control/notebookbar.cxx8
-rw-r--r--vcl/source/control/tabctrl.cxx37
-rw-r--r--vcl/source/src/images.src5
4 files changed, 46 insertions, 5 deletions
diff --git a/vcl/inc/svids.hrc b/vcl/inc/svids.hrc
index 7c81ecc6f43f..efb34907e320 100644
--- a/vcl/inc/svids.hrc
+++ b/vcl/inc/svids.hrc
@@ -43,6 +43,7 @@
#define SV_RESID_BITMAP_CLOSEDOC 1052
#define SV_RESID_BITMAP_INDEX 1053
#define SV_RESID_BITMAP_REFRESH 1054
+#define SV_RESID_BITMAP_NOTEBOOKBAR 1055
#define SV_DISCLOSURE_PLUS 1060
#define SV_DISCLOSURE_MINUS 1061
diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx
index 413cb57c6a79..a47cb038315f 100644
--- a/vcl/source/control/notebookbar.cxx
+++ b/vcl/source/control/notebookbar.cxx
@@ -90,6 +90,11 @@ void NotebookBar::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, P
VclContainer::setLayoutAllocation(*pChild, Point(0, 0), Size(nWidth, nHeight));
}
+void NotebookBar::SetIconClickHdl(Link<NotebookBar*, void> aHdl)
+{
+ m_pTabControl->SetIconClickHdl(aHdl);
+}
+
void NotebookBar::StateChanged(StateChangedType nType)
{
if (nType == StateChangedType::Visible)
@@ -104,7 +109,8 @@ void NotebookBar::StateChanged(StateChangedType nType)
void SAL_CALL NotebookBarContextChangeEventListener::notifyContextChangeEvent(const css::ui::ContextChangeEventObject& rEvent)
throw (css::uno::RuntimeException, std::exception)
{
- mpParent->m_pTabControl->SetContext(vcl::EnumContext::GetContextEnum(rEvent.ContextName));
+ if (mpParent && mpParent->m_pTabControl)
+ mpParent->m_pTabControl->SetContext(vcl::EnumContext::GetContextEnum(rEvent.ContextName));
}
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index d532a5efddd2..93b3b2037f5d 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -33,6 +33,7 @@
#include <vcl/settings.hxx>
#include <vcl/uitest/uiobject.hxx>
#include <vcl/builderfactory.hxx>
+#include <svids.hrc>
#include "controldata.hxx"
#include "svdata.hxx"
@@ -2206,6 +2207,15 @@ NotebookbarTabControl::NotebookbarTabControl(vcl::Window* pParent, WinBits nStyl
: TabControl(pParent, nStyle)
, eLastContext( vcl::EnumContext::Context::Context_Any )
{
+ LanguageTag aLocale( Application::GetSettings().GetUILanguageTag());
+ ResMgr* pResMgr = ResMgr::SearchCreateResMgr( "vcl", aLocale );
+
+ Bitmap aBitmap;
+ if( pResMgr )
+ aBitmap = Bitmap( ResId( SV_RESID_BITMAP_NOTEBOOKBAR, *pResMgr ) );
+
+ InsertPage(1, "");
+ SetPageImage(1, Image(aBitmap));
}
void NotebookbarTabControl::SetContext( vcl::EnumContext::Context eContext )
@@ -2217,30 +2227,49 @@ void NotebookbarTabControl::SetContext( vcl::EnumContext::Context eContext )
TabPage* pPage = static_cast<TabPage*>(GetChild(nChild));
if (pPage->HasContext(eContext) || pPage->HasContext(vcl::EnumContext::Context::Context_Any))
- EnablePage(nChild + 1);
+ EnablePage(nChild + 2);
else
- EnablePage(nChild + 1, false);
+ EnablePage(nChild + 2, false);
if (pPage->HasContext(eContext) && eContext != vcl::EnumContext::Context::Context_Any)
- SetCurPageId(nChild + 1);
+ SetCurPageId(nChild + 2);
}
eLastContext = eContext;
}
}
+void NotebookbarTabControl::SetIconClickHdl( Link<NotebookBar*, void> aHdl )
+{
+ m_aIconClickHdl = aHdl;
+}
+
sal_uInt16 NotebookbarTabControl::GetPageId( const Point& rPos ) const
{
for( size_t i = 0; i < mpTabCtrlData->maItemList.size(); ++i )
{
if ( const_cast<NotebookbarTabControl*>(this)->ImplGetTabRect( static_cast<sal_uInt16>(i) ).IsInside( rPos ) )
- if ( mpTabCtrlData->maItemList[ i ].mbEnabled )
+ if ( mpTabCtrlData->maItemList[ i ].mbEnabled )
return mpTabCtrlData->maItemList[ i ].mnId;
}
return 0;
}
+void NotebookbarTabControl::SelectTabPage( sal_uInt16 nPageId )
+{
+ if ( nPageId == 1 )
+ m_aIconClickHdl.Call( static_cast<NotebookBar*>(GetParent()) );
+ else
+ TabControl::SelectTabPage( nPageId );
+}
+
+void NotebookbarTabControl::SetCurPageId( sal_uInt16 nPageId )
+{
+ if ( nPageId != 1 )
+ TabControl::SetCurPageId( nPageId );
+}
+
bool NotebookbarTabControl::ImplPlaceTabs( long nWidth )
{
if ( nWidth <= 0 )
diff --git a/vcl/source/src/images.src b/vcl/source/src/images.src
index 88d35c14824f..77cfb392831a 100644
--- a/vcl/source/src/images.src
+++ b/vcl/source/src/images.src
@@ -284,4 +284,9 @@ Bitmap SV_DISCLOSURE_MINUS
File = "minus.png";
};
+Bitmap SV_RESID_BITMAP_NOTEBOOKBAR
+{
+ File = "notebookbar.png";
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */