Subversion Repositories Kolibri OS

Rev

Rev 9620 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9620 Rev 9766
Line 1... Line 1...
1
// BOXLIB EXAMPLE (scrollbar, progressbar, editbox and checkbox)
1
// BOXLIB EXAMPLE (scrollbar, progressbar, editbox and checkbox)
2
// Writed by maxcodehack and superturbocat2001
2
// Writed by maxcodehack and superturbocat2001
Line 3... Line -...
3
 
-
 
4
#include 
-
 
5
#include 
-
 
6
#include 
3
 
7
#include 
4
#include 
-
 
5
#include 
-
 
6
#include 
-
 
7
#include 
Line 8... Line 8...
8
#include 
8
#include 
9
 
9
 
Line 10... Line 10...
10
#define WIN_W 640
10
#define WIN_W 640
Line 27... Line 27...
27
scrollbar scroll = {15, WIN_W - 26, WIN_H - 29, 0, 0, 2, 215, SCROLL_BUTTON_SIZE, 0,0x707070,0xD2CED0,0x555555};
27
scrollbar scroll = { 15, WIN_W - 26, WIN_H - 29, 0, 0, 2, 215, SCROLL_BUTTON_SIZE, 0, 0x707070, 0xD2CED0, 0x555555 };
28
progressbar pg = {0, 10, 10, 270, 35, 1, 0, 200, 0xB4B4B4, 0x2728FF, 0xA9A9A9};
28
progressbar pg = { 0, 10, 10, 270, 35, 1, 0, 200, 0xB4B4B4, 0x2728FF, 0xA9A9A9 };
29
edit_box ed={WIN_W-140,10,60,0xFFFFFF,0x6a9480,0,0x6a9480, BLACK | TEXT_SIZE, ED_BUFF_LEN, ed_buff,NULL,ed_focus};
29
edit_box ed = { WIN_W - 140, 10, 60, 0xFFFFFF, 0x6a9480, 0, 0x6a9480, BLACK | TEXT_SIZE, ED_BUFF_LEN, ed_buff, NULL, ed_focus };
30
check_box output_off={X_W(10, 15), Y_H(120,15), 10, WHITE, BLUE, BLACK | TEXT_SIZE, "Disable duplicate output",0};
30
check_box output_off = { X_W(10, 15), Y_H(120, 15), 10, WHITE, BLUE, BLACK | TEXT_SIZE, "Disable duplicate output", 0 };
Line 31... Line 31...
31
 
31
 
-
 
32
void draw_window()
32
void draw_window(){
33
{
33
    _ksys_start_draw(); 
34
    _ksys_start_draw();
34
    _ksys_create_window(215,100,WIN_W,WIN_H,title, 0x858585, 0x34);     
35
    _ksys_create_window(215, 100, WIN_W, WIN_H, title, 0x858585, 0x34);
35
	edit_box_draw(&ed);
36
    edit_box_draw(&ed);
36
	check_box_draw2(&output_off);
37
    check_box_draw2(&output_off);
Line 47... Line 48...
47
	init_checkbox2(&output_off);
48
    init_checkbox2(&output_off);
48
	_ksys_set_event_mask(KSYS_EVM_REDRAW + KSYS_EVM_KEY + KSYS_EVM_BUTTON + KSYS_EVM_MOUSE+ KSYS_EVM_MOUSE_FILTER);
49
    _ksys_set_event_mask(KSYS_EVM_REDRAW + KSYS_EVM_KEY + KSYS_EVM_BUTTON + KSYS_EVM_MOUSE + KSYS_EVM_MOUSE_FILTER);
49
	while(1){
50
    while (1) {
50
		switch(_ksys_get_event()){
51
        switch (_ksys_get_event()) {
51
		case KSYS_EVENT_BUTTON:
52
        case KSYS_EVENT_BUTTON:
52
			if (_ksys_get_button() == 1) return 0;
53
            if (_ksys_get_button() == 1)
-
 
54
                return 0;
53
		break;
55
            break;
Line 54... Line 56...
54
		  
56
 
55
		case KSYS_EVENT_KEY:
57
        case KSYS_EVENT_KEY:
56
			edit_box_key_safe(&ed, _ksys_get_key());
58
            edit_box_key_safe(&ed, _ksys_get_key());