We now properly obtain the selection and report key presses. Much more
wiring up to be done. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1332 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
//
|
||||
// $Id: lookuplet.cc,v 1.1 2003/11/28 21:34:59 mdb Exp $
|
||||
// $Id: lookuplet.cc,v 1.2 2003/11/30 23:50:18 mdb Exp $
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
#include <config.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libgnomemm/main.h>
|
||||
#include <libgnomeuimm/init.h>
|
||||
// #include <bonobomm/widgets/wrap_init.h>
|
||||
@@ -16,13 +17,21 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool lookuplet::on_query_key_press_event (GdkEventKey *ev)
|
||||
static void got_clip_text (
|
||||
GtkClipboard* clipboard, const gchar* text, gpointer data)
|
||||
{
|
||||
((lookuplet*)data)->on_clip_text_received(text);
|
||||
}
|
||||
|
||||
bool lookuplet::on_query_key_press_event (GdkEventKey* ev)
|
||||
{
|
||||
printf("key pressed %d %d\n", ev->type, ev->keyval);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void lookuplet::on_query_selection_received (GtkSelectionData *data, guint time)
|
||||
void lookuplet::on_clip_text_received (const gchar* text)
|
||||
{
|
||||
_query->set_text(text);
|
||||
}
|
||||
|
||||
void lookuplet::on_prefs_clicked ()
|
||||
@@ -39,16 +48,18 @@ bool Gtk::Widget::on_delete_event (GdkEventAny* event)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
Gnome::Main m(PACKAGE, VERSION, Gnome::UI::module_info_get(), argc, argv);
|
||||
// Gnome::Bonobo::wrap_init();
|
||||
|
||||
lookuplet *lookuplet = new class lookuplet();
|
||||
lookuplet* lookuplet = new class lookuplet();
|
||||
// binding *binding = new class binding();
|
||||
// about *about = new class about();
|
||||
// properties *properties = new class properties();
|
||||
|
||||
GtkClipboard* clip = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
|
||||
gtk_clipboard_request_text(clip, &got_clip_text, lookuplet);
|
||||
m.run(*lookuplet);
|
||||
|
||||
delete lookuplet;
|
||||
|
||||
Reference in New Issue
Block a user