summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-05-21 12:50:57 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-05-22 11:34:34 +0100
commit37430defd8e5d7092721c16cfc6bdb9f1db56c9f (patch)
treece3bde3b0a2950e6617c98da54b4c9ed68c2103b
parent1f1b45ab5d076a77545c54ff1839b98bae53a009 (diff)
restore StatusBar::GetItemData, etc. because we need it again
revert c95fa19f7c7b58a2beb65ad52335322ec2ae6f18 Conflicts: vcl/source/window/status.cxx Change-Id: I976802cde23892e7a3b2f6ad75d34a52bc7b2739 (cherry picked from commit c4ae127b6063b53df4592d6b37ea0f38a892d8c1)
-rw-r--r--include/vcl/status.hxx15
-rw-r--r--vcl/source/window/status.cxx175
2 files changed, 190 insertions, 0 deletions
diff --git a/include/vcl/status.hxx b/include/vcl/status.hxx
index 91aa97113179..12bfc19fdf1c 100644
--- a/include/vcl/status.hxx
+++ b/include/vcl/status.hxx
@@ -130,10 +130,19 @@ public:
StatusBarItemBits nBits = SIB_CENTER | SIB_IN,
long nOffset = STATUSBAR_OFFSET,
sal_uInt16 nPos = STATUSBAR_APPEND );
+ void RemoveItem( sal_uInt16 nItemId );
+ void ShowItem( sal_uInt16 nItemId );
+ void HideItem( sal_uInt16 nItemId );
sal_Bool IsItemVisible( sal_uInt16 nItemId ) const;
+
+ void ShowItems();
+ void HideItems();
sal_Bool AreItemsVisible() const { return mbVisibleItems; }
+ void RedrawItem( sal_uInt16 nItemId );
+
+ void CopyItems( const StatusBar& rStatusBar );
void Clear();
sal_uInt16 GetItemCount() const;
@@ -144,10 +153,16 @@ public:
Point GetItemTextPos( sal_uInt16 nItemId ) const;
sal_uInt16 GetCurItemId() const { return mnCurItemId; }
+ sal_uLong GetItemWidth( sal_uInt16 nItemId ) const;
+ StatusBarItemBits GetItemBits( sal_uInt16 nItemId ) const;
+
+ long GetItemOffset( sal_uInt16 nItemId ) const;
+
void SetItemText( sal_uInt16 nItemId, const XubString& rText );
const XubString& GetItemText( sal_uInt16 nItemId ) const;
void SetItemData( sal_uInt16 nItemId, void* pNewData );
+ void* GetItemData( sal_uInt16 nItemId ) const;
void SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand );
const XubString& GetItemCommand( sal_uInt16 nItemId );
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 2daf441353ab..78705c79b1c8 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -980,6 +980,68 @@ void StatusBar::InsertItem( sal_uInt16 nItemId, sal_uLong nWidth,
// -----------------------------------------------------------------------
+void StatusBar::RemoveItem( sal_uInt16 nItemId )
+{
+ sal_uInt16 nPos = GetItemPos( nItemId );
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ {
+ delete (*mpItemList)[ nPos ];
+ mpItemList->erase( mpItemList->begin() + nPos );
+
+ mbFormat = sal_True;
+ if ( ImplIsItemUpdate() )
+ Invalidate();
+
+ ImplCallEventListeners( VCLEVENT_STATUSBAR_ITEMREMOVED, (void*) sal_IntPtr(nItemId) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::ShowItem( sal_uInt16 nItemId )
+{
+ sal_uInt16 nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ {
+ ImplStatusItem* pItem = (*mpItemList)[ nPos ];
+ if ( !pItem->mbVisible )
+ {
+ pItem->mbVisible = sal_True;
+
+ mbFormat = sal_True;
+ if ( ImplIsItemUpdate() )
+ Invalidate();
+
+ ImplCallEventListeners( VCLEVENT_STATUSBAR_SHOWITEM, (void*) sal_IntPtr(nItemId) );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::HideItem( sal_uInt16 nItemId )
+{
+ sal_uInt16 nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ {
+ ImplStatusItem* pItem = (*mpItemList)[ nPos ];
+ if ( pItem->mbVisible )
+ {
+ pItem->mbVisible = sal_False;
+
+ mbFormat = sal_True;
+ if ( ImplIsItemUpdate() )
+ Invalidate();
+
+ ImplCallEventListeners( VCLEVENT_STATUSBAR_HIDEITEM, (void*) sal_IntPtr(nItemId) );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
sal_Bool StatusBar::IsItemVisible( sal_uInt16 nItemId ) const
{
sal_uInt16 nPos = GetItemPos( nItemId );
@@ -992,6 +1054,54 @@ sal_Bool StatusBar::IsItemVisible( sal_uInt16 nItemId ) const
// -----------------------------------------------------------------------
+void StatusBar::ShowItems()
+{
+ if ( !mbVisibleItems )
+ {
+ mbVisibleItems = sal_True;
+ if ( !mbProgressMode )
+ Invalidate();
+
+ ImplCallEventListeners( VCLEVENT_STATUSBAR_SHOWALLITEMS );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::HideItems()
+{
+ if ( mbVisibleItems )
+ {
+ mbVisibleItems = sal_False;
+ if ( !mbProgressMode )
+ Invalidate();
+
+ ImplCallEventListeners( VCLEVENT_STATUSBAR_HIDEALLITEMS );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::CopyItems( const StatusBar& rStatusBar )
+{
+ // Alle Items entfernen
+ for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
+ delete (*mpItemList)[ i ];
+ }
+ mpItemList->clear();
+
+ // Items kopieren
+ for ( size_t i = 0, n = rStatusBar.mpItemList->size(); i < n; ++i ) {
+ mpItemList->push_back( new ImplStatusItem( *(*rStatusBar.mpItemList)[ i ] ) );
+ }
+
+ mbFormat = sal_True;
+ if ( ImplIsItemUpdate() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
void StatusBar::Clear()
{
// Alle Item loeschen
@@ -1113,6 +1223,42 @@ Point StatusBar::GetItemTextPos( sal_uInt16 nItemId ) const
// -----------------------------------------------------------------------
+sal_uLong StatusBar::GetItemWidth( sal_uInt16 nItemId ) const
+{
+ sal_uInt16 nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ return (*mpItemList)[ nPos ]->mnWidth;
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+StatusBarItemBits StatusBar::GetItemBits( sal_uInt16 nItemId ) const
+{
+ sal_uInt16 nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ return (*mpItemList)[ nPos ]->mnBits;
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+long StatusBar::GetItemOffset( sal_uInt16 nItemId ) const
+{
+ sal_uInt16 nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ return (*mpItemList)[ nPos ]->mnOffset;
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
void StatusBar::SetItemText( sal_uInt16 nItemId, const XubString& rText )
{
sal_uInt16 nPos = GetItemPos( nItemId );
@@ -1209,6 +1355,35 @@ void StatusBar::SetItemData( sal_uInt16 nItemId, void* pNewData )
}
}
+void* StatusBar::GetItemData( sal_uInt16 nItemId ) const
+{
+ sal_uInt16 nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ return (*mpItemList)[ nPos ]->mpUserData;
+
+ return NULL;
+}
+
+void StatusBar::RedrawItem( sal_uInt16 nItemId )
+{
+ if ( mbFormat )
+ return;
+
+ sal_uInt16 nPos = GetItemPos( nItemId );
+ if ( nPos == STATUSBAR_ITEM_NOTFOUND )
+ return;
+
+ ImplStatusItem* pItem = (*mpItemList)[ nPos ];
+ if ( pItem && (pItem->mnBits & SIB_USERDRAW) &&
+ pItem->mbVisible && ImplIsItemUpdate() )
+ {
+ Update();
+ ImplDrawItem( sal_True, nPos, sal_False, sal_False );
+ Flush();
+ }
+}
+
// -----------------------------------------------------------------------
void StatusBar::SetHelpText( sal_uInt16 nItemId, const XubString& rText )