1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _SVX_CHECKLBX_HXX 24 #define _SVX_CHECKLBX_HXX 25 26 // include --------------------------------------------------------------- 27 28 29 #include <svtools/svtreebx.hxx> 30 #include <svtools/svlbitm.hxx> 31 32 #ifndef _LSTBOX_HXX //autogen 33 #include <vcl/lstbox.hxx> 34 #endif 35 #include "svx/svxdllapi.h" 36 37 // class SvxCheckListBox ------------------------------------------------- 38 39 class SVX_DLLPUBLIC SvxCheckListBox : public SvTreeListBox 40 { 41 using Window::GetText; 42 43 private: 44 SvLBoxButtonData* pCheckButton; 45 46 #ifdef _SVX_CHECKLBX_CXX 47 SVX_DLLPRIVATE void Init_Impl(); 48 #endif 49 50 using SvTreeListBox::InsertEntry; 51 // Avoid ambiguity with new InsertEntry: 52 virtual SvLBoxEntry* InsertEntry( const XubString& rText, SvLBoxEntry* pParent, 53 sal_Bool bChildsOnDemand, 54 sal_uIntPtr nPos, void* pUserData, 55 SvLBoxButtonKind eButtonKind ); 56 57 public: 58 SvxCheckListBox( Window* pParent, WinBits nWinStyle = 0 ); 59 SvxCheckListBox( Window* pParent, const ResId& rResId ); 60 SvxCheckListBox( Window* pParent, const ResId& rResId, 61 const Image& rNormalStaticImage, 62 const Image& rHighContrastStaticImage ); 63 ~SvxCheckListBox(); 64 65 void InsertEntry ( const String& rStr, 66 sal_uInt16 nPos = LISTBOX_APPEND, 67 void* pUserData = NULL, 68 SvLBoxButtonKind eButtonKind = 69 SvLBoxButtonKind_enabledCheckbox ); 70 void RemoveEntry ( sal_uInt16 nPos ); 71 72 void SelectEntryPos ( sal_uInt16 nPos, sal_Bool bSelect = sal_True ); 73 sal_uInt16 GetSelectEntryPos () const; 74 75 String GetText ( sal_uInt16 nPos ) const; 76 sal_uInt16 GetCheckedEntryCount() const; 77 void CheckEntryPos ( sal_uInt16 nPos, sal_Bool bCheck = sal_True ); 78 sal_Bool IsChecked ( sal_uInt16 nPos ) const; 79 void ToggleCheckButton ( SvLBoxEntry* pEntry ); 80 81 void* SetEntryData ( sal_uInt16 nPos, void* pNewData ); 82 void* GetEntryData ( sal_uInt16 nPos ) const; 83 84 virtual void MouseButtonDown ( const MouseEvent& rMEvt ); 85 virtual void KeyInput ( const KeyEvent& rKEvt ); 86 }; 87 88 89 #endif 90 91