Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtprintinfo / libUI / MotifUI / IconObj.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: IconObj.h /main/3 1995/11/06 09:41:52 rswiston $ */
24 /*                                                                      *
25  * (c) Copyright 1993, 1994 Hewlett-Packard Company                     *
26  * (c) Copyright 1993, 1994 International Business Machines Corp.       *
27  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.                      *
28  * (c) Copyright 1993, 1994 Novell, Inc.                                *
29  */
30
31 #ifndef ICONOBJ_H
32 #define ICONOBJ_H
33
34 #include "MotifUI.h"
35
36 typedef struct
37 {
38    int name_width;
39    int n_fields;
40    int field_spacing;
41    char **fields;
42    int *fields_widths;
43    LabelType *alignments;
44    boolean *draw_fields;
45    boolean *selected;
46    boolean *active;
47 } IconFieldsRec, *IconFields, **IconFieldsList;
48
49 typedef enum {
50    NORTHWEST_GRAVITY, 
51    NORTH_GRAVITY, 
52    NORTHEAST_GRAVITY, 
53    WEST_GRAVITY, 
54    CENTER_GRAVITY, 
55    EAST_GRAVITY, 
56    SOUTHWEST_GRAVITY, 
57    SOUTH_GRAVITY, 
58    SOUTHEAST_GRAVITY
59 } StateGravity;
60
61 class IconObj : public MotifUI {
62
63  private:
64    
65    static void SingleClickCB(Widget, XtPointer, XtPointer);
66    static void DoubleClickCB(Widget, XtPointer, XtPointer);
67
68    char *_details;
69    char *_iconFile;
70    char *_topString;
71    char *_bottomString;
72    IconStyle _previous_style;
73    Pixmap _smallPixmap;
74    Pixmap _smallMask;
75    Pixmap _largePixmap;
76    Pixmap _largeMask;
77    IconFields fields;
78    StateGravity _state_gravity;
79    char *_stateIconName;
80
81    void SetDetail();
82    void SetStateIconFile(IconStyle);
83    void CreateIconObj(MotifUI *, char *, char *, char *, char *, char *,
84                       char *, IconFields);
85
86  protected:
87    
88    // Override SetView and SetOpen for icon
89    virtual boolean SetIcon(IconStyle); 
90    virtual boolean SetOpen(boolean); 
91    virtual boolean SetName(char *); 
92
93
94  public:
95
96    IconObj(MotifUI *parent,
97            char *name,
98            char *icon,
99            char *details = NULL,
100            char *topString = NULL,
101            char *bottomString = NULL,
102            IconFields fields = NULL);
103
104    IconObj(char *category,
105            MotifUI *parent,
106            char *name,
107            char *icon,
108            char *details = NULL,
109            char *topString = NULL,
110            char *bottomString = NULL,
111            IconFields fields = NULL);
112
113    ~IconObj();
114
115    void Details(char *);                           // Set details
116    char *Details() { return _details; }            // Access details
117    void TopString(char *);                         // Set top string
118    char *TopString() { return _topString; }        // Access top string
119    void BottomString(char *);                      // Set bottom string
120    char *BottomString() { return _bottomString; }  // Access bottom string
121    void IconFile(char *);                          // Set top string
122    char *IconFile() { return _iconFile; }          // Access top string
123    void StateIconFile(char *);                     // Set top string
124    char *StateIconFile() { return _stateIconName; }// Access top string
125    void StateIconGravity(StateGravity);
126    StateGravity StateIconGravity() { return _state_gravity; }
127    void Field(int index, char *string, int width, boolean visible = true,
128               boolean active = true);
129    void Field(int index, char **string, int *width, boolean *visible,
130               boolean *active);
131    int NumberFields();
132
133    const UI_Class UIClass()           { return ICON; }
134    const char *const UIClassName()    { return "IconObj"; }
135
136 };
137
138 #endif /* ICONOBJ_H */