help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk]


From: Gwenael Casaccio
Subject: [Help-smalltalk]
Date: Mon, 22 Jun 2009 16:39:31 +0200
User-agent: KMail/1.11.90 (Linux/2.6.28-13-generic; KDE/4.2.90; x86_64; ; )

Hi,

Here is a method to allow the shortcuts in Gtk applications.
You also need the code in the GtkExtend/GtkAccelGroup.st in the GtkLauncher 
SVN

Cheers,
Gwenael

static void
accel_group_connect (OOP accel_group,
                     guint accel_key,
                     GdkModifierType accel_mods,
                     GtkAccelFlags accel_flags,
                     OOP receiver,
                     OOP selector)
{
  GtkAccelGroup *cObject = _gst_vm_proxy->OOPToCObject (accel_group);
  int n_params;
  GClosure *closure;
  OOP oop_sel_args;

  oop_sel_args = _gst_vm_proxy->strMsgSend (selector, "numArgs", NULL);
  if (oop_sel_args == _gst_vm_proxy->nilOOP)
    return ; /* Invalid selector */

  /* Check the number of arguments in the selector against the number of
     arguments in the event callback */
  /* We can return fewer arguments than are in the event, if the others aren't
     wanted, but we can't return more, and returning nilOOPs instead is not
     100% satisfactory, so fail. */
  n_params = _gst_vm_proxy->OOPToInt (oop_sel_args);
  if (n_params > 4)
    return ;

  /* Receiver is assumed to be OK, no matter what it is */
  /* Parameters OK, so carry on and connect the signal */

  accel_group = narrow_oop_for_g_object ( G_OBJECT (cObject), accel_group);

  closure = create_smalltalk_closure (receiver, selector, NULL,
                                      accel_group, n_params);
  gtk_accel_group_connect (cObject, accel_key, accel_mods, accel_flags, 
closure);
}
-- 

GtkLauncher for GNU Smalltalk : http://gtklauncher.bioskop.fr/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]