2004-09-19 14:24:53 -06:00
|
|
|
/* Copyright (C) 2004 Bart
|
2010-05-25 16:25:21 -06:00
|
|
|
* Copyright (C) 2010 Curtis Gedak
|
2004-09-19 14:24:53 -06:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2014-01-23 03:59:48 -07:00
|
|
|
* GNU General Public License for more details.
|
2004-09-19 14:24:53 -06:00
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-23 03:59:48 -07:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2004-09-19 14:24:53 -06:00
|
|
|
*/
|
2013-05-27 05:20:16 -06:00
|
|
|
|
|
|
|
#ifndef GPARTED_FRAME_RESIZER_BASE_H
|
|
|
|
#define GPARTED_FRAME_RESIZER_BASE_H
|
2004-09-19 14:24:53 -06:00
|
|
|
|
|
|
|
#include <gtkmm/frame.h>
|
|
|
|
#include <gtkmm/drawingarea.h>
|
|
|
|
#include <gdkmm/cursor.h>
|
|
|
|
|
2004-10-08 13:53:35 -06:00
|
|
|
class Frame_Resizer_Base : public Gtk::Frame
|
2004-09-19 14:24:53 -06:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum ArrowType {
|
2004-10-01 15:09:19 -06:00
|
|
|
ARROW_LEFT = 0,
|
|
|
|
ARROW_RIGHT = 1
|
2004-09-19 14:24:53 -06:00
|
|
|
};
|
|
|
|
|
2006-03-01 12:16:13 -07:00
|
|
|
Frame_Resizer_Base() ;
|
|
|
|
~Frame_Resizer_Base() ;
|
|
|
|
|
|
|
|
void set_rgb_partition_color( const Gdk::Color & color ) ;
|
|
|
|
void override_default_rgb_unused_color( const Gdk::Color & color ) ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2010-05-25 16:25:21 -06:00
|
|
|
void set_x_min_space_before( int x_min_space_before ) ;
|
2006-03-01 12:16:13 -07:00
|
|
|
void set_x_start( int x_start ) ;
|
|
|
|
void set_x_end( int x_end ) ;
|
|
|
|
void set_used( int used );
|
|
|
|
void set_fixed_start( bool fixed_start ) ;
|
2004-12-12 07:57:04 -07:00
|
|
|
void set_size_limits( int min_size, int max_size ) ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2006-03-01 12:16:13 -07:00
|
|
|
int get_used();
|
|
|
|
int get_x_start() ;
|
|
|
|
int get_x_end() ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2006-03-01 12:16:13 -07:00
|
|
|
virtual void Draw_Partition() ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2005-01-25 07:26:54 -07:00
|
|
|
//public signals (emitted upon resize/move)
|
2004-09-19 14:24:53 -06:00
|
|
|
sigc::signal<void,int,int, ArrowType> signal_resize;
|
|
|
|
sigc::signal<void,int,int> signal_move;
|
|
|
|
|
|
|
|
protected:
|
2006-03-01 12:16:13 -07:00
|
|
|
int BORDER, GRIPPER ;
|
2010-05-25 16:25:21 -06:00
|
|
|
int X_MIN_SPACE_BEFORE ;
|
2006-03-01 12:16:13 -07:00
|
|
|
int X_START, USED, UNUSED, X_END, X_START_MOVE, MIN_SIZE, MAX_SIZE;
|
2004-09-19 14:24:53 -06:00
|
|
|
bool GRIP_LEFT, GRIP_RIGHT, GRIP_MOVE ;
|
|
|
|
|
|
|
|
//signal handlers
|
2006-03-01 12:16:13 -07:00
|
|
|
void drawingarea_on_realize();
|
|
|
|
bool drawingarea_on_expose( GdkEventExpose * ev );
|
|
|
|
virtual bool drawingarea_on_mouse_motion( GdkEventMotion * ev ) ;
|
|
|
|
bool drawingarea_on_button_press_event( GdkEventButton * ev ) ;
|
|
|
|
bool drawingarea_on_button_release_event( GdkEventButton * ev ) ;
|
|
|
|
bool drawingarea_on_leave_notify( GdkEventCrossing * ev ) ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
|
|
|
void Draw_Resize_Grip( ArrowType ) ;
|
|
|
|
|
2005-01-25 07:26:54 -07:00
|
|
|
Gtk::DrawingArea drawingarea ;
|
|
|
|
Glib::RefPtr<Gdk::GC> gc_drawingarea ;
|
|
|
|
Glib::RefPtr<Gdk::Pixmap> pixmap ;
|
|
|
|
Glib::RefPtr<Gdk::GC> gc_pixmap ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2005-01-25 07:26:54 -07:00
|
|
|
Gdk::Color color_used, color_unused, color_arrow, color_background, color_partition, color_arrow_rectangle;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2006-03-01 12:16:13 -07:00
|
|
|
std::vector<Gdk::Point> arrow_points;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2006-09-09 01:09:13 -06:00
|
|
|
Gdk::Cursor *cursor_resize, *cursor_move;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
|
|
|
int temp_x, temp_y ;
|
|
|
|
bool fixed_start; //a fixed start disables moving the start and thereby the whole move functionality..
|
|
|
|
|
|
|
|
private:
|
2006-03-01 12:16:13 -07:00
|
|
|
void init() ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2013-05-27 05:20:16 -06:00
|
|
|
#endif /* GPARTED_FRAME_RESIZER_BASE_H */
|