Class: Weechat::Bar::Item
- Inherits:
-
Object
- Object
- Weechat::Bar::Item
- Extended by:
- Callbacks, Properties
- Includes:
- Pointer
- Defined in:
- lib/weechat/bar.rb
Instance Attribute Summary
Attributes included from Pointer
Class Method Summary (collapse)
- + (Object) call_build_callback(id, window)
-
+ (Bar::Item?) find(name)
(also: from_name)
finds the Bar::Item with the given name.
- + (Object) items (also: all)
Instance Method Summary (collapse)
-
- (Object) build(window)
eigenclass.
-
- (Object) delete
(also: #remove)
removes the bar item, it will no longer be able to be used on any Bars.
-
- (Item) initialize(name) {|window| ... }
constructor
Creates a new Bar Item, and registers it for use for Bars.
-
- (Object) update
Updates the bar item.
Methods included from Callbacks
call_callback, callbacks, compute_free_id, compute_free_id, register_callback, unique_id
Methods included from Properties::ClassMethods
#all, #apply_rtransformation, #apply_transformation, #init_properties, #known_integer_properties, #known_properties, #known_string_properties, #mappings, #rtransformations, #settable_properties, #transformations, #type
Methods included from Pointer
#==, #hash, included, #inspect, #to_s
Constructor Details
- (Item) initialize(name) {|window| ... }
Creates a new Bar Item, and registers it for use for Bars. is used in the :items option for Bars to display the bar item
68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/weechat/bar.rb', line 68 def initialize(name, &build_callback) build_callback ||= method(:build) id = self.class.compute_free_id @ptr = Weechat.(name, "bar_build_callback", id.to_s) if @ptr.empty? raise "Could not create bar item" end self.class.register_callback( :build_callback => Callback.new(build_callback), :ptr => @ptr ) end |
Class Method Details
+ (Object) call_build_callback(id, window)
96 97 98 99 |
# File 'lib/weechat/bar.rb', line 96 def call_build_callback(id, window) window = Window.from_ptr(window) call_callback(id, :build_callback, window).to_s end |
+ (Bar::Item?) find(name) Also known as: from_name
finds the Bar::Item with the given name
45 46 47 48 49 50 51 52 |
# File 'lib/weechat/bar.rb', line 45 def find(name) ptr = Weechat.(name) if !ptr.empty? from_ptr(ptr) else nil end end |
+ (Object) items Also known as: all
32 33 34 35 36 37 38 |
# File 'lib/weechat/bar.rb', line 32 def items items = [] Weechat::Infolist.parse("bar_item").each do |item| items << Item.find(item[:name]) end items end |
Instance Method Details
- (Object) build(window)
eigenclass
56 57 58 |
# File 'lib/weechat/bar.rb', line 56 def build(window) "" end |
- (Object) delete Also known as: remove
removes the bar item, it will no longer be able to be used on any Bars
89 90 91 92 |
# File 'lib/weechat/bar.rb', line 89 def delete # TODO mark deletion status Weechat.(@ptr) end |
- (Object) update
Updates the bar item
83 84 85 |
# File 'lib/weechat/bar.rb', line 83 def update Weechat.(name) end |