PhatKeyboard

PhatKeyboard — a base class for PhatHKeyboard and PhatVKeyboard

Synopsis




            _Key;
            PhatKeyboard;
GtkAdjustment* phat_keyboard_get_adjustment (PhatKeyboard *keyboard);
void        phat_keyboard_set_adjustment    (PhatKeyboard *keyboard,
                                             GtkAdjustment *adjustment);

Object Hierarchy


  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkBin
                                 +----GtkViewport
                                       +----PhatKeyboard
                                             +----PhatVKeyboard
                                             +----PhatHKeyboard

Implemented Interfaces

PhatKeyboard implements AtkImplementorIface.

Properties


  "numkeys"              gint                  : Read / Write / Construct Only
  "orientation"          GtkOrientation        : Read / Write / Construct Only
  "show-labels"          gboolean              : Read / Write / Construct Only

Signals


"key-pressed"
            void        user_function      (PhatKeyboard *keyboard,
                                            gint          key,
                                            gpointer      user_data)      : Run first / Action
"key-released"
            void        user_function      (PhatKeyboard *keyboard,
                                            gint          key,
                                            gpointer      user_data)      : Run first / Action

Description

The PhatKeyboard widget family provides a simple piano-like keyboard. Since it is derived from GtkViewport, it comes with the ability to scroll. You don't have to worry about the values of the GtkAdjustment it uses, just share said adjustment with a scrollbar and you'll be in business.

PhatKeyboard is an abstract base class, from which PhatHKeyboard and PhatVKeyboard are derived. To create a new keyboard, call either phat_hkeyboard_new() or phat_vkeyboard_new().

Details

_Key

typedef struct {
    int index;
    PhatKeyboard* keyboard;     /* the keyboard we belong to */
    GnomeCanvasGroup* group;    /* the group this key belongs to */
    GnomeCanvasItem* pre;       /* prelight rectangle */
    GnomeCanvasItem* on;        /* active (depressed) rectangle */
    GnomeCanvasItem* shad;      /* active shadow */
} _Key;


PhatKeyboard

typedef struct _PhatKeyboard PhatKeyboard;

The PhatKeyboard struct contains private data only, and should be accessed using the functions below.


phat_keyboard_get_adjustment ()

GtkAdjustment* phat_keyboard_get_adjustment (PhatKeyboard *keyboard);

Retrives the current adjustment in use by keyboard.

keyboard : a PhatKeyboard
Returns : keyboard's current GtkAdjustment

phat_keyboard_set_adjustment ()

void        phat_keyboard_set_adjustment    (PhatKeyboard *keyboard,
                                             GtkAdjustment *adjustment);

Sets the adjustment used by keyboard.

keyboard : a PhatKeyboard
adjustment : a GtkAdjustment

Property Details

The "numkeys" property

  "numkeys"              gint                  : Read / Write / Construct Only

How many keys this keyboard should have.

Allowed values: [1,1000]

Default value: 128


The "orientation" property

  "orientation"          GtkOrientation        : Read / Write / Construct Only

How the keyboard should be arranged on the screen.

Default value: GTK_ORIENTATION_VERTICAL


The "show-labels" property

  "show-labels"          gboolean              : Read / Write / Construct Only

Whether C keys should be labeled or not.

Default value: TRUE

Signal Details

The "key-pressed" signal

void        user_function                  (PhatKeyboard *keyboard,
                                            gint          key,
                                            gpointer      user_data)      : Run first / Action

The "key-pressed" signal is emitted whenever a key is pressed.

keyboard : the object on which the signal was emitted
key : the index of the key that was pressed
user_data : user data set when the signal handler was connected.

The "key-released" signal

void        user_function                  (PhatKeyboard *keyboard,
                                            gint          key,
                                            gpointer      user_data)      : Run first / Action

The "key-released" signal is emitted whenever a key is released.

keyboard : the object on which the signal was emitted
key : the index of the key that was pressed
user_data : user data set when the signal handler was connected.

See Also

PhatHKeyboard and PhatVKeyboard, to create new instances of PhatKeyboard.