Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoWinMaterialList.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24
25
26#ifndef _SO_WIN_MATERIAL_LIST_H_
27#define _SO_WIN_MATERIAL_LIST_H_
28
29#ifdef _WIN32
30// Not yet implemented for _WIN32
31#else
32
33#include <Inventor/SbBasic.h>
34#include <Inventor/misc/SoCallbackList.h>
35#include <Inventor/Win/SoWinComponent.h>
36#include <Inventor/nodes/SoMaterial.h>
37
38// callback function prototypes
39typedef void SoWinMaterialListCB(void *userData, const SoMaterial *mtl);
40
42//
43// Class: SoWinMaterialList
44//
45//
47
48{
49 public:
50 // pass the home directory of the material palettes as dir
51 SoWinMaterialList(
52 SoWidget parent = NULL,
53 const char *name = NULL,
54 SbBool buildInsideParent = TRUE,
55 const char *dir = NULL);
56 ~SoWinMaterialList();
57
58 // Callbacks - register functions that will be called whenever the user
59 // chooses a new material from the list.
60 // (This component cannot be attached to a database - it is read only)
61 void addCallback(
62 SoWinMaterialListCB *f,
63 void *userData = NULL)
64 { callbackList->addCallback((SoCallbackListCB *) f, userData);}
65
66 void removeCallback(
67 SoWinMaterialListCB *f,
68 void *userData = NULL)
69 { callbackList->removeCallback((SoCallbackListCB *) f, userData); }
70
71 private:
72
73 // This constructor takes a boolean whether to build the widget now.
74 // Subclasses can pass FALSE, then call SoWinMaterialList::buildWidget()
75 // when they are ready for it to be built.
76 SoEXTENDER
77 SoWinMaterialList(
78 SoWidget parent,
79 const char *name,
80 SbBool buildInsideParent,
81 const char *dir,
82 SbBool buildNow);
83
84 // redefine these
85 virtual SbString getDefaultWidgetName() const;
86 virtual SbString getDefaultTitle() const;
87 virtual SbString getDefaultIconTitle() const;
88
89 // Build routines
90 SoWidget buildWidget(SoWidget parent);
91 SoWidget buildPulldownMenu(SoWidget parent);
92
93 private:
94 char *materialDir; // the parent directory of materials
95 SoCallbackList *callbackList; // funcs to invoke when a mtl is picked
96 SbPList menuItems; // Widgets
97 SbPList mtlPalettes; // list of palettes
98 SbPList palette; // the current palette
99 int curPalette; // index into mtlPalettes
100 SoWidget mtlList; // the Motif list of materials
101
102 // Fill up the mtlList with a new palette
103 void fillInMaterialList();
104 SbBool setupPalettes();
105
106 // Callback routines from Xt/Motif
107 static void menuPick(SoWidget, int, XtPointer);
108 static void listPick(SoWidget, SoWinMaterialList *, XtPointer);
109
110 // this is called by both constructors
111 void constructorCommon(const char *dir, SbBool buildNow);
112};
113
114#endif //_WIN32
115
116#endif // _SO_WIN_MATERIAL_LIST_H_
117
118
List of generic (void *) pointers.
Definition SbPList.h:77
Class for smart character strings.
Definition SbString.h:202
Manages a list of callbacks and associated data.
void addCallback(SoCallbackListCB *f, void *userData=NULL)
Adds a function to the list of callback functions.
void removeCallback(SoCallbackListCB *f, void *userData=NULL)
Removes a function from the list of callback functions.
Surface material definition node.
Definition SoMaterial.h:173
int SbBool
Boolean type.
Definition SbBase.h:87
void * XtPointer
Definition SoQtDef.h:122