Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoXtMaterialList.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : David Mott (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
48
49
50#ifdef _WIN32
51# include <Inventor/Win/SoWinMaterialList.h>
52#else // _WIN32
53
54#ifndef _SO_XT_MATERIAL_LIST_H_
55#define _SO_XT_MATERIAL_LIST_H_
56
57#include <X11/Intrinsic.h>
58#include <Inventor/SbBasic.h>
59#include <Inventor/misc/SoCallbackList.h>
60#include <Inventor/Xt/SoXtComponent.h>
61#include <Inventor/nodes/SoMaterial.h>
62
63// callback function prototypes
65typedef void SoXtMaterialListCB(void *userData, const SoMaterial *mtl);
66
68//
69// Class: SoXtMaterialList
70//
71//
73
104 public:
113 SoWidget parent = NULL,
114 const char *name = NULL,
115 SbBool buildInsideParent = TRUE,
116 const char *dir = NULL);
121
128 SoXtMaterialListCB *f,
129 void *userData = NULL)
130 { callbackList->addCallback((SoCallbackListCB *) f, userData);}
131
136 SoXtMaterialListCB *f,
137 void *userData = NULL)
138 { callbackList->removeCallback((SoCallbackListCB *) f, userData); }
139
140 private:
141
142 // This constructor takes a boolean whether to build the widget now.
143 // Subclasses can pass FALSE, then call SoXtMaterialList::buildWidget()
144 // when they are ready for it to be built.
145 SoEXTENDER
147 SoWidget parent,
148 const char *name,
149 SbBool buildInsideParent,
150 const char *dir,
151 SbBool buildNow);
152
153 // redefine these
154 virtual SbString getDefaultWidgetName() const;
155 virtual SbString getDefaultTitle() const;
156 virtual SbString getDefaultIconTitle() const;
157
158 // Build routines
159 SoWidget buildWidget(SoWidget parent);
160 SoWidget buildPulldownMenu(SoWidget parent);
161
162 private:
163 char *materialDir; // the parent directory of materials
164 SoCallbackList *callbackList; // funcs to invoke when a mtl is picked
165 SbPList menuItems; // Widgets
166 SbPList mtlPalettes; // list of palettes
167 SbPList palette; // the current palette
168 int curPalette; // index into mtlPalettes
169 SoWidget mtlList; // the Motif list of materials
170
171 // Fill up the mtlList with a new palette
172 void fillInMaterialList();
173 SbBool setupPalettes();
174
175 // Callback routines from Xt/Motif
176 static void menuPick(SoWidget, int, XtPointer);
177 static void listPick(SoWidget, SoXtMaterialList *, XtPointer);
178
179 // this is called by both constructors
180 void constructorCommon(const char *dir, SbBool buildNow);
181
182};
183
184#endif // _SO_XT_MATERIAL_LIST_H_
185
186#endif // _WIN32
187
188
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
Abstract base class for all Open Inventor components.
Component which lets you edit a material interactively.
SoXtMaterialList(SoWidget parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE, const char *dir=NULL)
The constructor is passed a directory name which serves as the home directory for the material palett...
void SoXtMaterialListCB(void *userData, const SoMaterial *mtl)
~SoXtMaterialList()
Destructor.
void removeCallback(SoXtMaterialListCB *f, void *userData=NULL)
Removes callback.
void addCallback(SoXtMaterialListCB *f, void *userData=NULL)
Registers functions that will be called whenever the user chooses a new material from the list.
int SbBool
Boolean type.
Definition SbBase.h:87
void * XtPointer
Definition SoQtDef.h:122