File: cmpack_time_scale_data.h

package info (click to toggle)
c-munipack 2.1.39-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 55,888 kB
  • sloc: ansic: 200,762; cpp: 106,129; lex: 9,035; yacc: 4,916; sh: 4,074; fortran: 2,613; xml: 2,105; python: 1,182; makefile: 546; perl: 104
file content (123 lines) | stat: -rw-r--r-- 4,957 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/**************************************************************

cmpack_timescale_data.h (C-Munipack project)
Object which holds data for a time scale (derived from GtkObject)
Copyright (C) 2011 David Motl, dmotl@volny.cz

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
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

$Id: cmpack_time_scale_data.h,v 1.2 2016/04/24 12:24:07 dmotl Exp $

**************************************************************/
#ifndef CMPACK_TIME_SCALE_DATA_H
#define CMPACK_TIME_SCALE_DATA_H

#include <stdint.h>
#include <gtk/gtk.h>

#include "cmpack_widgdefs.h"

G_BEGIN_DECLS

/* Row data */
typedef struct _CmpackTimeScaleItem {
	gdouble		x;				// Date and time of observation
	CmpackColor	color;			// Color of a bar
	gchar		*tag;			// A text associated with the frame
	gboolean	hidden : 1;		// Display this item
	gboolean	disabled : 1;	// Cannot be selected or activated
	gboolean    topmost : 1;	// Displayed on top of other items
	intptr_t	param;			// Custom value
} CmpackTimeScaleItem;

/* Graph data */
typedef struct _CmpackTimeScaleData {
	GObject		parent;

	/* Private data */ 
	gint		count, capacity;	/* Number of items, allocated space */
	CmpackTimeScaleItem	**items;	/* List of items */
} CmpackTimeScaleData;

typedef struct {
	GObjectClass parent_class;

	/* Signals */
	void (*row_inserted)(CmpackTimeScaleData *model, gint row);
	void (*row_updated)(CmpackTimeScaleData *model, gint row);
	void (*row_deleted)(CmpackTimeScaleData *model, gint row);
	void (*data_cleared)(CmpackTimeScaleData *model);
} CmpackTimeScaleDataClass;

#define CMPACK_TYPE_TIME_SCALE_DATA            (cmpack_time_scale_data_get_type ())
#define CMPACK_TIME_SCALE_DATA(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CMPACK_TYPE_TIME_SCALE_DATA, CmpackTimeScaleData))
#define CMPACK_TIME_SCALE_DATA_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CMPACK_TYPE_TIME_SCALE_DATA, CmpackTimeScaleDataClass))
#define CMPACK_IS_TIME_SCALE_DATA(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CMPACK_TYPE_TIME_SCALE_DATA))
#define CMPACK_IS_TIME_SCALE_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CMPACK_TYPE_TIME_SCALE_DATA))
#define CMPACK_TIME_SCALE_DATA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CMPACK_TYPE_TIME_SCALE_DATA, CmpackTimeScaleDataClass)) 

GType cmpack_time_scale_data_get_type(void) G_GNUC_CONST;

/* Create new time scale data */
CmpackTimeScaleData *cmpack_time_scale_data_new(void);

/* Create new time scale data */
CmpackTimeScaleData *cmpack_time_scale_data_new_with_alloc(gint capacity);

/* Clear data and set number of channels and initial capacity */
void cmpack_time_scale_data_alloc(CmpackTimeScaleData *data, gint capacity);

/* Get number of frames */
gint cmpack_time_scale_data_nrows(CmpackTimeScaleData *data);

/* Clear all data */
void cmpack_time_scale_data_clear(CmpackTimeScaleData *data);

/* Append frames to the time scale */
gint cmpack_time_scale_data_add(CmpackTimeScaleData *data, const CmpackTimeScaleItem *item, gsize item_size);

/* Clear all tags */
void cmpack_time_scale_data_clear_tags(CmpackTimeScaleData *data);

/* Set row tag */
void cmpack_time_scale_data_set_tag(CmpackTimeScaleData *data, gint row, const gchar *tag);

/* Set topmost flag */
void cmpack_time_scale_data_set_topmost(CmpackTimeScaleData *data, gint row, gboolean topmost);

/* Set color to given cell */
void cmpack_time_scale_data_set_color(CmpackTimeScaleData *data, gint row, CmpackColor color);

/* Set custom value (integer or pointer) to given cell */
void cmpack_time_scale_data_set_param(CmpackTimeScaleData *data, gint row, intptr_t param);

/* Get frame parameters */
const CmpackTimeScaleItem *cmpack_time_scale_data_get_item(CmpackTimeScaleData *data, gint row);

/* Get a tag associated with a frame */
const gchar *cmpack_time_scale_data_get_tag(CmpackTimeScaleData *data, gint row);

/* Get color of a frame */
CmpackColor cmpack_time_scale_data_get_color(CmpackTimeScaleData *data, gint row);

/* Get custom value associated with a frame */
intptr_t cmpack_time_scale_data_get_param(CmpackTimeScaleData *data, gint row);

/* Get first row with given custom value */
gint cmpack_time_scale_data_find_item(CmpackTimeScaleData *data, intptr_t param);

G_END_DECLS

#endif