2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: vglogo.c /main/4 1995/10/27 16:17:33 rswiston $ */
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. *
30 /************************************<+>*************************************
31 ****************************************************************************
35 ** Project: HP Visual User Environment (DT)
37 ** Description: Routines to create the Corporate logo
41 ** (c) Copyright 1987, 1988, 1989 by Hewlett-Packard Company
45 ****************************************************************************
46 ************************************<+>*************************************/
49 /***************************************************************************
53 ***************************************************************************/
56 #include <X11/Intrinsic.h>
57 #include <X11/StringDefs.h>
59 #include <Xm/DrawingA.h>
62 #include <Dt/IconFile.h>
66 #include "vglogo.h" /* pixmap and bitmap for default Login logo */
73 /***************************************************************************
75 * External declarations
77 ***************************************************************************/
80 /***************************************************************************
82 * Procedure declarations
84 ***************************************************************************/
87 /***************************************************************************
91 ***************************************************************************/
93 LogoInfo logoInfo; /* logo resources */
95 static XtResource logoResources[] = {
96 {"bitmapFile", "BitmapFile",
97 XtRString, sizeof(char *), XtOffset(LogoInfoPtr, bitmapFile),
98 XtRString, "Dtlogo" },
102 /***************************************************************************
108 * Widgets: logo, logo_pixmap
109 ***************************************************************************/
116 char *logoFile; /* name of logo bitmap file */
118 Pixmap logoPixmap; /* logo pixmap */
119 char *logoName; /* logo name */
121 int logoWidth, logoHeight; /* width, height of logo */
122 Pixel fg, bg; /* foreground, background colors */
124 Pixmap dsPixmap; /* drop shadow pixmap */
125 int dsWidth, dsHeight; /* width, height of drop shadow */
127 Pixmap pixmap; /* scratch pixmap */
128 GC gc; /* scratch GC */
129 XGCValues gcval; /* GC values */
130 unsigned int width, height; /* width, height of bitmap */
131 int x_hot, y_hot; /* bitmap hot spot (if any)*/
135 * get the user's logo preferences...
138 XtGetSubresources(table, &logoInfo, "logo", "Logo",
139 logoResources, XtNumber(logoResources), NULL, 0);
142 * create the logo frame...
146 XtSetArg(argt[i], XmNshadowType, XmSHADOW_OUT); i++;
147 XtSetArg(argt[i], XmNshadowThickness, 2); i++;
148 XtSetArg(argt[i], XmNtopAttachment, XmATTACH_FORM); i++;
149 XtSetArg(argt[i], XmNtopOffset, 15); i++;
150 XtSetArg(argt[i], XmNbottomAttachment, XmATTACH_FORM); i++;
151 XtSetArg(argt[i], XmNbottomOffset, 15); i++;
152 XtSetArg(argt[i], XmNrightAttachment, XmATTACH_FORM); i++;
153 XtSetArg(argt[i], XmNrightOffset, 15); i++;
154 XtSetArg(argt[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
155 XtSetArg(argt[i], XmNleftWidget, matteFrame); i++;
156 logo1 = XmCreateFrame(matte, "logo", argt, i);
157 XtManageChild(logo1);
161 * get the colors of the frame...
164 XtSetArg(argt[0], XmNforeground, &fg);
165 XtSetArg(argt[1], XmNbackground, &bg);
166 XtGetValues(logo1, argt, 2);
170 * create the logo pixmap...
173 logoFile = logoInfo.bitmapFile;
175 #if defined (_AIX) && defined (_POWER)
177 * On AIX4 we have a Dtlogo.s.pm
179 # define LOGO_TYPE (LOWRES ? DtSMALL : 0)
184 logoName = _DtGetIconFileName(DefaultScreenOfDisplay(dpyinfo.dpy),
185 logoFile, NULL, NULL, LOGO_TYPE);
187 if (logoName == NULL)
190 ReadCatalog(MC_LOG_SET,MC_LOG_NO_LOGOBIT,MC_DEF_LOG_NO_LOGOBIT),
197 * create the logo control...
201 XtSetArg(argt[i], XmNmarginWidth, 0); i++;
202 XtSetArg(argt[i], XmNmarginHeight, 0); i++;
203 XtSetArg(argt[i], XmNhighlightThickness, 0); i++;
204 XtSetArg(argt[i], XmNbehavior, XmICON_LABEL); i++;
205 XtSetArg(argt[i], XmNfillMode, XmFILL_TRANSPARENT); i++;
206 XtSetArg(argt[i], XmNstring, NULL); i++;
207 if (logoName != NULL)
209 XtSetArg(argt[i], XmNpixmapForeground, fg); i++;
210 XtSetArg(argt[i], XmNpixmapBackground, bg); i++;
211 XtSetArg(argt[i], XmNimageName, logoName); i++;
216 * use built-in logo if no logo was not found
219 logoPixmap = XCreatePixmapFromBitmapData(
220 dpyinfo.dpy, /* display */
221 dpyinfo.root, /* drawable */
222 (char *)dt_logo_bits, /* data */
223 dt_logo_width, /* width */
224 dt_logo_height, /* height */
227 dpyinfo.depth); /* depth */
229 logoWidth = dt_logo_width;
230 logoHeight = dt_logo_height;
232 XtSetArg(argt[i], XmNpixmap, logoPixmap); i++;
235 logo_pixmap = _DtCreateIcon(logo1, "logo_pixmap", argt, i);
236 XtManageChild(logo_pixmap);
238 XtSetArg(argt[0], XmNheight, 245); /* keeps dialog a consistent height and width */
239 XtSetArg(argt[1], XmNwidth, 245);
240 XtSetValues(logo1, argt, 2);