Class: Fzeet::Windows::MenuMethods::Item
- Inherits:
-
Object
- Object
- Fzeet::Windows::MenuMethods::Item
- Defined in:
- lib/fzeet/windows/user/Menu.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#menu ⇒ Object
readonly
Returns the value of attribute menu.
Instance Method Summary collapse
- #checked=(checked) ⇒ Object
- #checked? ⇒ Boolean
- #enabled=(enabled) ⇒ Object
- #enabled? ⇒ Boolean
- #image ⇒ Object
- #image=(image) ⇒ Object
- #info(mask) ⇒ Object
- #info=(mii) ⇒ Object
-
#initialize(menu, id) ⇒ Item
constructor
A new instance of Item.
- #select(first, last) ⇒ Object
Constructor Details
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
121 122 123 |
# File 'lib/fzeet/windows/user/Menu.rb', line 121 def id @id end |
#menu ⇒ Object (readonly)
Returns the value of attribute menu.
121 122 123 |
# File 'lib/fzeet/windows/user/Menu.rb', line 121 def @menu end |
Instance Method Details
#checked=(checked) ⇒ Object
143 144 145 146 147 148 149 |
# File 'lib/fzeet/windows/user/Menu.rb', line 143 def checked=(checked) Windows.DetonateLastError(-1, :CheckMenuItem, @menu.handle, @id, (checked) ? Windows::MF_CHECKED : Windows::MF_UNCHECKED ) end |
#checked? ⇒ Boolean
137 138 139 140 141 |
# File 'lib/fzeet/windows/user/Menu.rb', line 137 def checked? flags = Windows.DetonateLastError(-1, :GetMenuState, @menu.handle, @id, 0) (flags & Windows::MF_CHECKED) == Windows::MF_CHECKED end |
#enabled=(enabled) ⇒ Object
129 130 131 132 133 134 135 |
# File 'lib/fzeet/windows/user/Menu.rb', line 129 def enabled=(enabled) Windows.DetonateLastError(-1, :EnableMenuItem, @menu.handle, @id, (enabled) ? Windows::MF_ENABLED : Windows::MF_GRAYED ) end |
#enabled? ⇒ Boolean
123 124 125 126 127 |
# File 'lib/fzeet/windows/user/Menu.rb', line 123 def enabled? flags = Windows.DetonateLastError(-1, :GetMenuState, @menu.handle, @id, 0) (flags & Windows::MF_GRAYED) != Windows::MF_GRAYED end |
#image ⇒ Object
182 |
# File 'lib/fzeet/windows/user/Menu.rb', line 182 def image; (Handle.instance?(handle = info(:bitmap)[:hbmpItem])) ? Handle.instance(handle) : nil end |
#image=(image) ⇒ Object
184 185 186 187 188 189 |
# File 'lib/fzeet/windows/user/Menu.rb', line 184 def image=(image) self.info = Windows::MENUITEMINFO.new.tap { |mii| mii[:fMask] = Windows::MIIM_BITMAP mii[:hbmpItem] = image.handle } end |
#info(mask) ⇒ Object
159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/fzeet/windows/user/Menu.rb', line 159 def info(mask) Windows.DetonateLastError(0, :GetMenuItemInfo, @menu.handle, @id, 0, info = Windows::MENUITEMINFO.new.tap { |mii| mii[:cbSize] = mii.size mii[:fMask] = Fzeet.constant(mask, :miim_) } ) info end |
#info=(mii) ⇒ Object
173 174 175 176 177 178 179 180 |
# File 'lib/fzeet/windows/user/Menu.rb', line 173 def info=(mii) Windows.DetonateLastError(0, :SetMenuItemInfo, @menu.handle, @id, 0, mii.tap { mii[:cbSize] = mii.size } ) end |