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 librararies 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),
99 XtRString, "DECDtlogo" },
101 XtRString, "Dtlogo" },
106 /***************************************************************************
112 * Widgets: logo, logo_pixmap
113 ***************************************************************************/
120 char *logoFile; /* name of logo bitmap file */
122 Pixmap logoPixmap; /* logo pixmap */
123 char *logoName; /* logo name */
125 int logoWidth, logoHeight; /* width, height of logo */
126 Pixel fg, bg; /* foreground, background colors */
128 Pixmap dsPixmap; /* drop shadow pixmap */
129 int dsWidth, dsHeight; /* width, height of drop shadow */
131 Pixmap pixmap; /* scratch pixmap */
132 GC gc; /* scratch GC */
133 XGCValues gcval; /* GC values */
134 unsigned int width, height; /* width, height of bitmap */
135 int x_hot, y_hot; /* bitmap hot spot (if any)*/
139 * get the user's logo preferences...
142 XtGetSubresources(table, &logoInfo, "logo", "Logo",
143 logoResources, XtNumber(logoResources), NULL, 0);
146 * create the logo frame...
150 XtSetArg(argt[i], XmNshadowType, XmSHADOW_OUT); i++;
151 XtSetArg(argt[i], XmNshadowThickness, 2); i++;
152 XtSetArg(argt[i], XmNtopAttachment, XmATTACH_FORM); i++;
153 XtSetArg(argt[i], XmNtopOffset, 15); i++;
154 XtSetArg(argt[i], XmNbottomAttachment, XmATTACH_FORM); i++;
155 XtSetArg(argt[i], XmNbottomOffset, 15); i++;
156 XtSetArg(argt[i], XmNrightAttachment, XmATTACH_FORM); i++;
157 XtSetArg(argt[i], XmNrightOffset, 15); i++;
158 XtSetArg(argt[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
159 XtSetArg(argt[i], XmNleftWidget, matteFrame); i++;
160 logo1 = XmCreateFrame(matte, "logo", argt, i);
161 XtManageChild(logo1);
165 * get the colors of the frame...
168 XtSetArg(argt[0], XmNforeground, &fg);
169 XtSetArg(argt[1], XmNbackground, &bg);
170 XtGetValues(logo1, argt, 2);
174 * create the logo pixmap...
177 logoFile = logoInfo.bitmapFile;
179 #if defined (_AIX) && defined (_POWER)
181 * On AIX4 we have a Dtlogo.s.pm
183 # define LOGO_TYPE (LOWRES ? DtSMALL : 0)
188 logoName = _DtGetIconFileName(DefaultScreenOfDisplay(dpyinfo.dpy),
189 logoFile, NULL, NULL, LOGO_TYPE);
191 if (logoName == NULL)
194 ReadCatalog(MC_LOG_SET,MC_LOG_NO_LOGOBIT,MC_DEF_LOG_NO_LOGOBIT),
201 * create the logo control...
205 XtSetArg(argt[i], XmNmarginWidth, 0); i++;
206 XtSetArg(argt[i], XmNmarginHeight, 0); i++;
207 XtSetArg(argt[i], XmNhighlightThickness, 0); i++;
208 XtSetArg(argt[i], XmNbehavior, XmICON_LABEL); i++;
209 XtSetArg(argt[i], XmNfillMode, XmFILL_TRANSPARENT); i++;
210 XtSetArg(argt[i], XmNstring, NULL); i++;
211 if (logoName != NULL)
213 XtSetArg(argt[i], XmNpixmapForeground, fg); i++;
214 XtSetArg(argt[i], XmNpixmapBackground, bg); i++;
215 XtSetArg(argt[i], XmNimageName, logoName); i++;
220 * use built-in logo if no logo was not found
223 logoPixmap = XCreatePixmapFromBitmapData(
224 dpyinfo.dpy, /* display */
225 dpyinfo.root, /* drawable */
226 (char *)dt_logo_bits, /* data */
227 dt_logo_width, /* width */
228 dt_logo_height, /* height */
231 dpyinfo.depth); /* depth */
233 logoWidth = dt_logo_width;
234 logoHeight = dt_logo_height;
236 XtSetArg(argt[i], XmNpixmap, logoPixmap); i++;
239 logo_pixmap = _DtCreateIcon(logo1, "logo_pixmap", argt, i);
240 XtManageChild(logo_pixmap);
242 XtSetArg(argt[0], XmNheight, 245); /* keeps dialog a consistent height and width */
243 XtSetArg(argt[1], XmNwidth, 245);
244 XtSetValues(logo1, argt, 2);