3 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "bcsignals.h"
24 #include "mwindowgui.h"
25 #include "panedividers.h"
29 PaneDivider::PaneDivider(MWindow *mwindow, int x, int y, int length, int is_x)
32 is_x ? mwindow->theme->pane_w : length,
33 is_x ? length : mwindow->theme->pane_h,
34 mwindow->theme->pane_color)
36 this->mwindow = mwindow;
40 images[0] = images[1]= images[2] = 0;
44 PaneDivider::~PaneDivider()
51 void PaneDivider::create_objects()
56 set_cursor(HSEPARATE_CURSOR, 0, 0);
57 image_src = mwindow->theme->get_image_set("xpane");
61 set_cursor(VSEPARATE_CURSOR, 0, 0);
62 image_src = mwindow->theme->get_image_set("ypane");
65 for(int i = 0; i < 3; i++)
67 images[i] = new BC_Pixmap(this, image_src[i], PIXMAP_ALPHA);
73 void PaneDivider::draw(int flush)
92 void PaneDivider::reposition_window(int x, int y, int length)
94 BC_SubWindow::reposition_window(x,
96 is_x ? mwindow->theme->pane_w : length,
98 is_x ? length : mwindow->theme->pane_h);
101 int PaneDivider::button_press_event()
105 origin_x = get_cursor_x();
106 origin_y = get_cursor_y();
108 status = BUTTON_DOWNHI;
115 int PaneDivider::button_release_event()
124 // might be deleted in here
125 mwindow->gui->stop_pane_drag();
126 status = BUTTON_UPHI;
135 int PaneDivider::cursor_motion_event()
141 if(is_x && abs(get_cursor_x() - origin_x) > 5)
144 mwindow->gui->start_x_pane_drag();
147 if(!is_x && abs(get_cursor_y() - origin_y) > 5)
150 mwindow->gui->start_y_pane_drag();
155 mwindow->gui->handle_pane_drag();
163 int PaneDivider::cursor_enter_event()
167 if(get_button_down())
169 status = BUTTON_DOWNHI;
172 if(status == BUTTON_UP)
174 status = BUTTON_UPHI;
182 int PaneDivider::cursor_leave_event()
184 if(status == BUTTON_UPHI)