class Gtk::PostBox
Attributes
return_to_top[RW]
Public Class Methods
list()
click to toggle source
既存のGtk::PostBoxのインスタンスを返す
# File core/mui/gtk_postbox.rb, line 19 def self.list return @@postboxes end
new(postable = nil, to: [], from: nil, header: ''.freeze, footer: ''.freeze, to_display_only: false, use_blind_footer: true, visibility: nil, target_world: nil, **kwrest)
click to toggle source
Args¶ ↑
- postable
-
Service|Message リプライ先か、投稿するアカウント(3.3 obsolete)
- to
-
Enumerable 返信するMessage
- from
-
Diva::Model|nil 送信者。nilを指定すると、その時のカレントワールドになる
- header
-
String テキストフィールドのカーソルの前に最初から入力されている文字列
- footer
-
String テキストフィールドのカーソルの後ろに最初から入力されている文字列
- to_display_only
-
true|false toに宛てたリプライを送るなら偽。真ならUI上にtoが表示されるだけ
- use_blind_footer
-
true|false blind footerを追加するか否か
- visibility
-
Symbol|nil compose Spellに渡すvisibilityオプションの値
- target_world
-
Diva::Model|nil 対象とするWorld。nilを指定するとその時々の :world_current フィルタの値を使う
- kwrest
-
Hash 以下の値から成る連想配列
- delegated_by :: Gtk::PostBox 投稿処理をこのPostBoxに移譲したPostBox - postboxstorage :: Gtk::Container PostBoxの親で、複数のPostBoxを持つことができるコンテナ - delegate_other :: true|false|Proc 投稿時、このPostBoxを使わないで、新しいPostBoxで投稿する。そのPostBoxにはdelegated_byに _self_ が設定される。Procを指定した場合、新しいPostBoxを作る処理として、その無名関数を使う - before_post_hook :: Proc 投稿前に、 _self_ を引数に呼び出される
Calls superclass method
# File core/mui/gtk_postbox.rb, line 38 def initialize(postable = nil, to: [], from: nil, header: ''.freeze, footer: ''.freeze, to_display_only: false, use_blind_footer: true, visibility: nil, target_world: nil, **kwrest) mainthread_only @posting = nil @return_to_top = nil @options = kwrest @from = from @to = (Array(to) + Array(@options[:subreplies])).uniq.freeze if postable warn "Gtk::Postbox.new(postable) is deprecated. see https://mikutter.hachune.net/rdoc/Gtk/PostBox.html" case postable when Message @to = [postable, *@to].freeze unless @to.include? postable when Diva::Model @from = postable end end @header = (header || '').freeze @footer = (footer || '').freeze @to_display_only = !!to_display_only @use_blind_footer = !!use_blind_footer @visibility = visibility @target_world = target_world super() ssc(:parent_set) do if parent sw = get_ancestor(Gtk::ScrolledWindow) if sw @return_to_top = sw.vadjustment.value == 0 else @return_to_top = false end post_it if @options[:delegated_by] end end add(generate_box) set_border_width(2) register end
Public Instance Methods
active()
click to toggle source
このPostBoxにフォーカスを合わせる
# File core/mui/gtk_postbox.rb, line 170 def active get_ancestor(Gtk::Window).set_focus(widget_post) if(get_ancestor(Gtk::Window)) end
delegatable?()
click to toggle source
このPostBoxを使って投稿したとき、delegateを作成するように設定されていれば真を返す
# File core/mui/gtk_postbox.rb, line 166 def delegatable? @options[:delegate_other] end
destroy()
click to toggle source
Calls superclass method
# File core/mui/gtk_postbox.rb, line 193 def destroy @@ringlock.synchronize{ if not(destroyed?) and not(frozen?) and parent parent.remove(self) @@postboxes.delete(self) super on_delete self.freeze end } end
post_it(world: target_world)
click to toggle source
入力されている投稿する。投稿に成功したら、self.destroyを呼んで自分自身を削除する
Args¶ ↑
- world:
-
投稿先のWorld。省略するかnilを渡すと :world_current フィルタの結果が使われる
# File core/mui/gtk_postbox.rb, line 176 def post_it(world: target_world) if postable? return unless before_post(world: world || target_world) @posting = Plugin[:gtk].compose( world || target_world, to_display_only? ? nil : @to.first, **compose_options ).next{ destroy }.trap{ |err| warn err end_post } start_post end end
posting?()
click to toggle source
現在メッセージの投稿中なら真を返す
# File core/mui/gtk_postbox.rb, line 162 def posting? !!@posting end
widget_post()
click to toggle source
# File core/mui/gtk_postbox.rb, line 86 def widget_post return @post if defined?(@post) @post = gen_widget_post post_set_default_text(@post) @post.wrap_mode = Gtk::TextTag::WRAP_CHAR @post.border_width = 2 @post.buffer.ssc('changed') { |textview| refresh_buttons(false) false } @post.signal_connect_after('focus_out_event', &method(:focus_out_event)) @post end
Also aliased as: post
widget_remain()
click to toggle source
# File core/mui/gtk_postbox.rb, line 99 def widget_remain return @remain if defined?(@remain) @remain = Gtk::Label.new('---') tag = Plugin[:gtk].handler_tag @remain.ssc_atonce(:expose_event) { Plugin[:gtk].on_world_change_current(tags: tag) { |world| update_remain_charcount } false } @remain.ssc(:destroy) { Plugin[:gtk].detach(tag) } Delayer.new{ update_remain_charcount } widget_post.buffer.ssc(:changed){ |textview, event| update_remain_charcount } @remain end
widget_send()
click to toggle source
# File core/mui/gtk_postbox.rb, line 120 def widget_send return @send if defined?(@send) @send = Gtk::Button.new.add(Gtk::WebIcon.new(Skin.get_path('post.png'), 16, 16)) @send.sensitive = postable? @send.ssc(:clicked) do |button| post_it false end @send end
widget_tool()
click to toggle source
# File core/mui/gtk_postbox.rb, line 131 def widget_tool return @tool if defined?(@tool) @tool = Gtk::Button.new.add(Gtk::WebIcon.new(Skin.get_path('close.png'), 16, 16)) @tool.signal_connect_after('focus_out_event', &method(:focus_out_event)) @tool.ssc(:event) do @tool.sensitive = destructible? || posting? false end @tool.ssc(:clicked) do if posting? @posting.cancel @tool.sensitive = destructible? || posting? cancel_post else destroy if destructible? end false end @tool end