Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Utils/Styling/ImagePalette.cs @ 3757

Last change on this file since 3757 was 2768, checked in by mkommend, 14 years ago

added solution folders and sources for the netron library (ticket #867)

File size: 17.1 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Windows.Forms;
5using System.Drawing;
6using System.Reflection;
7using System.IO;
8
9namespace Netron.Diagramming.Core
10{
11    public class ImagePalette
12    {
13        public const string PropertiesFileName =
14            "PropertiesHS.png";
15
16        #region Fields
17
18        const string mNameSpace = "Netron.Diagramming.Core";
19
20        static Image mAlignObjectsBottom =
21            GetImage("AlignObjectsBottomHS.png");
22
23        static Image mAlignObjectsCenteredHorizontal =
24            GetImage("AlignObjectsCenteredHorizontalHS.png");
25
26        static Image mAlignObjectsCenteredVertical =
27            GetImage("AlignObjectsCenteredVerticalHS.png");
28
29        static Image mAlignObjectsLeft = GetImage("AlignObjectsLeftHS.png");
30
31        static Image mAlignObjectsRight = GetImage("AlignObjectsRightHS.png");
32
33        static Image mAlignObjectsTop = GetImage("AlignObjectsTopHS.png");
34
35        static Image mArrow = GetImage("StandardArrow.png");
36
37        static Image mBringForward = GetImage("BringForwardHS.png");
38
39        static Image mBringToFront = GetImage("BringToFrontHS.png");
40
41        static Image mBucketFill = GetImage("BucketFill.bmp", Color.Magenta);
42
43        static Image mClassShape = GetImage("ClassShape.png");
44
45        static Image mCenterAlignment = GetImage(
46            "CenterAlignment.bmp",
47            Color.Silver);
48
49        static Image mConnection = GetImage("Connection.png");
50
51        static Image mDrawEllipse = GetImage("DrawEllipse.png");
52
53        static Image mDrawRectangle = GetImage("DrawRectangle.png");
54
55        static Image mFont = GetImage("FontDialogHS.png");
56
57        static Image mGroup = GetImage("Group.png");
58       
59        static Image mLeftAlignment = GetImage(
60            "LeftAlignment.bmp",
61            Color.Silver);
62
63        static Image mMoveConnector = GetImage("ConnectorMover.png");
64
65        static Image mNewDocumnet = GetImage("NewDocumentHS.png");
66
67        static Image mOutline = GetImage(
68            "PenDraw.bmp",
69            Color.Magenta);
70
71        static Image mProperties = GetImage("PropertiesHS.png");
72
73        static Image mRedo = GetImage("Edit_RedoHS.png");
74
75        static Image mRightAlignment = GetImage(
76            "RightAlignment.bmp",
77            Color.Silver);
78
79        static Image mSendBackwards = GetImage("SendBackwardHS.png");
80
81        static Image mSendToBack = GetImage("SendToBackHS.png");
82
83        static Image mShortcut = GetImage("Shortcut.bmp");
84
85        static Image mUndo = GetImage("Edit_UndoHS.png");
86
87        static Image mUngroup = GetImage("Ungroup.png");
88
89        #endregion
90
91        #region Properties
92
93        // ------------------------------------------------------------------
94        /// <summary>
95        /// Gets the image that represents aligning the bottom edges of
96        /// objects.
97        /// </summary>
98        // ------------------------------------------------------------------
99        public static Image AlignObjectsBottom
100        {
101            get
102            {
103                return mAlignObjectsBottom;
104            }
105        }
106
107        // ------------------------------------------------------------------
108        /// <summary>
109        /// Gets the image that represents horizontally aligning the center
110        /// of objects.
111        /// </summary>
112        // ------------------------------------------------------------------
113        public static Image AlignObjectsCenteredHorizontal
114        {
115            get
116            {
117                return mAlignObjectsCenteredHorizontal;
118            }
119        }
120
121        // ------------------------------------------------------------------
122        /// <summary>
123        /// Gets the image that represents vertically aligning the center
124        /// of objects.
125        /// </summary>
126        // ------------------------------------------------------------------
127        public static Image AlignObjectsCenteredVertical
128        {
129            get
130            {
131                return mAlignObjectsCenteredVertical;
132            }
133        }
134
135        // ------------------------------------------------------------------
136        /// <summary>
137        /// Gets the image that represents aligning the left edge of objects.
138        /// </summary>
139        // ------------------------------------------------------------------
140        public static Image AlignObjectsLeft
141        {
142            get
143            {
144                return mAlignObjectsLeft;
145            }
146        }
147
148        // ------------------------------------------------------------------
149        /// <summary>
150        /// Gets the image that represents aligning the right edge of objects.
151        /// </summary>
152        // ------------------------------------------------------------------
153        public static Image AlignObjectsRight
154        {
155            get
156            {
157                return mAlignObjectsRight;
158            }
159        }
160
161        // ------------------------------------------------------------------
162        /// <summary>
163        /// Gets the image that represents aligning the top edge of objects.
164        /// </summary>
165        // ------------------------------------------------------------------
166        public static Image AlignObjectsTop
167        {
168            get
169            {
170                return mAlignObjectsTop;
171            }
172        }
173
174        // ------------------------------------------------------------------
175        /// <summary>
176        /// Gets the image that represents a arrow (standard cursor arrow).
177        /// </summary>
178        // ------------------------------------------------------------------
179        public static Image Arrow
180        {
181            get
182            {
183                return mArrow;
184            }
185        }
186
187        // ------------------------------------------------------------------
188        /// <summary>
189        /// Gets the image that represents bringing an object all the way to
190        /// to the front in the z-order.
191        /// </summary>
192        // ------------------------------------------------------------------
193        public static Image BringToFront
194        {
195            get
196            {
197                return mBringToFront;
198            }
199        }
200
201        // ------------------------------------------------------------------
202        /// <summary>
203        /// Gets the image that represents bring an object forward in the
204        /// z-order.
205        /// </summary>
206        // ------------------------------------------------------------------
207        public static Image BringForward
208        {
209            get
210            {
211                return mBringForward;
212            }
213        }
214
215        // ------------------------------------------------------------------
216        /// <summary>
217        /// Gets an image of a bucket of color - used to illustrate fill
218        /// color.
219        /// </summary>
220        // ------------------------------------------------------------------
221        public static Image BucketFill
222        {
223            get
224            {
225                return mBucketFill;
226            }
227        }
228
229        // ------------------------------------------------------------------
230        /// <summary>
231        /// Gets the image that represents text being centered.
232        /// </summary>
233        // ------------------------------------------------------------------
234        public static Image CenterAlignment
235        {
236            get
237            {
238                return mCenterAlignment;
239            }
240        }
241
242        // ------------------------------------------------------------------
243        /// <summary>
244        /// Gets the class shape image.
245        /// </summary>
246        // ------------------------------------------------------------------
247        public static Image ClassShape
248        {
249            get
250            {
251                return mClassShape;
252            }
253        }
254
255        // ------------------------------------------------------------------
256        /// <summary>
257        /// Gets the image that represents a connection line.
258        /// </summary>
259        // ------------------------------------------------------------------
260        public static Image Connection
261        {
262            get
263            {
264                return mConnection;
265            }
266        }
267
268        // ------------------------------------------------------------------
269        /// <summary>
270        /// Gets the image that represents an ellipse.
271        /// </summary>
272        // ------------------------------------------------------------------
273        public static Image DrawEllipse
274        {
275            get
276            {
277                return mDrawEllipse;
278            }
279        }
280
281        // ------------------------------------------------------------------
282        /// <summary>
283        /// Gets the image that represents a rectangle.
284        /// </summary>
285        // ------------------------------------------------------------------
286        public static Image DrawRectangle
287        {
288            get
289            {
290                return mDrawRectangle;
291            }
292        }
293
294        // ------------------------------------------------------------------
295        /// <summary>
296        /// Gets the image that represents font.
297        /// </summary>
298        // ------------------------------------------------------------------
299        public static Image Font
300        {
301            get
302            {
303                return mFont;
304            }
305        }
306
307        // ------------------------------------------------------------------
308        /// <summary>
309        /// Gets the image that represents grouping objects together..
310        /// </summary>
311        // ------------------------------------------------------------------
312        public static Image Group
313        {
314            get
315            {
316                return mGroup;
317            }
318        }
319
320        // ------------------------------------------------------------------
321        /// <summary>
322        /// Gets the image that represents text being aligned to the left.
323        /// </summary>
324        // ------------------------------------------------------------------
325        public static Image LeftAlignment
326        {
327            get
328            {
329                return mLeftAlignment;
330            }
331        }
332
333        // ------------------------------------------------------------------
334        /// <summary>
335        /// Gets the image that represents a connection line.
336        /// </summary>
337        // ------------------------------------------------------------------
338        public static Image MoveConnector
339        {
340            get
341            {
342                return mMoveConnector;
343            }
344        }
345
346        // ------------------------------------------------------------------
347        /// <summary>
348        /// Gets the image that represents creating a new diagram.
349        /// </summary>
350        // ------------------------------------------------------------------
351        public static Image NewDocument
352        {
353            get
354            {
355                return mNewDocumnet;
356            }
357        }
358
359        // ------------------------------------------------------------------
360        /// <summary>
361        /// Gets the image that represents a pen drawing a line with a
362        /// color - used to illustrate line color.
363        /// </summary>
364        // ------------------------------------------------------------------
365        public static Image Outline
366        {
367            get
368            {
369                return mOutline;
370            }
371        }
372
373        // ------------------------------------------------------------------
374        /// <summary>
375        /// Gets the image that represents properties.
376        /// </summary>
377        // ------------------------------------------------------------------
378        public static Image Properties
379        {
380            get
381            {
382                return mProperties;
383            }
384        }
385
386        // ------------------------------------------------------------------
387        /// <summary>
388        /// Gets the image that represents redoing a command.
389        /// </summary>
390        // ------------------------------------------------------------------
391        public static Image Redo
392        {
393            get
394            {
395                return mRedo;
396            }
397        }
398
399        // ------------------------------------------------------------------
400        /// <summary>
401        /// Gets the image that represents text being aligned to the right.
402        /// </summary>
403        // ------------------------------------------------------------------
404        public static Image RightAlignment
405        {
406            get
407            {
408                return mRightAlignment;
409            }
410        }
411
412        // ------------------------------------------------------------------
413        /// <summary>
414        /// Gets the image that represents sending an object back in the
415        /// z-order.
416        /// </summary>
417        // ------------------------------------------------------------------
418        public static Image SendBackwards
419        {
420            get
421            {
422                return mSendBackwards;
423            }
424        }
425
426        // ------------------------------------------------------------------
427        /// <summary>
428        /// Gets the image that represents sending an object all the way back
429        /// in the z-order.
430        /// </summary>
431        // ------------------------------------------------------------------
432        public static Image SendToBack
433        {
434            get
435            {
436                return mSendToBack;
437            }
438        }
439
440        // ------------------------------------------------------------------
441        /// <summary>
442        /// Gets the image that represents a shortcut to a file or resource.
443        /// </summary>
444        // ------------------------------------------------------------------
445        public static Image Shortcut
446        {
447            get
448            {
449                return mShortcut;
450            }
451        }
452
453        // ------------------------------------------------------------------
454        /// <summary>
455        /// Gets the image that represents undoing a command.
456        /// </summary>
457        // ------------------------------------------------------------------
458        public static Image Undo
459        {
460            get
461            {
462                return mUndo;
463            }
464        }
465
466        // ------------------------------------------------------------------
467        /// <summary>
468        /// Gets the image that represents ungrouping objects.
469        /// </summary>
470        // ------------------------------------------------------------------
471        public static Image Ungroup
472        {
473            get
474            {
475                return mUngroup;
476            }
477        }
478
479        #endregion
480
481        #region Helpers
482
483        // ------------------------------------------------------------------
484        /// <summary>
485        /// Gets the image from the embedded resources for the specified
486        /// filename and sets the image's transparent color to the one
487        /// specified..
488        /// </summary>
489        /// <param name="filename">string: The filename from the embedded
490        /// resources.</param>
491        /// <param name="transparentColor">Color: The transparent color
492        /// for the image.</param>
493        /// <returns>Image</returns>
494        // ------------------------------------------------------------------
495        static Image GetImage(string filename, Color transparentColor)
496        {
497            Bitmap bmp = GetImage(filename);
498            bmp.MakeTransparent(transparentColor);
499            return bmp;
500        }
501
502        // ------------------------------------------------------------------
503        /// <summary>
504        /// Gets the image from the embedded resources for the specified
505        /// filename.
506        /// </summary>
507        /// <param name="filename">string: The filename from the embedded
508        /// resources.</param>
509        /// <returns>Image</returns>
510        // ------------------------------------------------------------------
511        static Bitmap GetImage(string filename)
512        {
513            return new Bitmap(GetStream(filename));
514        }
515
516        // ------------------------------------------------------------------
517        /// <summary>
518        /// Returns a Stream from the manifest resources for the specified
519        /// filename.
520        /// </summary>
521        /// <param name="filename">string</param>
522        /// <returns>Stream</returns>
523        // ------------------------------------------------------------------
524        public static Stream GetStream(string filename)
525        {
526            return Assembly.GetExecutingAssembly().GetManifestResourceStream(
527                mNameSpace +
528                ".Resources." +
529                filename);
530        }
531
532        #endregion
533    }
534}
Note: See TracBrowser for help on using the repository browser.