Sha256: 04029100540d7639bb8fef12dab3cecb8cefd61f50a43d558e59a200511dbf62

Contents?: true

Size: 1.58 KB

Versions: 38

Compression:

Stored size: 1.58 KB

Contents

=begin
  xbm_cursor.rb - Gdk::Cursor sample script.

  Copyright (C) 2001-2006 Masao Mutoh
  This program is licenced under the same licence as Ruby-GNOME2.

  $Date: 2006/06/17 13:18:12 $
  $Id: xbm_cursor.rb,v 1.6 2006/06/17 13:18:12 mutoh Exp $
=end

require 'gtk3'

cursor_bits = [
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0xf0, 0x3f, 0x00, 0xe0, 0x78, 0x00, 0xe0, 0x70, 0x00, 0xe0, 0x70, 0x00,
   0xe0, 0x38, 0x00, 0xe0, 0x1f, 0x00, 0xe0, 0x1d, 0x00, 0xe0, 0x38, 0x00,
   0xe0, 0x78, 0x00, 0xe0, 0xf0, 0x00, 0xf0, 0xf3, 0x01, 0xf0, 0xe3, 0x01,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].pack("c*")

cursor_mask_bits = [
   0x63, 0x8e, 0x0f, 0x67, 0x8e, 0x0f, 0x06, 0xc6, 0x07, 0x04, 0x00, 0x00,
   0xf0, 0x3f, 0x08, 0xe7, 0x78, 0x0e, 0xe7, 0x70, 0x0f, 0xe4, 0x70, 0x03,
   0xe0, 0x38, 0x00, 0xe7, 0x1f, 0x0c, 0xe7, 0x1d, 0x0f, 0xe0, 0x38, 0x0e,
   0xe0, 0x78, 0x08, 0xe7, 0xf0, 0x00, 0xf7, 0xf3, 0x01, 0xf0, 0xe3, 0x01,
   0x04, 0x00, 0x00, 0x46, 0x24, 0x06, 0x67, 0x66, 0x0e, 0x67, 0x66, 0x0e].pack("c*")

window = Gtk::Window.new("Gdk::Cursor sample")
window.signal_connect("destroy"){Gtk.main_quit}
window.realize

source = Gdk::Pixmap.create_from_data(window.window, cursor_bits, 19, 19)
mask = Gdk::Pixmap.create_from_data(window.window, cursor_mask_bits, 19, 19)

fg = Gdk::Color.new(65535, 0, 0)
bg = Gdk::Color.new(65535, 65535, 0)

cursor = Gdk::Cursor.new(source, mask, fg, bg, 10, 10)

window.window.set_cursor(cursor)
window.add(Gtk::Label.new("Put your cursor on this window."))
window.set_default_size(200, 100).show_all

Gtk.main

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
gtk3-2.2.5-x64-mingw32 sample/misc/xbm_cursor.rb
gtk3-2.2.5-x86-mingw32 sample/misc/xbm_cursor.rb
gtk3-2.2.5 sample/misc/xbm_cursor.rb
gtk3-2.2.4-x64-mingw32 sample/misc/xbm_cursor.rb
gtk3-2.2.4-x86-mingw32 sample/misc/xbm_cursor.rb
gtk3-2.2.4 sample/misc/xbm_cursor.rb
gtk3-2.2.3-x86-mingw32 sample/misc/xbm_cursor.rb
gtk3-2.2.3 sample/misc/xbm_cursor.rb
gtk3-2.2.2-x86-mingw32 sample/misc/xbm_cursor.rb
gtk3-2.2.2 sample/misc/xbm_cursor.rb
gtk3-2.2.1-x86-mingw32 sample/misc/xbm_cursor.rb
gtk3-2.2.1 sample/misc/xbm_cursor.rb
gtk3-2.2.0-x86-mingw32 sample/misc/xbm_cursor.rb
gtk3-2.2.0 sample/misc/xbm_cursor.rb
gtk3-2.1.0-x86-mingw32 sample/misc/xbm_cursor.rb
gtk3-2.1.0 sample/misc/xbm_cursor.rb
gtk3-2.0.3-x86-mingw32 sample/misc/xbm_cursor.rb
gtk3-2.0.3 sample/misc/xbm_cursor.rb
gtk3-2.0.2-x86-mingw32 sample/misc/xbm_cursor.rb
gtk3-2.0.2 sample/misc/xbm_cursor.rb