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 #ifndef _SVX_SIDEBAR_VALUESETWITHTEXT_CONTROL_HXX_ 23 #define _SVX_SIDEBAR_VALUESETWITHTEXT_CONTROL_HXX_ 24 25 #include "svx/svxdllapi.h" 26 27 #include <svtools/valueset.hxx> 28 29 #include <vcl/image.hxx> 30 31 #include <vector> 32 33 namespace svx { namespace sidebar { 34 35 /** Specialization of class <ValueSet>. 36 This specialization allows is a one-columned ValueSet which allow 37 items containing an image and a text or a text and a second text. 38 39 Especially, used for sidebar related controls. 40 */ 41 class SVX_DLLPUBLIC ValueSetWithTextControl : public ValueSet 42 { 43 public: 44 // control type of specialized <ValueSet>: 45 // - image + text 46 // - text + text 47 enum tControlType 48 { 49 IMAGE_TEXT, 50 TEXT_TEXT 51 }; 52 53 ValueSetWithTextControl( 54 const tControlType eControlType, 55 Window* pParent, 56 const ResId& rResId); 57 58 virtual ~ValueSetWithTextControl(void); 59 60 // add item for control type IMAGE_TEXT 61 // if control type does not match IMAGE_TEXT no item is added. 62 // @param pSelectedItemImage 63 // selection item image is optional. if not provided, it is the same as the image item 64 // @param pItemHelpText 65 // help text is optional. if not provided, it is the same as the item text 66 void AddItem( 67 const Image& rItemImage, 68 const Image* pSelectedItemImage, 69 const XubString& rItemText, 70 const XubString* pItemHelpText ); 71 72 // add item for control type TEXT_TEXT 73 // if control type does not match TEXT_TEXT no item is added. 74 // @param pItemHelpText 75 // help text is optional. if not provided, it is the same as the item text 76 void AddItem( 77 const XubString& rItemText, 78 const XubString& rItemText2, 79 const XubString* pItemHelpText ); 80 81 virtual void UserDraw( const UserDrawEvent& rUDEvt ); 82 83 private: 84 struct ValueSetWithTextItem 85 { 86 Image maItemImage; 87 Image maSelectedItemImage; 88 XubString maItemText; 89 XubString maItemText2; 90 }; 91 92 typedef ::std::vector< ValueSetWithTextItem > tItemList; 93 94 const tControlType meControlType; 95 tItemList maItems; 96 }; 97 98 } } // end of namespace svx::sidebar 99 100 #endif 101