comparison dwtest.c @ 206:f7911991c5df

Show info about the scrollbar in a status text control.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 01 Feb 2003 08:30:20 +0000
parents e0beea487e8f
children 767fca804cea
comparison
equal deleted inserted replaced
205:b9283fd56d69 206:f7911991c5df
18 notebookbox, 18 notebookbox,
19 notebookbox1, 19 notebookbox1,
20 notebookbox2, 20 notebookbox2,
21 notebook, 21 notebook,
22 scrollbar, 22 scrollbar,
23 status,
23 stext, 24 stext,
24 pagebox, 25 pagebox,
25 textbox1, textbox2, 26 textbox1, textbox2,
26 buttonbox; 27 buttonbox;
27 28
146 dw_pixmap_bitblt(hwnd, NULL, 0, 0, font_width*width1, font_height*rows, NULL, hpm, 0, 0 ); 147 dw_pixmap_bitblt(hwnd, NULL, 0, 0, font_width*width1, font_height*rows, NULL, hpm, 0, 0 );
147 dw_flush(); 148 dw_flush();
148 return TRUE; 149 return TRUE;
149 } 150 }
150 151
152 /* Callback to handle user selection of the scrollbar position */
153 void DWSIGNAL scrollbar_valuechanged(HWND hwnd, int value, void *data)
154 {
155 if(data)
156 {
157 HWND stext = (HWND)data;
158 char tmpbuf[100];
159
160 sprintf(tmpbuf, "%d", value);
161 dw_window_set_text(stext, tmpbuf);
162 }
163 }
151 void text_add(void) 164 void text_add(void)
152 { 165 {
153 int i,y,depth = dw_color_depth(); 166 int i,y,depth = dw_color_depth();
154 char buf[10]; 167 char buf[10];
155 HPIXMAP text1pm,text2pm; 168 HPIXMAP text1pm,text2pm;
167 180
168 scrollbar = dw_scrollbar_new(FALSE, 100, 0); 181 scrollbar = dw_scrollbar_new(FALSE, 100, 0);
169 dw_box_pack_start( pagebox, scrollbar, 100, 20, TRUE, FALSE, 0); 182 dw_box_pack_start( pagebox, scrollbar, 100, 20, TRUE, FALSE, 0);
170 dw_scrollbar_set_range(scrollbar, 100, 50); 183 dw_scrollbar_set_range(scrollbar, 100, 50);
171 dw_scrollbar_set_pos(scrollbar, 10); 184 dw_scrollbar_set_pos(scrollbar, 10);
185
186 status = dw_status_text_new("", 0);
187 dw_box_pack_start( pagebox, status, 100, 20, TRUE, FALSE, 1);
172 188
173 text1pm = dw_pixmap_new( textbox1, font_width*width1, font_height*rows, depth ); 189 text1pm = dw_pixmap_new( textbox1, font_width*width1, font_height*rows, depth );
174 text2pm = dw_pixmap_new( textbox2, font_width*width2, font_height*rows, depth ); 190 text2pm = dw_pixmap_new( textbox2, font_width*width2, font_height*rows, depth );
175 191
176 dw_color_foreground_set(DW_CLR_WHITE); 192 dw_color_foreground_set(DW_CLR_WHITE);
190 dw_draw_text( NULL, text1pm, 0, y, buf); 206 dw_draw_text( NULL, text1pm, 0, y, buf);
191 dw_draw_text( NULL, text2pm, 0, y, buf); 207 dw_draw_text( NULL, text2pm, 0, y, buf);
192 } 208 }
193 dw_signal_connect(textbox1, "expose_event", DW_SIGNAL_FUNC(text_expose), text1pm); 209 dw_signal_connect(textbox1, "expose_event", DW_SIGNAL_FUNC(text_expose), text1pm);
194 dw_signal_connect(textbox2, "expose_event", DW_SIGNAL_FUNC(text_expose), text2pm); 210 dw_signal_connect(textbox2, "expose_event", DW_SIGNAL_FUNC(text_expose), text2pm);
211 dw_signal_connect(scrollbar, "value_changed", DW_SIGNAL_FUNC(scrollbar_valuechanged), (void *)status);
195 } 212 }
196 213
197 /* Beep every second */ 214 /* Beep every second */
198 int DWSIGNAL timer_callback(void *data) 215 int DWSIGNAL timer_callback(void *data)
199 { 216 {