4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "byteorderpopup.h"
26 ByteOrderPopup::ByteOrderPopup(BC_WindowBase *parent_window,
31 this->parent_window = parent_window;
32 this->output = output;
37 ByteOrderPopup::~ByteOrderPopup()
41 for(int i = 0; i < byteorder_items.total; i++)
42 delete byteorder_items.values[i];
45 void ByteOrderPopup::create_objects()
47 byteorder_items.append(new BC_ListBoxItem(File::byteorder_to_str(0)));
48 byteorder_items.append(new BC_ListBoxItem(File::byteorder_to_str(1)));
50 parent_window->add_subwindow(textbox = new ByteOrderText(this, x, y));
51 x += textbox->get_w();
52 parent_window->add_subwindow(menu = new ByteOrderList(this, x, y));
55 ByteOrderList::ByteOrderList(ByteOrderPopup *popup, int x, int y)
61 &popup->byteorder_items,
71 int ByteOrderList::handle_event()
73 popup->textbox->update(get_selection(0, 0)->get_text());
74 popup->textbox->handle_event();
78 ByteOrderText::ByteOrderText(ByteOrderPopup *popup, int x, int y)
79 : BC_TextBox(x, y, 100, 1, File::byteorder_to_str(*popup->output))
84 int ByteOrderText::handle_event()
86 *popup->output = File::str_to_byteorder(get_text());