2 -- Copyright (c) 1991-1999 Matra Datavision
3 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
5 -- The content of this file is subject to the Open CASCADE Technology Public
6 -- License Version 6.5 (the "License"). You may not use the content of this file
7 -- except in compliance with the License. Please obtain a copy of the License
8 -- at http://www.opencascade.org and read it completely before using this file.
10 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 -- The Original Code and all software distributed under the License is
14 -- distributed on an "AS IS" basis, without warranty of any kind, and the
15 -- Initial Developer hereby disclaims all such warranties, including without
16 -- limitation, any warranties of merchantability, fitness for a particular
17 -- purpose or non-infringement. Please see the License for the specific terms
18 -- and conditions governing the rights and limitations under the License.
21 class IconBox from Xw inherits Window from Xw
25 ---Purpose: This class defines a X11 IconBox
26 -- Warning: The IconBox is not visible at the creation time .
27 -- To show the Icon Box use the method Show () .
28 -- In this case the Icon Box appears at the DSU position
29 -- specified given in [0,1] space .
30 -- The size of the Icon Box grows depending of the number
31 -- of the Icons loaded inside .
37 NameOfColor from Quantity,
38 GraphicDevice from Xw,
45 WindowDefinitionError from Aspect,
46 WindowError from Aspect
50 Create ( Device : GraphicDevice from Xw ;
51 Name : CString from Standard ;
52 Xc : Real from Standard = 0.5 ;
53 Yc : Real from Standard = 0.5 ;
54 BackColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY;
55 aQuality : WindowQuality from Xw = Xw_WQ_SAMEQUALITY)
56 returns mutable IconBox from Xw
58 ---Purpose: Creates a IconBox n Preferred PseudoColor Visual
59 -- defined by his Center in DSU and connects it to the
60 -- X server at the first call depending of the GraphicDevice
62 -- ALL Icons are loaded from the Icon File Directory Name :
63 -- "[$SYMBOL]xxxxxxx[.ifd]"
64 -- Warning: Raises if the Position is out of the Screen Space
65 -- or the Icon File Directory Name don't exist
66 raises WindowDefinitionError from Aspect ;
68 ---------------------------------------------------
69 -- Category: Methods to modify the class definition
70 ---------------------------------------------------
72 LoadIcons ( me : mutable ; Name : CString from Standard )
73 returns Integer from Standard is static;
75 ---Purpose: Loads Icon Box from an Other Icon File Directory Name
76 -- and returns the loaded icons number.
77 -- Warning: The Icons previously loaded are NOT cleared .
78 ---Category: Methods to modify the class definition
80 Show ( me ) is static;
82 ---Purpose: Shows Icon Box to the screen
83 -- Warning: The Icon Box is displayed at the centered position
84 -- specified at the creation time and the size depend
85 -- of the Icon number really loaded inside .
87 UnloadIcons ( me : mutable ; Name : CString from Standard )
88 returns Integer from Standard is static;
90 ---Purpose: Unloads All previously loaded Icons in the IconBox
91 -- and returns the unloaded icons number.
92 ---Category: methods to modify the class definition
94 Destroy ( me : mutable) is redefined ;
96 ---Purpose: Destroies the IconBox
98 ---Category: Methods to modify the class definition
100 AddIcon ( me : mutable ; W : Window from Xw ;
101 Name : CString from Standard;
102 aWidth : Integer from Standard = 0;
103 aHeight : Integer from Standard = 0) is static;
105 ---Purpose: Adds an Icon of Size aWidth,aHeight given in PIXEL
106 -- to the Icon Box from a FULL Existing Window
107 -- NOTE that if aWidth or aHeight is 0 the default icon size is taken.
108 ---Category: methods to modify the class definition
110 SaveIcons ( me ) returns Integer from Standard is static;
112 ---Purpose: Saves all new created Icons as iconname.xwd file in the user
113 -- directory and returns the saved icons number.
115 ----------------------------
116 -- Category: Inquire methods
117 ----------------------------
120 returns Integer from Standard is static;
122 ---Purpose: Returns the Number of Icons loaded in the Icon Box .
124 IconName ( me ; Index : Integer from Standard )
125 returns CString from Standard
127 ---Purpose: Returns the Name of the N ime Icon
128 -- Warning: Raises if Index if out of range depending of the
129 -- Number of Loaded Icons .
130 raises WindowError from Aspect is static;
132 IconSize ( me ; Name : CString from Standard ;
133 Width, Height : out Integer from Standard )
134 returns Boolean from Standard is static;
136 ---Purpose: Returns the Pixmap Size attached to the Icon Name
137 -- Warning: May return FALSE if Icon doesn't exist in the IconBox .
138 ---Category: Inquire methods
140 IconPixmap ( me ; Name : CString from Standard )
141 returns Handle from Aspect is static;
143 ---Purpose: Returns the Pixmap attached to the Icon Name
144 -- Warning: May return 0 if Icon doesn't exist in the IconBox .
145 ---Category: Inquire methods
147 IconPixmap ( me ; Name : CString from Standard ;
148 Width, Height : Integer from Standard )
149 returns Handle from Aspect is static;
151 ---Purpose: Returns the Centered part of the Pixmap of required Size
152 -- attached to the Icon Name
153 -- Warning: May return 0 if Icon doesn't exist in the IconBox .
154 ---Category: Inquire methods
158 MyNumberOfIcons : Integer from Standard ;