OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [demos/] [samples/] [Xpm.tcl] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# Tix Demostration Program
2
#
3
# This sample program is structured in such a way so that it can be
4
# executed from the Tix demo program "widget": it must have a
5
# procedure called "RunSample". It should also have the "if" statment
6
# at the end of this file so that it can be run as a standalone
7
# program using tixwish.
8
 
9
# This file demonstrates the use of XPM images.
10
#
11
 
12
proc RunSample {w} {
13
 
14
    set hard_disk_pixmap {/* XPM */
15
        static char * drivea_xpm[] = {
16
            /* width height ncolors chars_per_pixel */
17
            "32 32 5 1",
18
            /* colors */
19
            "   s None  c None",
20
            ".  c #000000000000",
21
            "X  c white",
22
            "o  c #c000c000c000",
23
            "O  c #800080008000",
24
            /* pixels */
25
            "                                ",
26
            "                                ",
27
            "                                ",
28
            "                                ",
29
            "                                ",
30
            "                                ",
31
            "                                ",
32
            "                                ",
33
            "                                ",
34
            "   ..........................   ",
35
            "   .XXXXXXXXXXXXXXXXXXXXXXXo.   ",
36
            "   .XooooooooooooooooooooooO.   ",
37
            "   .Xooooooooooooooooo..oooO.   ",
38
            "   .Xooooooooooooooooo..oooO.   ",
39
            "   .XooooooooooooooooooooooO.   ",
40
            "   .Xoooooooo.......oooooooO.   ",
41
            "   .Xoo...................oO.   ",
42
            "   .Xoooooooo.......oooooooO.   ",
43
            "   .XooooooooooooooooooooooO.   ",
44
            "   .XooooooooooooooooooooooO.   ",
45
            "   .XooooooooooooooooooooooO.   ",
46
            "   .XooooooooooooooooooooooO.   ",
47
            "   .oOOOOOOOOOOOOOOOOOOOOOOO.   ",
48
            "   ..........................   ",
49
            "                                ",
50
            "                                ",
51
            "                                ",
52
            "                                ",
53
            "                                ",
54
            "                                ",
55
            "                                ",
56
            "                                "};
57
    }
58
 
59
    frame $w.top -relief raised -bd 1
60
    button $w.top.b -image [image create pixmap -data $hard_disk_pixmap]
61
    pack $w.top -expand yes -fill both
62
    pack $w.top.b -expand yes -padx 20  -pady 20
63
 
64
    tixButtonBox $w.box -orientation horizontal
65
    $w.box add ok     -text Ok     -underline 0 -command "destroy $w" \
66
        -width 6
67
    $w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
68
        -width 6
69
 
70
    pack $w.box -side bottom -fill x
71
    pack $w.top -side top -fill both -expand yes
72
}
73
 
74
 
75
# This "if" statement makes it possible to run this script file inside or
76
# outside of the main demo program "widget".
77
#
78
if {![info exists tix_demo_running]} {
79
    wm withdraw .
80
    set w .demo
81
    toplevel $w
82
    RunSample $w
83
    bind $w <Destroy> exit
84
}
85
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.