Changeset 5600
- Timestamp:
- 06/26/09 08:26:45 (3 years ago)
- File:
-
- 1 edited
-
trunk/Padre/lib/Padre/Wx/Icon.pm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/lib/Padre/Wx/Icon.pm
r5548 r5600 21 21 use Padre::Util (); 22 22 use Padre::Wx (); 23 use Params::Util qw( _HASH ); 23 24 24 25 our $VERSION = '0.37'; … … 37 38 ); 38 39 40 # Lay down some defaults from our common 41 # constants 42 my %PREFS = ( 43 size => SIZE, 44 ext => EXT, 45 icons=> ICONS, 46 ); 47 39 48 our $DEFAULT_ICON_NAME = 'status/padre-fallback-icon'; 40 49 our $DEFAULT_ICON; … … 48 57 sub find { 49 58 my $name = shift; 50 59 my $prefs = shift; 60 # If you _really_ are competant ;), prefer size,icons,ext 61 # over the defaults 62 my %pref = _HASH( $prefs ) 63 ? ( %PREFS , %$prefs ) 64 : %PREFS; 51 65 # Search through the theme list 52 66 foreach my $theme (THEMES) { … … 56 70 : $name; 57 71 my $file = File::Spec->catfile( 58 ICONS,72 $pref{icons}, 59 73 $theme, 60 SIZE,74 $pref{size}, 61 75 ( split /\//, $hinted ) 62 ) . '.png';76 ) . $pref{ext}; 63 77 next unless -f $file; 64 return Wx::Bitmap->new( $file, Wx::wxBITMAP_TYPE_PNG ); 78 return cast_to_icon( 79 Wx::Bitmap->new( $file, Wx::wxBITMAP_TYPE_PNG ) 80 ); 65 81 } 66 82 … … 86 102 } 87 103 104 sub cast_to_icon{ 105 my $icon = Wx::Icon->new; 106 $icon->CopyFromBitmap( shift ); 107 return $icon; 108 } 109 88 110 1; 89 111
Note: See TracChangeset
for help on using the changeset viewer.
