nobody at rubyforge.org
2007-Jan-06 22:55 UTC
[Wxruby-development] [838] trunk/wxruby2/doc/textile/artprovider.txtl: Add methods listing; rubyify examples; distinguish class methods
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:'':'';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; } #msg ul, pre { overflow: auto; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[838] trunk/wxruby2/doc/textile/artprovider.txtl: Add methods listing; rubyify examples; distinguish class methods</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>838</dd> <dt>Author</dt> <dd>brokentoy</dd> <dt>Date</dt> <dd>2007-01-06 17:55:14 -0500 (Sat, 06 Jan 2007)</dd> </dl> <h3>Log Message</h3> <pre>Add methods listing; rubyify examples; distinguish class methods</pre> <h3>Modified Paths</h3> <ul> <li><a href="#trunkwxruby2doctextileartprovidertxtl">trunk/wxruby2/doc/textile/artprovider.txtl</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="trunkwxruby2doctextileartprovidertxtl"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/doc/textile/artprovider.txtl (837 => 838)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/doc/textile/artprovider.txtl        2007-01-06 01:19:24 UTC (rev 837) +++ trunk/wxruby2/doc/textile/artprovider.txtl        2007-01-06 22:55:14 UTC (rev 838) </span><span class="lines">@@ -1,7 +1,7 @@ </span><span class="cx"> h1(#wxartprovider). Wx::ArtProvider </span><span class="cx"> </span><del>-ArtProvider class is used to customize the look of Widgets application. -When Widgets needs to display an icon or a bitmap (e.g. in the standard file </del><ins>+The ArtProvider class is used to customize the look of wxRuby applications. +When wxRuby needs to display an icon or a bitmap (e.g. in the standard file </ins><span class="cx"> dialog), it does not use a hard-coded resource but asks ArtProvider for it </span><span class="cx"> instead. This way users can plug in their own ArtProvider class and easily </span><span class="cx"> replace standard art with their own version. All </span><span class="lines">@@ -10,31 +10,27 @@ </span><span class="cx"> provider with </span><span class="cx"> "ArtProvider#push_provider":artprovider.html#ArtProvider_pushprovider: </span><span class="cx"> </span><ins>+ class MyProvider < Wx::ArtProvider +         def create_bitmap(art_id, art_client, art_size) + .. + return Wx::Bitmap.new(...) + end + end </ins><span class="cx"> </span><del>- class MyProvider : public ArtProvider - { - protected: - Bitmap CreateBitmap(const ArtID& id, - const ArtClient& client, - const Size size) - { ... } - }; - ... - ArtProvider::PushProvider(new MyProvider); </del><ins>+ Wx::ArtProvider.push_provider(MyProvider.new) </ins><span class="cx"> </span><span class="cx"> </span><del>-There''s another way of taking advantage of this class: you can use it in your code and use -platform native icons as provided by "ArtProvider#get_bitmap":artprovider.html#ArtProvider_getbitmap or -"ArtProvider#get_icon":artprovider.html#ArtProvider_geticon (NB: this is not yet really -possible as of Widgets 2.3.3, the set of ArtProvider bitmaps is too -small). </del><ins>+There''s another way of taking advantage of this class: you can use it in +your code and use platform native icons as provided by +"ArtProvider#get_bitmap":artprovider.html#ArtProvider_getbitmap or +"ArtProvider#get_icon":artprovider.html#ArtProvider_geticon. </ins><span class="cx"> </span><span class="cx"> h3(#artprovideridentifying). Identifying art resources </span><span class="cx"> </span><span class="cx"> Every bitmap is known to ArtProvider under an unique ID that is used by when </span><span class="cx"> requesting a resource from it. The ID is represented by ArtID type and can </span><span class="cx"> have one of these predefined values (you can see bitmaps represented by these </span><del>-constants in the "artprov":sampleartprovider.html sample): </del><ins>+constants in the art provider section in the bigdemo sample): </ins><span class="cx"> </span><span class="cx"> * ART_ADD_BOOKMARK </span><span class="cx"> * ART_DEL_BOOKMARK </span><span class="lines">@@ -79,8 +75,8 @@ </span><span class="cx"> it is also possible to load icons from current icon theme by specifying their </span><span class="cx"> name (without extension and directory components). Icon themes recognized </span><span class="cx"> by GTK+ follow the </span><del>-freedesktop.org Icon Themes specificationhttp://freedesktop.org/Standards/icon-theme-spec. Note that themes are not guaranteed to contain all -icons, so ArtProvider may return @NullBitmap@ or @NullIcon@. </del><ins>+"freedesktop.org Icon Themes specification":http://freedesktop.org/Standards/icon-theme-spec. Note that themes are not guaranteed to contain all +icons, so ArtProvider may return @Wx::NULL_BITMAP@ or @Wx::NULL_ICON@. </ins><span class="cx"> Default theme is typically installed in @/usr/share/icons/hicolor@. </span><span class="cx"> </span><span class="cx"> h3(#artproviderclients). Clients </span><span class="lines">@@ -106,43 +102,55 @@ </span><span class="cx"> "ArtProvider#get_bitmap":artprovider.html#ArtProvider_getbitmap </span><span class="cx"> returns identical bitmap for different _client_ values! </span><span class="cx"> </span><del>-h4. See also - -See the "artprov":sampleartprovider.html sample for an example of ArtProvider usage. - </del><span class="cx"> h4. Derived from </span><span class="cx"> </span><span class="cx"> "Object":object.html </span><span class="cx"> </span><del>-h4. Members </del><ins>+h2. Methods </ins><span class="cx"> </span><ins>+<div id="methods"> + +* "ArtProvider.get_bitmap":#ArtProvider_getbitmap +* "ArtProvider.get_icon":#ArtProvider_geticon +* "ArtProvider.pop_provider":#ArtProvider_new +* "ArtProvider.push_provider":#ArtProvider_pushprovider +* "ArtProvider.remove_provider":#ArtProvider_removeprovider + +* "ArtProvider#create_bitmap":#ArtProvider_createbitmap + +</div> + +h2. Instance Methods + </ins><span class="cx"> h3(#ArtProvider_createbitmap). ArtProvider#create_bitmap </span><span class="cx"> </span><span class="cx"> "Bitmap":bitmap.html *create_bitmap*(%(arg-type)ArtID% id, %(arg-type)ArtClient% client, </span><span class="cx"> %(arg-type)Size% size) </span><span class="cx"> </span><del>-Derived art provider classes must override this method to create requested -art resource. Note that returned bitmaps are cached by ArtProvider and it is therefore -not necessary to optimize CreateBitmap for speed (e.g. you may create Bitmap objects -from XPMs here). </del><ins>+Derived art provider classes must override this method to create +requested art resource. Note that returned bitmaps are cached by +ArtProvider and it is therefore not necessary to optimize create_bitmap +for speed (e.g. you may create Bitmap objects from XPMs here). </ins><span class="cx"> </span><span class="cx"> h4. Parameters </span><span class="cx"> </span><span class="cx"> * _id_ ArtID unique identifier of the bitmap. </span><span class="cx"> * _client_ ArtClient identifier of the client (i.e. who is asking for the bitmap). </span><del>-This only servers as a hint. -* _size_ Preferred size of the bitmap. The function may return a bitmap of different -dimensions, it will be automatically rescaled to meet client''s request. </del><ins>+This only serves as a hint. +* _size_ Preferred size of the bitmap. The function may return a bitmap of different dimensions, it will be automatically rescaled to meet client''s request. </ins><span class="cx"> </span><span class="cx"> h4. Note </span><span class="cx"> </span><del>-This is *not* part of ArtProvider''s public API, use -"ArtProvider#get_bitmap":artprovider.html#ArtProvider_getbitmap or -"ArtProvider#get_icon":artprovider.html#ArtProvider_geticon -to query ArtProvider for a resource. </del><ins>+This is *not* part of ArtProvider''s public API and should not normally +be called directly, Use +"ArtProvider#get_bitmap":artprovider.html#ArtProvider_getbitmap or +"ArtProvider#get_icon":artprovider.html#ArtProvider_geticon to query +ArtProvider for a resource. </ins><span class="cx"> </span><del>-h3(#ArtProvider_getbitmap). ArtProvider#get_bitmap </del><ins>+h2. Class Methods </ins><span class="cx"> </span><ins>+h3(#ArtProvider_getbitmap). ArtProvider.get_bitmap + </ins><span class="cx"> "Bitmap":bitmap.html *get_bitmap*(%(arg-type)ArtID% id, %(arg-type)ArtClient% client = ART_OTHER, </span><span class="cx"> %(arg-type)Size% size = DEFAULT_SIZE) </span><span class="cx"> </span><span class="lines">@@ -158,7 +166,7 @@ </span><span class="cx"> </span><span class="cx"> The bitmap if one of registered providers recognizes the ID or NullBitmap otherwise. </span><span class="cx"> </span><del>-h3(#ArtProvider_geticon). ArtProvider#get_icon </del><ins>+h3(#ArtProvider_geticon). ArtProvider.get_icon </ins><span class="cx"> </span><span class="cx"> "Icon":icon.html *get_icon*(%(arg-type)ArtID% id, %(arg-type)ArtClient% client = ART_OTHER, </span><span class="cx"> %(arg-type)Size% size = DEFAULT_SIZE) </span><span class="lines">@@ -174,19 +182,19 @@ </span><span class="cx"> otherwise return the size from the topmost ArtProvider. _DefaultSize_ may be </span><span class="cx"> returned if the client doesn''t have a specified size, like ART_OTHER for example. </span><span class="cx"> </span><del>-h3(#ArtProvider_new). ArtProvider#pop_provider </del><ins>+h3(#ArtProvider_new). ArtProvider.pop_provider </ins><span class="cx"> </span><span class="cx"> Boolean *pop_provider*() </span><span class="cx"> </span><span class="cx"> Remove latest added provider and delete it. </span><span class="cx"> </span><del>-h3(#ArtProvider_pushprovider). ArtProvider#push_provider </del><ins>+h3(#ArtProvider_pushprovider). ArtProvider.push_provider </ins><span class="cx"> </span><span class="cx"> *push_provider*(%(arg-type)ArtProvider% provider) </span><span class="cx"> </span><span class="cx"> Register new art provider (add it to the top of providers stack). </span><span class="cx"> </span><del>-h3(#ArtProvider_removeprovider). ArtProvider#remove_provider </del><ins>+h3(#ArtProvider_removeprovider). ArtProvider.remove_provider </ins><span class="cx"> </span><span class="cx"> Boolean *remove_provider*(%(arg-type)ArtProvider% provider) </span><span class="cx"> </span></span></pre> </div> </div> </body> </html>
Reasonably Related Threads
- [ wxruby-Bugs-7773 ] ObjectPreviouslyDeleted error when using custom ArtProvider
- [1006] trunk/wxruby2/samples/bigdemo/wxArtProvider.rbw: ok method name changed to is_ok
- [916] branches/wxruby2/wxwidgets_282: More Wx::AUI classes, event hooks and sample
- Patch to fix ArtProvider and ArtProvider sample
- [1103] trunk/wxruby2: Added 2.8 methods to StaticBitmap & document them; cleanup header file