~ubuntu-branches/ubuntu/warty/synaptic/warty

« back to all changes in this revision

Viewing changes to wings/rwsourceswindow.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2002-04-04 12:23:30 UTC
  • Revision ID: james.westby@ubuntu.com-20020404122330-il87fkpjajirckb2
Tags: upstream-0.16
ImportĀ upstreamĀ versionĀ 0.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include "config.h"
 
3
#include "i18n.h"
 
4
 
 
5
#include "rwsourceswindow.h"
 
6
 
 
7
#include <WINGs/wtableview.h>
 
8
 
 
9
#include "up.xpm"
 
10
#include "down.xpm"
 
11
 
 
12
 
 
13
static int numberOfRows(WMTableViewDelegate *self, WMTableView *table)
 
14
{
 
15
    return 0;
 
16
}
 
17
 
 
18
 
 
19
static void *valueForCell(WMTableViewDelegate *self, WMTableColumn *column, int row)
 
20
{
 
21
 
 
22
    return (void*)"A";
 
23
}
 
24
 
 
25
 
 
26
 
 
27
 
 
28
static WMButton *makeButton(WMWidget *parent, char **image)
 
29
{
 
30
    WMButton *button;
 
31
    WMPixmap *pix;
 
32
    
 
33
    button = WMCreateCommandButton(parent);
 
34
 
 
35
    pix = WMCreatePixmapFromXPMData(WMWidgetScreen(parent), image);
 
36
    WMSetButtonImagePosition(button, WIPImageOnly);
 
37
    WMSetButtonImage(button, pix);
 
38
    WMReleasePixmap(pix);
 
39
 
 
40
    return button;
 
41
}
 
42
 
 
43
 
 
44
RWSourcesWindow::RWSourcesWindow(RWWindow *parent)
 
45
    : RWWindow(parent, "sources")
 
46
{
 
47
    WMBox *hbox;
 
48
    WMButton *btn;
 
49
    WMTableView *table;
 
50
    WMScreen *scr = WMWidgetScreen(_win);
 
51
    static WMTableViewDelegate delegate = {
 
52
        NULL,
 
53
            numberOfRows,
 
54
            valueForCell,
 
55
            NULL
 
56
    };
 
57
    
 
58
    WMResizeWidget(_win, 600, 200);
 
59
 
 
60
    WMSetBoxHorizontal(_topBox, False);
 
61
     
 
62
    
 
63
    table = WMCreateTableView(_topBox);
 
64
    WMSetTableViewDataSource(table, this);
 
65
    WMSetTableViewBackgroundColor(table, WMWhiteColor(scr));
 
66
    WMSetTableViewGridColor(table, WMGrayColor(scr));
 
67
    WMSetTableViewHeaderHeight(table, 18);
 
68
    WMSetTableViewDelegate(table, &delegate);
 
69
    WMAddBoxSubview(_topBox, WMWidgetView(table), True, True, 200, 0, 5);
 
70
 
 
71
    {
 
72
        WMTableColumn *col;
 
73
        
 
74
        col = WMCreateTableColumn("");
 
75
        WMAddTableViewColumn(table, col);
 
76
        WMSetTableColumnWidth(col, 20);
 
77
//      WMSetTableColumnDelegate(col, colDeleg);
 
78
        WMSetTableColumnId(col, (void*)0);
 
79
        
 
80
        col = WMCreateTableColumn(_("Type"));
 
81
        WMSetTableColumnWidth(col, 50);
 
82
        WMAddTableViewColumn(table, col);
 
83
//      WMSetTableColumnDelegate(col, colDeleg);
 
84
        WMSetTableColumnId(col, (void*)1);      
 
85
        
 
86
        col = WMCreateTableColumn(_("Vendor"));
 
87
        WMSetTableColumnWidth(col, 54); 
 
88
        WMAddTableViewColumn(table, col);
 
89
//      WMSetTableColumnDelegate(col, colDeleg);
 
90
        WMSetTableColumnId(col, (void*)2);
 
91
        
 
92
        col = WMCreateTableColumn(_("URI"));
 
93
        WMSetTableColumnWidth(col, 250);
 
94
        WMAddTableViewColumn(table, col);
 
95
//      WMSetTableColumnDelegate(col, colDeleg);
 
96
        WMSetTableColumnId(col, (void*)4);
 
97
        
 
98
        col = WMCreateTableColumn(_("Distribution"));
 
99
        WMSetTableColumnWidth(col, 80);
 
100
        WMAddTableViewColumn(table, col);
 
101
//      WMSetTableColumnDelegate(col, colDeleg);
 
102
        WMSetTableColumnId(col, (void*)3);
 
103
        
 
104
        col = WMCreateTableColumn(_("Components"));
 
105
        WMSetTableColumnWidth(col, 100);
 
106
        WMAddTableViewColumn(table, col);
 
107
//      WMSetTableColumnDelegate(col, colDeleg);
 
108
        WMSetTableColumnId(col, (void*)4);      
 
109
    }
 
110
 
 
111
   
 
112
    hbox = WMCreateBox(_topBox);
 
113
    WMSetBoxHorizontal(hbox, True);
 
114
    WMAddBoxSubview(_topBox, WMWidgetView(hbox), False, True, 24, 0, 0);
 
115
 
 
116
    btn = makeButton(hbox, up_xpm);
 
117
    WMAddBoxSubview(hbox, WMWidgetView(btn), False, True, 24, 0, 3);
 
118
 
 
119
    btn = makeButton(hbox, down_xpm);
 
120
    WMAddBoxSubview(hbox, WMWidgetView(btn), False, True, 24, 0, 10);
 
121
 
 
122
    
 
123
 
 
124
    btn = WMCreateCommandButton(hbox);
 
125
    WMSetButtonText(btn, _("Add Repository"));
 
126
    WMAddBoxSubview(hbox, WMWidgetView(btn), False, True, 120, 0, 5);
 
127
 
 
128
    btn = WMCreateCommandButton(hbox);
 
129
    WMSetButtonText(btn, _("Add CD-ROM"));
 
130
    WMAddBoxSubview(hbox, WMWidgetView(btn), False, True, 120, 0, 5);
 
131
    
 
132
    btn = WMCreateCommandButton(hbox);
 
133
    WMSetButtonText(btn, _("Remove"));
 
134
    WMAddBoxSubview(hbox, WMWidgetView(btn), False, True, 100, 0, 5);
 
135
 
 
136
    btn = WMCreateCommandButton(hbox);
 
137
    WMSetButtonText(btn, _("Close"));
 
138
    WMAddBoxSubviewAtEnd(hbox, WMWidgetView(btn), False, True, 100, 0, 0);
 
139
    
 
140
    WMMapSubwidgets(_topBox);
 
141
    WMMapSubwidgets(_win);
 
142
    
 
143
    setTitle("Setup Package Repositories (nao ta funcionando ainda!)");
 
144
    
 
145
    WMRealizeWidget(_win);
 
146
}
 
147