1 /**************************************************************************\ 2 * Copyright (c) Kongsberg Oil & Gas Technologies AS 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: 8 * 9 * Redistributions of source code must retain the above copyright notice, 10 * this list of conditions and the following disclaimer. 11 * 12 * Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * Neither the name of the copyright holder nor the names of its 17 * contributors may be used to endorse or promote products derived from 18 * this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 \**************************************************************************/ 32 33 #ifndef SOQT_MATERIALLIST_H 34 #define SOQT_MATERIALLIST_H 35 36 #include <Inventor/Qt/SoQtComponent.h> 37 38 class SoMaterial; 39 class QDir; 40 class QListBox; 41 class QPopupMenu; 42 43 typedef void SoQtMaterialListCB(void *userData, const SoMaterial *mtl); 44 45 class SOQT_DLL_API SoQtMaterialList : public SoQtComponent 46 { 47 Q_OBJECT 48 49 public: 50 SoQtMaterialList(QWidget *parent = NULL, 51 const char *name = NULL, 52 SbBool buildInsideParent = TRUE, 53 const char *dir = NULL); 54 ~SoQtMaterialList(); 55 56 #if 0 57 void addCallback(SoQtMaterialListCB *f, 58 void *userData = NULL); 59 void removeCallback(SoQtMaterialListCB *f, 60 void *userData = NULL); 61 #endif 62 public slots: 63 void setPalette(void); 64 void setPalette(int); 65 void setPalette(const char *); 66 void setMaterial(const char *); 67 signals: 68 void materialSelected(SoMaterial *); 69 void closed(void); 70 71 protected: 72 SoQtMaterialList(QWidget *parent, const char *name, 73 SbBool buildInsideParent, 74 const char *dir, SbBool buildNow); 75 virtual const char * getDefaultWidgetName(void) const; 76 virtual const char * getDefaultTitle(void) const; 77 virtual const char * getDefaultIconTitle(void) const; 78 virtual const char * componentClassName(void) const; 79 80 QWidget* buildPulldownMenu(QWidget *parent); 81 82 private: 83 QPopupMenu* menu; 84 char* materialDir; 85 char* curPalettePath; 86 QListBox* mtlList; 87 88 QDir* mtlPalettes; 89 QDir* mtlDirectory; 90 SoMaterial* material; 91 92 void dir2List(const char *dir); 93 }; 94 95 #endif // ! SOQT_MATERIALLIST_H 96