~ubuntu-branches/ubuntu/quantal/ruby1.9.1/quantal

« back to all changes in this revision

Viewing changes to ext/tk/lib/tkextlib/tile/style.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2010-07-31 17:08:39 UTC
  • mfrom: (1.1.4 upstream) (8.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100731170839-j034dmpdqt1cc4p6
Tags: 1.9.2~svn28788-1
* New release based on upstream snapshot from the 1.9.2 branch,
  after 1.9.2 RC2. That branch is (supposed to be) binary-compatible
  with the 1.9.1 branch.
  + Builds fine on i386. Closes: #580852.
* Upgrade to Standards-Version: 3.9.1. No changes needed.
* Updated generated incs.
* Patches that still need work:
  + Unclear status, need more investigation:
   090729_fix_Makefile_deps.dpatch
   090803_exclude_rdoc.dpatch
   203_adjust_base_of_search_path.dpatch
   902_define_YAML_in_yaml_stringio.rb.dpatch
   919_common.mk_tweaks.dpatch
   931_libruby_suffix.dpatch
   940_test_thread_mutex_sync_shorter.dpatch
  + Maybe not needed anymore, keeping but not applying.
   102_skip_test_copy_stream.dpatch (test doesn't block anymore?)
   104_skip_btest_io.dpatch (test doesn't block anymore?)
   201_gem_prelude.dpatch (we don't use that rubygems anyway?)
   202_gem_default_dir.dpatch (we don't use that rubygems anyway?)
   940_test_file_exhaustive_fails_as_root.dpatch
   940_test_priority_fails.dpatch
   100518_load_libc_libm.dpatch
* Add disable-tests.diff: disable some tests that cause failures on FreeBSD.
  Closes: #590002, #543805, #542927.
* However, many new failures on FreeBSD. Since that version is still an
  improvement, add the check that makes test suite failures non-fatal on
  FreeBSD again. That still needs to be investigated.
* Re-add 903_skip_base_ruby_check.dpatch
* Add build-dependency on ruby1.8 and drop all pre-generated files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    TkCommandNames = ['style'.freeze].freeze
22
22
 
23
23
    # --- Tk::Tile::Style.__define_wrapper_proc_for_compatibility__! ---
24
 
    # On Ttk (Tile) extension, 'style' command has imcompatible changes 
25
 
    # depend on the version of the extention. It requires modifying the 
26
 
    # Tcl/Tk scripts to define local styles. The rule for modification 
27
 
    # is a simple one. But, if users want to keep compatibility between 
28
 
    # versions of the extension, they will have to contrive to do that. 
 
24
    # On Ttk (Tile) extension, 'style' command has imcompatible changes
 
25
    # depend on the version of the extention. It requires modifying the
 
26
    # Tcl/Tk scripts to define local styles. The rule for modification
 
27
    # is a simple one. But, if users want to keep compatibility between
 
28
    # versions of the extension, they will have to contrive to do that.
29
29
    # It may be troublesome, especially for Ruby/Tk users.
30
 
    # This method may help such work. This method make some definitions 
31
 
    # on the Tcl/Tk interpreter to work with different version of style 
32
 
    # command format. Please give attention to use this method. It may 
33
 
    # conflict with some definitions on Tcl/Tk scripts. 
 
30
    # This method may help such work. This method make some definitions
 
31
    # on the Tcl/Tk interpreter to work with different version of style
 
32
    # command format. Please give attention to use this method. It may
 
33
    # conflict with some definitions on Tcl/Tk scripts.
34
34
    if Tk::Tile::TILE_SPEC_VERSION_ID < 7
35
35
      def __define_wrapper_proc_for_compatibility__!
36
36
        __define_themes_and_setTheme_proc__!
210
210
  end
211
211
 
212
212
  def lookup(style, opt, state=None, fallback_value=None)
213
 
    tk_call(TkCommandNames[0], 'lookup', style, 
 
213
    tk_call(TkCommandNames[0], 'lookup', style,
214
214
            '-' << opt.to_s, state, fallback_value)
215
215
  end
216
216
 
233
233
  def element_create(name, type, *args)
234
234
    if type == 'image' || type == :image
235
235
      element_create_image(name, *args)
 
236
    elsif type == 'vsapi' || type == :vsapi
 
237
      element_create_vsapi(name, *args)
236
238
    else
237
239
      tk_call(TkCommandNames[0], 'element', 'create', name, type, *args)
238
240
    end
253
255
      # probably, command format is tile 0.8+ (Tcl/Tk8.5+) style
254
256
      if Tk::Tile::TILE_SPEC_VERSION_ID >= 8
255
257
        if opts
256
 
          tk_call(TkCommandNames[0], 
 
258
          tk_call(TkCommandNames[0],
257
259
                  'element', 'create', name, 'image', spec, opts)
258
260
        else
259
261
          tk_call(TkCommandNames[0], 'element', 'create', name, 'image', spec)
262
264
        fail ArgumentError, 'illegal arguments' if opts.key?('map')
263
265
        base = spec.shift
264
266
        opts['map'] = spec
265
 
        tk_call(TkCommandNames[0], 
 
267
        tk_call(TkCommandNames[0],
266
268
                'element', 'create', name, 'image', base, opts)
267
269
      end
268
270
    else
271
273
        spec = [spec, *(opts.delete('map'))] if opts.key?('map')
272
274
      end
273
275
      if opts
274
 
        tk_call(TkCommandNames[0], 
 
276
        tk_call(TkCommandNames[0],
275
277
                'element', 'create', name, 'image', spec, opts)
276
278
      else
277
279
        tk_call(TkCommandNames[0], 'element', 'create', name, 'image', spec)
279
281
    end
280
282
  end
281
283
 
 
284
  def element_create_vsapi(name, class_name, part_id, *args)
 
285
    # supported on Tcl/Tk 8.6 or later
 
286
 
 
287
    # argument check
 
288
    if (state_map = args.shift || None)
 
289
      if state_map.kind_of?(Hash)
 
290
        opts = _symbolkey2str(state_map)
 
291
        state_map = None
 
292
      end
 
293
    end
 
294
    opts = args.shift || None
 
295
    fail ArgumentError, "too many arguments" unless args.empty?
 
296
 
 
297
    # define a Microsoft Visual Styles element
 
298
    tk_call(TkCommandNames[0], 'element', 'create', name, 'vsapi', 
 
299
            class_name, part_id, state_map, opts)
 
300
  end
 
301
 
282
302
  def element_names()
283
303
    list(tk_call(TkCommandNames[0], 'element', 'names'))
284
304
  end