2010-09-17 18:48:02 +02:00
|
|
|
/*
|
2010-09-17 19:03:03 +02:00
|
|
|
* ld-canvas.h
|
2010-09-17 18:48:02 +02:00
|
|
|
*
|
|
|
|
* This file is a part of logdiag.
|
2011-02-01 14:43:02 +01:00
|
|
|
* Copyright Přemysl Janouch 2010 - 2011. All rights reserved.
|
2010-09-17 18:48:02 +02:00
|
|
|
*
|
|
|
|
* See the file LICENSE for licensing information.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-09-17 19:16:53 +02:00
|
|
|
#ifndef __LD_CANVAS_H__
|
|
|
|
#define __LD_CANVAS_H__
|
2010-09-17 18:48:02 +02:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
2010-09-17 19:16:53 +02:00
|
|
|
#define LD_TYPE_CANVAS (ld_canvas_get_type ())
|
|
|
|
#define LD_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_CAST \
|
|
|
|
((obj), LD_TYPE_CANVAS, LdCanvas))
|
|
|
|
#define LD_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
|
|
|
|
((klass), LD_TYPE_CANVAS, LdCanvasClass))
|
|
|
|
#define LD_IS_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
|
|
|
|
((obj), LD_TYPE_CANVAS))
|
|
|
|
#define LD_IS_CANVAS_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
|
|
|
|
((klass), LD_TYPE_CANVAS))
|
|
|
|
#define LD_CANVAS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
|
|
|
|
((obj), LD_CANVAS, LdCanvasClass))
|
2010-09-17 18:48:02 +02:00
|
|
|
|
2010-09-17 19:16:53 +02:00
|
|
|
typedef struct _LdCanvas LdCanvas;
|
|
|
|
typedef struct _LdCanvasPrivate LdCanvasPrivate;
|
|
|
|
typedef struct _LdCanvasClass LdCanvasClass;
|
2010-09-17 18:48:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2010-09-17 19:16:53 +02:00
|
|
|
* LdCanvas:
|
2010-09-17 18:48:02 +02:00
|
|
|
*/
|
2010-09-17 19:16:53 +02:00
|
|
|
struct _LdCanvas
|
2010-09-17 18:48:02 +02:00
|
|
|
{
|
|
|
|
/*< private >*/
|
|
|
|
GtkDrawingArea parent_instance;
|
2010-09-17 19:16:53 +02:00
|
|
|
LdCanvasPrivate *priv;
|
2010-09-17 18:48:02 +02:00
|
|
|
};
|
|
|
|
|
2010-09-17 19:16:53 +02:00
|
|
|
struct _LdCanvasClass
|
2010-09-17 18:48:02 +02:00
|
|
|
{
|
2010-09-19 09:10:16 +02:00
|
|
|
/*< private >*/
|
2010-09-17 18:48:02 +02:00
|
|
|
GtkDrawingAreaClass parent_class;
|
2010-09-19 09:10:16 +02:00
|
|
|
|
2011-01-04 09:54:05 +01:00
|
|
|
guint cancel_operation_signal;
|
2011-02-01 14:43:02 +01:00
|
|
|
guint move_signal;
|
2011-01-04 09:54:05 +01:00
|
|
|
|
2010-12-07 00:59:05 +01:00
|
|
|
void (*set_scroll_adjustments) (LdCanvas *self,
|
|
|
|
GtkAdjustment *horizontal, GtkAdjustment *vertical);
|
2011-01-04 09:54:05 +01:00
|
|
|
void (*cancel_operation) (LdCanvas *self);
|
2011-02-01 14:43:02 +01:00
|
|
|
void (*move) (LdCanvas *self, gdouble dx, gdouble dy);
|
2010-09-17 18:48:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-12-07 00:59:05 +01:00
|
|
|
/**
|
2011-01-28 17:39:40 +01:00
|
|
|
* LD_CANVAS_BASE_UNIT_LENGTH:
|
2010-12-07 00:59:05 +01:00
|
|
|
*
|
2011-01-09 06:46:48 +01:00
|
|
|
* Length of the base unit in milimetres.
|
2010-12-07 00:59:05 +01:00
|
|
|
*/
|
|
|
|
#define LD_CANVAS_BASE_UNIT_LENGTH 2.5
|
|
|
|
|
|
|
|
|
2010-09-17 19:16:53 +02:00
|
|
|
GType ld_canvas_get_type (void) G_GNUC_CONST;
|
2010-09-17 18:48:02 +02:00
|
|
|
|
2011-01-24 17:22:37 +01:00
|
|
|
GtkWidget *ld_canvas_new (void);
|
2010-09-17 18:48:02 +02:00
|
|
|
|
2010-12-16 11:34:02 +01:00
|
|
|
void ld_canvas_set_diagram (LdCanvas *self, LdDiagram *diagram);
|
|
|
|
LdDiagram *ld_canvas_get_diagram (LdCanvas *self);
|
2010-11-19 07:05:44 +01:00
|
|
|
void ld_canvas_set_library (LdCanvas *self, LdLibrary *library);
|
|
|
|
LdLibrary *ld_canvas_get_library (LdCanvas *self);
|
|
|
|
|
2010-12-18 05:23:05 +01:00
|
|
|
void ld_canvas_widget_to_diagram_coords (LdCanvas *self,
|
2011-01-03 05:57:22 +01:00
|
|
|
gdouble wx, gdouble wy, gdouble *dx, gdouble *dy);
|
2010-12-18 05:23:05 +01:00
|
|
|
void ld_canvas_diagram_to_widget_coords (LdCanvas *self,
|
2011-01-03 05:57:22 +01:00
|
|
|
gdouble dx, gdouble dy, gdouble *wx, gdouble *wy);
|
2010-12-07 00:59:05 +01:00
|
|
|
|
2011-01-09 08:15:47 +01:00
|
|
|
gdouble ld_canvas_get_zoom (LdCanvas *self);
|
|
|
|
void ld_canvas_set_zoom (LdCanvas *self, gdouble zoom);
|
2011-02-04 20:19:01 +01:00
|
|
|
gboolean ld_canvas_can_zoom_in (LdCanvas *self);
|
|
|
|
void ld_canvas_zoom_in (LdCanvas *self);
|
|
|
|
gboolean ld_canvas_can_zoom_out (LdCanvas *self);
|
|
|
|
void ld_canvas_zoom_out (LdCanvas *self);
|
2011-01-09 08:15:47 +01:00
|
|
|
|
2011-01-04 09:54:05 +01:00
|
|
|
void ld_canvas_add_object_begin (LdCanvas *self, LdDiagramObject *object);
|
|
|
|
|
2010-09-19 09:10:16 +02:00
|
|
|
/* TODO: The rest of the interface. */
|
|
|
|
|
2010-09-17 18:48:02 +02:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2010-09-17 19:16:53 +02:00
|
|
|
#endif /* ! __LD_CANVAS_H__ */
|