diff options
Diffstat (limited to 'ext/tk/sample/tkextlib/treectrl/mailwasher.rb')
-rw-r--r-- | ext/tk/sample/tkextlib/treectrl/mailwasher.rb | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/ext/tk/sample/tkextlib/treectrl/mailwasher.rb b/ext/tk/sample/tkextlib/treectrl/mailwasher.rb index 836e1e87de..1b51bb9b21 100644 --- a/ext/tk/sample/tkextlib/treectrl/mailwasher.rb +++ b/ext/tk/sample/tkextlib/treectrl/mailwasher.rb @@ -7,8 +7,8 @@ def demoMailWasher(t) height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 - t.configure(:showroot=>false, :showrootbutton=>false, :showbuttons=>false, - :showlines=>false, :itemheight=>height, :selectmode=>:browse, + t.configure(:showroot=>false, :showrootbutton=>false, :showbuttons=>false, + :showlines=>false, :itemheight=>height, :selectmode=>:browse, :xscrollincrement=>1) pad = 4 @@ -16,14 +16,14 @@ def demoMailWasher(t) if $Version_1_1_OrLater t.column_create(:text=>'Delete', :textpadx=>pad, :tag=>'delete') t.column_create(:text=>'Bounce', :textpadx=>pad, :tag=>'bounce') - t.column_create(:text=>'Status', :width=>80, :textpadx=>pad, + t.column_create(:text=>'Status', :width=>80, :textpadx=>pad, :tag=>'status') - t.column_create(:text=>'Size', :width=>40, :textpadx=>pad, + t.column_create(:text=>'Size', :width=>40, :textpadx=>pad, :justify=>:right, :tag=>'size') t.column_create(:text=>'From', :width=>140, :textpadx=>pad, :tag=>'from') - t.column_create(:text=>'Subject', :width=>240, :textpadx=>pad, + t.column_create(:text=>'Subject', :width=>240, :textpadx=>pad, :tag=>'subject') - t.column_create(:text=>'Received', :textpadx=>pad, :arrow=>:up, + t.column_create(:text=>'Received', :textpadx=>pad, :arrow=>:up, :arrowpad=>[4,0], :tag=>'received') t.column_create(:text=>'Attachments', :textpadx=>pad, :tag=>'attachments') @@ -36,38 +36,38 @@ def demoMailWasher(t) else # TreeCtrl 1.0 t.column_configure(0, :text=>'Delete', :textpadx=>pad, :tag=>'delete') t.column_configure(1, :text=>'Bounce', :textpadx=>pad, :tag=>'bounce') - t.column_configure(2, :text=>'Status', :width=>80, :textpadx=>pad, + t.column_configure(2, :text=>'Status', :width=>80, :textpadx=>pad, :tag=>'status') - t.column_configure(3, :text=>'Size', :width=>40, :textpadx=>pad, + t.column_configure(3, :text=>'Size', :width=>40, :textpadx=>pad, :justify=>:right, :tag=>'size') - t.column_configure(4, :text=>'From', :width=>140, :textpadx=>pad, + t.column_configure(4, :text=>'From', :width=>140, :textpadx=>pad, :tag=>'from') - t.column_configure(5, :text=>'Subject', :width=>240, :textpadx=>pad, + t.column_configure(5, :text=>'Subject', :width=>240, :textpadx=>pad, :tag=>'subject') - t.column_configure(6, :text=>'Received', :textpadx=>pad, :arrow=>:up, + t.column_configure(6, :text=>'Received', :textpadx=>pad, :arrow=>:up, :arrowpad=>[4,0], :tag=>'received') - t.column_configure(7, :text=>'Attachments', :textpadx=>pad, + t.column_configure(7, :text=>'Attachments', :textpadx=>pad, :tag=>'attachments') t.element_create('imgOff', :image, :image=>@images['unchecked']) t.element_create('imgOn', :image, :image=>@images['checked']) end - t.element_create('border', :rect, :open=>:nw, :outline=>'gray', + t.element_create('border', :rect, :open=>:nw, :outline=>'gray', :outlinewidth=>1, :fill=>[@SystemHighlight, ['selected']]) - t.element_create('txtAny', :text, :lines=>1, + t.element_create('txtAny', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected']]) - t.element_create('txtNone', :text, :text=>'none', :lines=>1, + t.element_create('txtNone', :text, :text=>'none', :lines=>1, :fill=>[@SystemHighlightText, ['selected']]) - t.element_create('txtYes', :text, :text=>'yes', :lines=>1, + t.element_create('txtYes', :text, :text=>'yes', :lines=>1, :fill=>[@SystemHighlightText, ['selected']]) - t.element_create('txtNormal', :text, :text=>'Normal', :lines=>1, + t.element_create('txtNormal', :text, :text=>'Normal', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#006800', []]) - t.element_create('txtPossSpam', :text, :text=>'Possible Spam', :lines=>1, + t.element_create('txtPossSpam', :text, :text=>'Possible Spam', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#787800', []]) - t.element_create('txtProbSpam', :text, :text=>'Probably Spam', :lines=>1, + t.element_create('txtProbSpam', :text, :text=>'Probably Spam', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#FF9000', []]) - t.element_create('txtBlacklist', :text, :text=>'Blacklisted', :lines=>1, + t.element_create('txtBlacklist', :text, :text=>'Blacklisted', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#FF5800', []]) if $Version_1_1_OrLater @@ -96,16 +96,16 @@ def demoMailWasher(t) } [ - ['baldy@spammer.com', "Your hair is thinning"], - ['flat@spammer.com', "Your breasts are too small"], - ['tiny@spammer.com', "Your penis is too small"], - ['dumbass@spammer.com', "You are not very smart"], - ['bankrobber@spammer.com', "You need more money"], - ['loser@spammer.com', "You need better friends"], - ['gossip@spammer.com', "Find out what your coworkers think about you"], + ['baldy@spammer.com', "Your hair is thinning"], + ['flat@spammer.com', "Your breasts are too small"], + ['tiny@spammer.com', "Your penis is too small"], + ['dumbass@spammer.com', "You are not very smart"], + ['bankrobber@spammer.com', "You need more money"], + ['loser@spammer.com', "You need better friends"], + ['gossip@spammer.com', "Find out what your coworkers think about you"], ['whoami@spammer.com', "Find out what you think about yourself"], - ['downsized@spammer.com', "You need a better job"], - ['poorhouse@spammer.com', "Your mortgage is a joke"], + ['downsized@spammer.com', "You need a better job"], + ['poorhouse@spammer.com', "Your mortgage is a joke"], ['spam4ever@spammer.com', "You need more spam"] ].each{|frm, subj| item = t.item_create @@ -115,8 +115,8 @@ def demoMailWasher(t) if $Version_1_1_OrLater delete = [false, true][rand(2)] bounce = [false, true][rand(2)] - t.item_style_set(item, - 0, 'styCheck', 1, 'styCheck', 2, status, 3, 'styAny', + t.item_style_set(item, + 0, 'styCheck', 1, 'styCheck', 2, status, 3, 'styAny', 4, 'styAny', 5, 'styAny', 6, 'styAny', 7, attachments) t.item_state_forcolumn(item, 'delete', 'CHECK') if delete t.item_state_forcolumn(item, 'bounce', 'CHECK') if bounce @@ -124,8 +124,8 @@ def demoMailWasher(t) else # TreeCtrl 1.0 delete = ['styOn', 'styOff'][rand(2)] bounce = ['styOn', 'styOff'][rand(2)] - t.item_style_set(item, - 0, delete, 1, bounce, 2, status, 3, 'styAny', + t.item_style_set(item, + 0, delete, 1, bounce, 2, status, 3, 'styAny', 4, 'styAny', 5, 'styAny', 6, 'styAny', 7, attachments) end @@ -138,7 +138,7 @@ def demoMailWasher(t) } sortColumn = 6 - t.notify_bind(t, 'Header-invoke', + t.notify_bind(t, 'Header-invoke', proc{|c, w| if c == sortColumn if w.column_cget(sortColumn, :arrow) == 'down' @@ -162,35 +162,35 @@ def demoMailWasher(t) w.column_configure(c, :arrow=>arrow) case w.column_cget(c, :tag) when 'bounce', 'delete' - w.item_sort(:root, order, - { - :column=>c, + w.item_sort(:root, order, + { + :column=>c, :command=>proc{|item1, item2| compareOnOff(w, c, item1, item2) } - }, + }, { :column=>'subject', :dictionary=>true }) when 'status' - w.item_sort(:root, order, + w.item_sort(:root, order, { :column=>c, :dictionary=>true }) when 'from' - w.item_sort(:root, order, - { :column=>c, :dictionary=>true }, + w.item_sort(:root, order, + { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) when 'subject' - w.item_sort(:root, order, + w.item_sort(:root, order, { :column=>c, :dictionary=>true }) when 'size' - w.item_sort(:root, order, - { :column=>c, :dictionary=>true }, + w.item_sort(:root, order, + { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) when 'received' - w.item_sort(:root, order, - { :column=>c, :dictionary=>true }, + w.item_sort(:root, order, + { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) when 'attachments' - w.item_sort(:root, order, - { :column=>c, :dictionary=>true }, + w.item_sort(:root, order, + { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) end }, '%C %T') @@ -198,7 +198,7 @@ def demoMailWasher(t) mailWasher = TkBindTag.new if $Version_1_1_OrLater - mailWasher.bind('ButtonPress-1', + mailWasher.bind('ButtonPress-1', proc{|w, x, y| id = w.identify(x, y) if id.empty? @@ -214,7 +214,7 @@ def demoMailWasher(t) end }, '%W %x %y') else # TreeCtrl 1.0 - mailWasher.bind('ButtonPress-1', + mailWasher.bind('ButtonPress-1', proc{|w, x, y| id = w.identify(x, y) if id.empty? |