r1014: Enable horizontal scrolling with the mouse wheel by pressing Ctrl.
[cinelerra_cv/ct.git] / cinelerra / byteorderpopup.C
blob6d1731170ff115780d17a7008e60ecf46130494c
1 #include "byteorderpopup.h"
2 #include "file.h"
5 ByteOrderPopup::ByteOrderPopup(BC_WindowBase *parent_window, 
6         int x, 
7         int y, 
8         int *output)
10         this->parent_window = parent_window;
11         this->output = output;
12         this->x = x;
13         this->y = y;
16 ByteOrderPopup::~ByteOrderPopup()
18         delete menu;
19         delete textbox;
20         for(int i = 0; i < byteorder_items.total; i++)
21                 delete byteorder_items.values[i];
24 int ByteOrderPopup::create_objects()
26         byteorder_items.append(new BC_ListBoxItem(File::byteorder_to_str(0)));
27         byteorder_items.append(new BC_ListBoxItem(File::byteorder_to_str(1)));
29         parent_window->add_subwindow(textbox = new ByteOrderText(this, x, y));
30         x += textbox->get_w();
31         parent_window->add_subwindow(menu = new ByteOrderList(this, x, y));
32         return 0;
35 ByteOrderList::ByteOrderList(ByteOrderPopup *popup, int x, int y)
36  : BC_ListBox(x,
37         y,
38         100,
39         100,
40         LISTBOX_TEXT,
41         &popup->byteorder_items,
42         0,
43         0,
44         1,
45         0,
46         1)
48         this->popup = popup;
51 int ByteOrderList::handle_event()
53         popup->textbox->update(get_selection(0, 0)->get_text());
54         popup->textbox->handle_event();
55         return 1;
58 ByteOrderText::ByteOrderText(ByteOrderPopup *popup, int x, int y)
59  : BC_TextBox(x, y, 100, 1, File::byteorder_to_str(*popup->output))
61         this->popup = popup;
64 int ByteOrderText::handle_event()
66         *popup->output = File::str_to_byteorder(get_text());
67         return 1;