1 #ifndef __PIANO_KEYBOARD_H__
2 #define __PIANO_KEYBOARD_H__
5 #include <gtk/gtkdrawingarea.h>
9 #define TYPE_PIANO_KEYBOARD (piano_keyboard_get_type ())
10 #define PIANO_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PIANO_KEYBOARD, PianoKeyboard))
11 #define PIANO_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PIANO_KEYBOARD, PianoKeyboardClass))
12 #define IS_PIANO_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PIANO_KEYBOARD))
13 #define IS_PIANO_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PIANO_KEYBOARD))
14 #define PIANO_KEYBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PIANO_KEYBOARD, PianoKeyboardClass))
16 typedef struct _PianoKeyboard PianoKeyboard;
17 typedef struct _PianoKeyboardClass PianoKeyboardClass;
25 int pressed; /* 1 if key is in pressed down state. */
26 int sustained; /* 1 if note is sustained. */
27 int x; /* Distance between the left edge of the key
28 * and the left edge of the widget, in pixels. */
29 int w; /* Width of the key, in pixels. */
30 int h; /* Height of the key, in pixels. */
31 int white; /* 1 if key is white; 0 otherwise. */
37 int maybe_stop_sustained_notes;
38 int sustain_new_notes;
39 int enable_keyboard_cue;
42 int note_being_pressed_using_mouse;
43 volatile struct Note notes[NNOTES];
44 /* Table used to translate from PC keyboard character to MIDI note number. */
45 GHashTable *key_bindings;
48 struct _PianoKeyboardClass
50 GtkDrawingAreaClass parent_class;
53 GType piano_keyboard_get_type (void) G_GNUC_CONST;
54 GtkWidget* piano_keyboard_new (void);
55 void piano_keyboard_sustain_press (PianoKeyboard *pk);
56 void piano_keyboard_sustain_release (PianoKeyboard *pk);
57 void piano_keyboard_set_note_on (PianoKeyboard *pk, int note);
58 void piano_keyboard_set_note_off (PianoKeyboard *pk, int note);
59 void piano_keyboard_set_keyboard_cue (PianoKeyboard *pk, int enabled);
60 void piano_keyboard_set_octave (PianoKeyboard *pk, int octave);
61 gboolean piano_keyboard_set_keyboard_layout (PianoKeyboard *pk, const char *layout);
65 #endif /* __PIANO_KEYBOARD_H__ */