1 /* $TOG: DtDetailsLabel.C /main/3 1998/07/24 16:11:46 mgreess $ */
3 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
4 * (c) Copyright 1993, 1994 International Business Machines Corp. *
5 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
6 * (c) Copyright 1993, 1994 Novell, Inc. *
9 #include "DtDetailsLabel.h"
13 #include "dtprintinfomsg.h"
15 boolean DtDetailsLabel::first_time = true;
16 Pixmap DtDetailsLabel::blank_pixmap;
17 Pixmap DtDetailsLabel::blank_mask;
18 XmString DtDetailsLabel::bottom_label[2];
20 DtDetailsLabel::DtDetailsLabel(MotifUI *parent)
21 : MotifUI(parent, "Details", NULL)
25 char *label = new char[strlen(MESSAGE(OwnerL)) + strlen(MESSAGE(SizeL)) +
26 strlen(MESSAGE(TimeL)) + strlen(MESSAGE(DateL)) +
27 strlen(MESSAGE(JobNumberL)) + 5];
28 sprintf(label, "%s\n%s\n%s\n%s", MESSAGE(SizeL),
29 MESSAGE(JobNumberL), MESSAGE(TimeL), MESSAGE(DateL));
30 bottom_label[0] = StringCreate(label);
31 sprintf(label, "%s\n%s\n%s\n%s\n%s",
32 MESSAGE(OwnerL), MESSAGE(SizeL),
33 MESSAGE(JobNumberL), MESSAGE(TimeL), MESSAGE(DateL));
34 bottom_label[1] = StringCreate(label);
37 XtVaGetValues(parent->BaseWidget(),
38 XmNhighlightThickness, &highlight, NULL);
39 int height = 21 + 2 * highlight;
40 blank_pixmap = XCreatePixmap(display, root, 1, height, depth);
41 blank_mask = XCreatePixmap(display, root, 1, height, 1);
42 GC gc_mask = XCreateGC(display, blank_mask, 0, NULL);
43 XSetForeground(display, gc_mask, 0);
44 XFillRectangle(display, blank_mask, gc_mask, 0, 0, 1, height);
46 XFreeGC(display, gc_mask);
51 XmString top_string = StringCreate(MESSAGE(Position1L));
52 XmString label_string = StringCreate(MESSAGE(JobNameL));
53 Widget p = XtParent(parent->BaseWidget());
55 XtVaGetValues(p, XmNbackground, &bg, NULL);
56 _w = XtVaCreateManagedWidget("DtDetailsLabel", iconWidgetClass, p,
57 GuiNsuperNode, parent->BaseWidget(),
58 XmNalignment, XmALIGNMENT_END,
59 XmNtraversalOn, False,
61 GuiNiconMarginThickness, 0,
62 XmNhighlightThickness, 0,
63 XmNlabelString, label_string,
64 GuiNtopLabelString, top_string,
65 XmNlabelPixmap, blank_pixmap,
66 GuiNiconMask, blank_mask,
67 GuiNpixmapPlacement, GuiPIXMAP_LEFT,
69 StringFree(top_string);
70 StringFree(label_string);
71 XtAddCallback(_w, GuiNsingleClickCallback, &DtDetailsLabel::ClickCB, NULL);
72 XtAddCallback(_w, GuiNdoubleClickCallback, &DtDetailsLabel::ClickCB, NULL);
75 void DtDetailsLabel::Update(boolean show_only_my_jobs)
78 if (show_only_my_jobs)
80 XtVaSetValues(_w, GuiNbottomLabelString, bottom_label[i], NULL);
83 void DtDetailsLabel::ClickCB(Widget w, XtPointer, XtPointer)
85 XtVaSetValues(w, GuiNselected, False, NULL);