Class: Wx::Icon
Overview
This class is untracked and should not be derived from nor instances extended!
An icon is a small rectangular bitmap usually used for denoting a minimized application.
It differs from a Bitmap in always having a mask associated with it for transparent drawing. On some platforms, icons and bitmaps are implemented identically, since there is no real distinction between a Bitmap with a mask and an icon; and there is no specific icon format on some platforms (X-based applications usually standardize on XPMs for small bitmaps and icons). However, some platforms (such as Windows) make the distinction, so a separate class is provided.
It is usually desirable to associate a pertinent icon with a frame. Icons can also be used for other purposes, for example with TreeCtrl and ListCtrl. Icons have different formats on different platforms therefore separate icons will usually be created for the different environments. Platform-specific methods for creating a Icon structure are catered for, and this is an occasion where conditional compilation will probably be required. Note that a new icon must be created for every time the icon is to be used for a new window. In Windows, the icon will not be reloaded if it has already been used. An icon allocated to a frame will be deleted when the frame is deleted. For more information please see Bitmaps and Icons.
Category: Graphics Device Interface (GDI) Predefined objects/pointers: NULL_ICON
Instance Method Summary collapse
-
#copy_from_bitmap(bmp) ⇒ void
Copies bmp bitmap to this icon.
-
#create_from_hicon(icon) ⇒ Boolean
Attach a Windows icon handle.
-
#get_depth ⇒ Integer
(also: #depth)
Gets the colour depth of the icon.
-
#get_height ⇒ Integer
(also: #height)
Gets the height of the icon in physical pixels.
-
#get_logical_height ⇒ Float
(also: #logical_height)
Gets the height of the icon in logical pixels.
-
#get_logical_size ⇒ Wx::Size
(also: #logical_size)
Gets the size of the icon in logical pixels.
-
#get_logical_width ⇒ Float
(also: #logical_width)
Gets the width of the icon in logical pixels.
-
#get_scale_factor ⇒ Float
(also: #scale_factor)
Gets the scale factor of this icon.
-
#get_size ⇒ Wx::Size
(also: #size)
Gets the size of the icon in physical pixels.
-
#get_width ⇒ Integer
(also: #width)
Gets the width of the icon in physical pixels.
-
#initialize(*args) ⇒ Icon
constructor
A new instance of Icon.
-
#is_ok ⇒ Boolean
(also: #ok?)
Returns true if icon data is present.
-
#load_file(name, type = Wx::ICON_DEFAULT_TYPE, desiredWidth = -1,, desiredHeight = -1)) ⇒ Boolean
Loads an icon from a file or resource.
Constructor Details
Instance Method Details
#copy_from_bitmap(bmp) ⇒ void
This method returns an undefined value.
Copies bmp bitmap to this icon.
Under MS Windows the bitmap must have mask colour set.
85 |
# File 'lib/wx/doc/gen/icon.rb', line 85 def copy_from_bitmap(bmp) end |
#create_from_hicon(icon) ⇒ Boolean
Attach a Windows icon handle.
This WXMSW-specific method allows assigning a native Windows HICON (which must be cast to WXHICON opaque handle type) to Wx::Icon. Notice that this means that the HICON will be destroyed by Wx::Icon when it is destroyed. true if successful.
Availability: only available for the WXMSW port.
77 |
# File 'lib/wx/doc/gen/icon.rb', line 77 def create_from_hicon(icon) end |
#get_depth ⇒ Integer Also known as: depth
Gets the colour depth of the icon.
A value of 1 indicates a monochrome icon.
91 |
# File 'lib/wx/doc/gen/icon.rb', line 91 def get_depth; end |
#get_height ⇒ Integer Also known as: height
Gets the height of the icon in physical pixels.
100 |
# File 'lib/wx/doc/gen/icon.rb', line 100 def get_height; end |
#get_logical_height ⇒ Float Also known as: logical_height
Gets the height of the icon in logical pixels.
107 |
# File 'lib/wx/doc/gen/icon.rb', line 107 def get_logical_height; end |
#get_logical_size ⇒ Wx::Size Also known as: logical_size
Gets the size of the icon in logical pixels.
114 |
# File 'lib/wx/doc/gen/icon.rb', line 114 def get_logical_size; end |
#get_logical_width ⇒ Float Also known as: logical_width
Gets the width of the icon in logical pixels.
121 |
# File 'lib/wx/doc/gen/icon.rb', line 121 def get_logical_width; end |
#get_scale_factor ⇒ Float Also known as: scale_factor
Gets the scale factor of this icon.
128 |
# File 'lib/wx/doc/gen/icon.rb', line 128 def get_scale_factor; end |
#get_size ⇒ Wx::Size Also known as: size
Gets the size of the icon in physical pixels.
136 |
# File 'lib/wx/doc/gen/icon.rb', line 136 def get_size; end |
#get_width ⇒ Integer Also known as: width
Gets the width of the icon in physical pixels.
145 |
# File 'lib/wx/doc/gen/icon.rb', line 145 def get_width; end |
#is_ok ⇒ Boolean Also known as: ok?
Returns true if icon data is present.
150 |
# File 'lib/wx/doc/gen/icon.rb', line 150 def is_ok; end |
#load_file(name, type = Wx::ICON_DEFAULT_TYPE, desiredWidth = -1,, desiredHeight = -1)) ⇒ Boolean
Loads an icon from a file or resource.
true if the operation succeeded, false otherwise.
161 |
# File 'lib/wx/doc/gen/icon.rb', line 161 def load_file(name, type=Wx::ICON_DEFAULT_TYPE, desiredWidth=-1, desiredHeight=-1) end |