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 /* $TOG: DtDetailsLabel.C /main/3 1998/07/24 16:11:46 mgreess $ */
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. *
31 #include "DtDetailsLabel.h"
35 #include "dtprintinfomsg.h"
37 boolean DtDetailsLabel::first_time = true;
38 Pixmap DtDetailsLabel::blank_pixmap;
39 Pixmap DtDetailsLabel::blank_mask;
40 XmString DtDetailsLabel::bottom_label[2];
42 DtDetailsLabel::DtDetailsLabel(MotifUI *parent)
43 : MotifUI(parent, "Details", NULL)
47 char *label = new char[strlen(MESSAGE(OwnerL)) + strlen(MESSAGE(SizeL)) +
48 strlen(MESSAGE(TimeL)) + strlen(MESSAGE(DateL)) +
49 strlen(MESSAGE(JobNumberL)) + 5];
50 sprintf(label, "%s\n%s\n%s\n%s", MESSAGE(SizeL),
51 MESSAGE(JobNumberL), MESSAGE(TimeL), MESSAGE(DateL));
52 bottom_label[0] = StringCreate(label);
53 sprintf(label, "%s\n%s\n%s\n%s\n%s",
54 MESSAGE(OwnerL), MESSAGE(SizeL),
55 MESSAGE(JobNumberL), MESSAGE(TimeL), MESSAGE(DateL));
56 bottom_label[1] = StringCreate(label);
59 XtVaGetValues(parent->BaseWidget(),
60 XmNhighlightThickness, &highlight, NULL);
61 int height = 21 + 2 * highlight;
62 blank_pixmap = XCreatePixmap(display, root, 1, height, depth);
63 blank_mask = XCreatePixmap(display, root, 1, height, 1);
64 GC gc_mask = XCreateGC(display, blank_mask, 0, NULL);
65 XSetForeground(display, gc_mask, 0);
66 XFillRectangle(display, blank_mask, gc_mask, 0, 0, 1, height);
68 XFreeGC(display, gc_mask);
73 XmString top_string = StringCreate(MESSAGE(Position1L));
74 XmString label_string = StringCreate(MESSAGE(JobNameL));
75 Widget p = XtParent(parent->BaseWidget());
77 XtVaGetValues(p, XmNbackground, &bg, NULL);
78 _w = XtVaCreateManagedWidget("DtDetailsLabel", iconWidgetClass, p,
79 GuiNsuperNode, parent->BaseWidget(),
80 XmNalignment, XmALIGNMENT_END,
81 XmNtraversalOn, False,
83 GuiNiconMarginThickness, 0,
84 XmNhighlightThickness, 0,
85 XmNlabelString, label_string,
86 GuiNtopLabelString, top_string,
87 XmNlabelPixmap, blank_pixmap,
88 GuiNiconMask, blank_mask,
89 GuiNpixmapPlacement, GuiPIXMAP_LEFT,
91 StringFree(top_string);
92 StringFree(label_string);
93 XtAddCallback(_w, GuiNsingleClickCallback, &DtDetailsLabel::ClickCB, NULL);
94 XtAddCallback(_w, GuiNdoubleClickCallback, &DtDetailsLabel::ClickCB, NULL);
97 void DtDetailsLabel::Update(boolean show_only_my_jobs)
100 if (show_only_my_jobs)
102 XtVaSetValues(_w, GuiNbottomLabelString, bottom_label[i], NULL);
105 void DtDetailsLabel::ClickCB(Widget w, XtPointer, XtPointer)
107 XtVaSetValues(w, GuiNselected, False, NULL);