<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href='http://feeds.feedsky.com/styles/temp01.xsl' type='text/xsl' ?><!--这是一个由Feedsy提供技术支持的Feed，为了提高读者阅读的体验，以及满足用户美化自己Feed的需要，我们设计了多种精美的Feed模板，提供给大家选择，所有最终呈现出来的样式，皆由用户自愿选择使用，未经许可，任何团体和个人，请不要擅自修改样式或者盗用，这是对于用户选择权的尊重。--><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fs="http://www.feedsky.com/namespace/feed" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link href="http://feeds.feedsky.com/csdn.net/caterpillar_here" type="application/rss+xml" rel="self"></atom:link><fs:self_link href="http://feeds.feedsky.com/csdn.net/caterpillar_here" type="application/rss+xml"></fs:self_link><lastBuildDate>Mon, 07 Dec 2009 13:59:00 GMT</lastBuildDate><title>林信良（良葛格）的专栏</title><description>http://openhome.cc</description><link>http://blog.csdn.net/caterpillar_here</link><language>zh-cn</language><copyright>Copyright &amp;copy; caterpillar_here</copyright><pubDate>Tue, 22 May 2012 16:42:18 GMT</pubDate><image><url>http://static.blog.csdn.net/images/logo.gif</url><link>http://blog.csdn.net</link></image><item><title>[原]Scala 起步走</title><link>http://blog.csdn.net/caterpillar_here/article/details/4959766</link><description>&lt;p&gt;
&lt;small&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 從一些簡單的語法開始，了解 Scala 的許多特性，所以就算是起步走，東西也夠多了。&lt;/small&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;small&gt;基本環境與指令&lt;/small&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;簡單的小程式可以使用 scala 指令，編譯的事就交給 scalac，編譯想快點就用 fsc。&lt;/small&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&amp;nbsp;
&lt;ul&gt;
&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/InteractiveShell.html&quot;&gt;指
令互動環境&lt;/a&gt;
&lt;/small&gt;
&lt;/li&gt;
&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/ScalaCommand.html&quot;&gt;scala
指令&lt;/a&gt;
&lt;/small&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/ScalacFscCommand.html&quot;&gt;&lt;small&gt;scalac
與 fsc&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;small&gt;資料、變數、操作&lt;/small&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;所有的東西都是物件，所有的操作都是方法。&lt;/small&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&amp;nbsp;
&lt;ul&gt;
&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/Type.html&quot;&gt;資料型態&lt;/a&gt;
&lt;/small&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/VariableConstant.html&quot;&gt;&lt;small&gt;變
數、常數&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/OperatorMethod.html&quot;&gt;&lt;small&gt;操
作方法&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/OperatorExample.html&quot;&gt;&lt;small&gt;數
值操作&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/OperatorPrecedenceAssociativity.html&quot;&gt;操作順序與關聯&lt;/a&gt;
&lt;br /&gt;
&lt;/small&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/ConsoleIO.html&quot;&gt;&lt;small&gt;主
控台輸入輸出&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;small&gt;內建控制結構&lt;/small&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;運算式有傳回值，迴圈沒有，對了！Scala 沒有 break 與 continue。&lt;/small&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&amp;nbsp;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/IfExpression.html&quot;&gt;&lt;small&gt;if
運算式&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/ForExpression.html&quot;&gt;&lt;small&gt;for
運算式&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/WhileLoop.html&quot;&gt;&lt;small&gt;while
迴圈&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/MatchExpression.html&quot;&gt;&lt;small&gt;match
運算式&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/TryExpression.html&quot;&gt;try
運算式&lt;/a&gt;
&lt;br /&gt;
&lt;/small&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;small&gt;函式、類別&lt;/small&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;先從一些簡單的自定義開始，更多的花樣在後頭。&lt;/small&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&amp;nbsp;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/Function.html&quot;&gt;&lt;small&gt;簡單
的函式&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/Class.html&quot;&gt;&lt;small&gt;簡單的類別&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/SingletonObject.html&quot;&gt;&lt;small&gt;單
例物件&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;small&gt;常用物件&lt;/small&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;在變與不變之間，先體會 Scala 更多的特性。&lt;/small&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&amp;nbsp;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/String.html&quot;&gt;&lt;small&gt;String&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/Array.html&quot;&gt;&lt;small&gt;Array&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/ListTuple.html&quot;&gt;&lt;small&gt;List
與 Tuple&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/Scala/SetMap.html&quot;&gt;&lt;small&gt;Set
與 Map&lt;/small&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;small&gt;&lt;br /&gt;
&lt;/small&gt;
&lt;/p&gt;
            &lt;div&gt;
                作者：caterpillar_here 发表于2009-12-7 21:59:00 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/4959766&quot;&gt;原文链接&lt;/a&gt;
            &lt;/div&gt;
            &lt;div&gt;
            阅读：1253 评论：1 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/4959766#comments&quot; target=&quot;_blank&quot;&gt;查看评论&lt;/a&gt;
            &lt;/div&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/638057820/caterpillar_here/csdn.net/s.gif?r=http://blog.csdn.net/caterpillar_here/article/details/4959766&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><pubDate>Mon, 07 Dec 2009 21:59:00 +0800</pubDate><author>caterpillar_here</author><guid isPermaLink="false">http://blog.csdn.net/caterpillar_here/article/details/4959766</guid><dc:creator>caterpillar_here</dc:creator><fs:srclink>http://blog.csdn.net/caterpillar_here/article/details/4959766</fs:srclink><fs:srcfeed>http://blog.csdn.net/caterpillar_here/feed.aspx</fs:srcfeed><fs:itemid>csdn.net/caterpillar_here/~1120633/638057820/1120629</fs:itemid></item><item><title>[原]「常見程式題目」第三版</title><link>http://blog.csdn.net/caterpillar_here/article/details/4576314</link><description>&lt;p&gt;&lt;span id=&quot;text76999&quot; class=&quot;javascript&quot;&gt;更新紀錄：&lt;br /&gt;
第一版：最初的版本，主要以 C 語言實作為主，當時還是使用 CHM 格式製作，開啟有些問題吧！&lt;br /&gt;
第二版：將文件改為 HTML 格式，修改了 Java 實作部份，加入更多的題目。&lt;br /&gt;
&lt;strong&gt;第三版：修改了大部份的 C、Java 程式實作，並加入了 Python、Scala 實作。&lt;/strong&gt;
&lt;br /&gt;
&lt;br /&gt;
對於一些常見的題目，我整理在我的網站上，現在我也將之打包好了，這些題目是熟悉演算法與資料結構的常見題目，原先我整理的目的，就是留給新手入門程式設計時，可以多多查詢與利用，即然打包好了，就上載到這邊給一些新手們下載。。。。&lt;br /&gt;
&lt;br /&gt;
希望一些題目問題，您可以先查查看我打包好的檔案，如果實在不瞭解，請針對您不瞭解的部份，在新手版上提出討論，並詳細的說出您不瞭解的地方，這樣才會有人知道您問題的所在，才會有人幫您。。。。記得，人必自助而後人助之。。。。&lt;img src=&quot;http://www.javaworld.com.tw/jute/images/smiles/smile_shy.gif&quot; alt=&quot;Shy&quot; width=&quot;15,HEIGHT=15&quot; /&gt;
&lt;br /&gt;
&lt;br /&gt;
文件中除了 Java 程式實作之外，還有 C、Python、Scala 語言的實作，使用不同的語言會有不同的特性與思考方式，交相激盪而引發不同的想法，進而引發修改程式的動機，著實是件有趣的事情。。。&lt;br /&gt;
&lt;br /&gt;
&lt;a class=&quot;ilink&quot; href=&quot;http://caterpillar.onlyfun.net/Gossip/AlgorithmGossip/AlgorithmGossip.htm&quot; target=&quot;_blank&quot; class=&quot;ilink&quot;&gt;http://caterpillar.onlyfun.net/Gossip/AlgorithmGossip/AlgorithmGossip.htm&lt;/a&gt;
&lt;/span&gt;
&lt;span style=&quot;color: #ffffff;&quot;&gt;&lt;strong&gt;目」第三版&lt;/strong&gt;
&lt;/span&gt;
&lt;/p&gt;
            &lt;div&gt;
                作者：caterpillar_here 发表于2009-9-21 15:26:00 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/4576314&quot;&gt;原文链接&lt;/a&gt;
            &lt;/div&gt;
            &lt;div&gt;
            阅读：1355 评论：0 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/4576314#comments&quot; target=&quot;_blank&quot;&gt;查看评论&lt;/a&gt;
            &lt;/div&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/638057819/caterpillar_here/csdn.net/s.gif?r=http://blog.csdn.net/caterpillar_here/article/details/4576314&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><pubDate>Mon, 21 Sep 2009 15:26:00 +0800</pubDate><author>caterpillar_here</author><guid isPermaLink="false">http://blog.csdn.net/caterpillar_here/article/details/4576314</guid><dc:creator>caterpillar_here</dc:creator><fs:srclink>http://blog.csdn.net/caterpillar_here/article/details/4576314</fs:srclink><fs:srcfeed>http://blog.csdn.net/caterpillar_here/feed.aspx</fs:srcfeed><fs:itemid>csdn.net/caterpillar_here/~1120633/638057819/1120629</fs:itemid></item><item><title>[原]山寨版 Java 深度歷險</title><link>http://blog.csdn.net/caterpillar_here/article/details/4576307</link><description>&lt;p&gt;&lt;span id=&quot;text265221&quot; class=&quot;javascript&quot;&gt;之所以叫作山寨版 Java 深度歷險，其動機之一，就是彷照 &lt;a class=&quot;ilink&quot; href=&quot;http://www.javaworld.com.tw/roller/moli/date/20060324&quot; target=&quot;_blank&quot; class=&quot;ilink&quot;&gt;Java 深度歷險&lt;/a&gt;
，嘗試將一些市面上的書較少談及的東西寫出來。&lt;br /&gt;
&lt;br /&gt;
至
於章節順序安排，則是我過去經驗中，發現最多人所忽略而引發問題的一些東西，有些問題其實都很基本，但也許是缺少訓練，或是在學習、運用的過程中，欠缺旁
人的提點，而自顧自的用自己的想法實現而導致，這也是為何取名叫「Java 本質部份」的原因，因為那些東西是基本，但很容易被忽略。&lt;br /&gt;
&lt;br /&gt;
目前線上文件，已完成近三分之二的內容，依我的規畫，還有三分之一想寫，寫出來的東西，是我的經驗中，認定應該知道，或者應該這麼解決。&lt;br /&gt;
&lt;br /&gt;
不過我相信有些東西是可以討論的，如果你發現這些地方，歡迎在 &lt;a href=&quot;http://www.javaworld.com.tw/jute/post/view?bid=29&amp;amp;id=265221&amp;amp;sty=1&quot;&gt;討論區&lt;/a&gt;
 不吝提出你的看法！&lt;/span&gt;
&lt;span id=&quot;text265221&quot; class=&quot;javascript&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
文件在：&lt;a class=&quot;ilink&quot; href=&quot;http://caterpillar.onlyfun.net/Gossip/JavaEssence/JavaEssence.html&quot; target=&quot;_blank&quot; class=&quot;ilink&quot;&gt;Java 本質部份&lt;/a&gt;
 
	&lt;/span&gt;

&lt;/p&gt;
            &lt;div&gt;
                作者：caterpillar_here 发表于2009-9-21 15:25:00 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/4576307&quot;&gt;原文链接&lt;/a&gt;
            &lt;/div&gt;
            &lt;div&gt;
            阅读：1659 评论：3 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/4576307#comments&quot; target=&quot;_blank&quot;&gt;查看评论&lt;/a&gt;
            &lt;/div&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/638057818/caterpillar_here/csdn.net/s.gif?r=http://blog.csdn.net/caterpillar_here/article/details/4576307&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><pubDate>Mon, 21 Sep 2009 15:25:00 +0800</pubDate><author>caterpillar_here</author><guid isPermaLink="false">http://blog.csdn.net/caterpillar_here/article/details/4576307</guid><dc:creator>caterpillar_here</dc:creator><fs:srclink>http://blog.csdn.net/caterpillar_here/article/details/4576307</fs:srclink><fs:srcfeed>http://blog.csdn.net/caterpillar_here/feed.aspx</fs:srcfeed><fs:itemid>csdn.net/caterpillar_here/~1120633/638057818/1120629</fs:itemid></item><item><title>[原]EJB3 入門文件（二）</title><link>http://blog.csdn.net/caterpillar_here/article/details/3219981</link><description>&lt;small&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 了解基本的
Session Bean 與 Message-Driven Bean 撰寫方式，接下來看一些生命週期、攔截器、Timer 等服務。&lt;/small&gt;
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;li&gt;&lt;small&gt;生命週期&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;























      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;來看看
Session Bean 與 Message-Driven Bean 的生命週期與回呼方法。&lt;/small&gt;&lt;/div&gt;























      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/StatelessSessionBeanLifeCycle.html&quot;&gt;&lt;small&gt;Stateless
Session Bean 生命週期&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/StatefulSessionBeanLifeCycle.html&quot;&gt;&lt;small&gt;Stateful
Session Bean 生命週期&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/MessageDrivenBeanLifeCycle.html&quot;&gt;Message-Driven Bean
生命週期&lt;/a&gt;&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;small&gt;攔截器（Interceptor）&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;























      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;攔截器可以介入方
法呼叫前後，或是作生命週期回呼，可作一些與商務邏輯無關的額外服務。&lt;/small&gt;&lt;/div&gt;























      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/InterceptorInBean.html&quot;&gt;&lt;small&gt;Bean
中的攔截器&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/InterceptorClass.html&quot;&gt;&lt;small&gt;攔
截器類別&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/LifeCycleInterceptor.html&quot;&gt;&lt;small&gt;生
命週期回呼攔截器&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/InvocationContext.html&quot;&gt;InvocationContext&lt;/a&gt;&lt;br&gt;























            &lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;small&gt;編寫規則&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;























      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;一些瑣瑣碎碎的編
寫規則。&lt;/small&gt;&lt;/div&gt;























      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/SessionBeanCodingRule.html&quot;&gt;&lt;small&gt;Session
Bean&amp;nbsp;編寫規則&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/MessageDrivenBeanCodeRule.html&quot;&gt;Message-Driven
Bean&amp;nbsp;編寫規則&lt;/a&gt;&lt;/small&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/InterceptorCodeRule.html&quot;&gt;&lt;small&gt;攔截器編寫規則&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;small&gt;使用 Timer 服務&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;























      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;Timer
服務是由容器所提供的服務，適用於Stateless Session Bean 與 Message-Driven Bean。&lt;/small&gt;&lt;/div&gt;























      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/TimerServiceABC.html&quot;&gt;&lt;small&gt;簡介 Timer 服務&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/TimerServiceTimer.html&quot;&gt;TimerService 與 Timer 回呼&lt;/a&gt;&lt;br&gt;























            &lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;small&gt;交易&lt;/small&gt;&lt;small&gt;（Transaction）&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;









      
      
      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;看是要使用 CMT 或 BMT 都可以。。XD&lt;/small&gt;&lt;/div&gt;









      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/TransactionABC.html&quot;&gt;&lt;small&gt;簡介交易&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/TransactionDemarcation.html&quot;&gt;&lt;small&gt;簡介交易區間（Transaction Demarcation）&amp;nbsp;&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/ContainerManagedTransaction.html&quot;&gt;&lt;small&gt;使用 CMT（Container-Managed Transaction）&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/Bean-ManagedTransaction.html&quot;&gt;&lt;small&gt;使用 BMT&lt;/small&gt;&lt;small&gt;（Bean-Managed
Transaction）&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;small&gt;安全&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;







      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;驗證（Authentication）交給容器，授權（Authorization）可以用宣告式（Declarative）或編程式（Programmatic）。&lt;/small&gt;&lt;/div&gt;







      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/JavaEESecurityABC.html&quot;&gt;&lt;small&gt;簡介 Java EE 安全&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/DeclarativeSecurity.html&quot;&gt;&lt;small&gt;宣告式安全&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/ProgrammaticSecurity.html&quot;&gt;編程式安全&lt;/a&gt;&lt;br&gt;























            &lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;small&gt;例外處理&lt;/small&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/JavaEEException.html&quot;&gt;&lt;small&gt;簡介 Java EE 例外處理&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/JavaEEExceptionPath.html&quot;&gt;&lt;small&gt;Java EE 例外路徑&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;
            &lt;div&gt;
                作者：caterpillar_here 发表于2008-11-4 17:39:00 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/3219981&quot;&gt;原文链接&lt;/a&gt;
            &lt;/div&gt;
            &lt;div&gt;
            阅读：1662 评论：0 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/3219981#comments&quot; target=&quot;_blank&quot;&gt;查看评论&lt;/a&gt;
            &lt;/div&gt;</description><pubDate>Tue, 04 Nov 2008 17:39:00 +0800</pubDate><author>caterpillar_here</author><guid isPermaLink="false">http://blog.csdn.net/caterpillar_here/article/details/3219981</guid><dc:creator>caterpillar_here</dc:creator><fs:srclink>http://blog.csdn.net/caterpillar_here/article/details/3219981</fs:srclink><fs:srcfeed>http://blog.csdn.net/caterpillar_here/feed.aspx</fs:srcfeed><fs:itemid>csdn.net/caterpillar_here/~1120633/638057817/1120629</fs:itemid></item><item><title>[原]EJB3 入門文件</title><link>http://blog.csdn.net/caterpillar_here/article/details/3087399</link><description>&lt;small&gt;先來寫幾個簡單的範例，看看 Session Bean、Message-Driven Bean 長什麼樣子，怎麼封裝 EJB-JAR、EAR 等。&lt;/small&gt;
      &lt;ul&gt;&lt;li&gt;&lt;small&gt;Session Bean&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;在 EJB3 中寫 Session，簡單的由 Annotation 就可以設定了，並可以利用容器的資源注入來簡化程式撰寫。&lt;/small&gt;&lt;/div&gt;
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/FirstSessionBean.html&quot;&gt;第
一個 Session Bean（單機客戶端）&lt;/a&gt;&lt;/small&gt;&lt;/li&gt;&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/InjectEJB.html&quot;&gt;使
用 @EJB 注入 Bean（單機客戶端）&lt;/a&gt;&lt;/small&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/SessionBeanServlet.html&quot;&gt;&lt;small&gt;第
一個 Session Bean（Servlet 客戶端）&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/InjectEJBServlet.html&quot;&gt;&lt;small&gt;使
用 @EJB 注入 Bean（Servlet 客戶端）&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/RemoteLocal.html&quot;&gt;&lt;small&gt;@Remote
與 @Local&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/StatefulSessionBean.html&quot;&gt;使
用 Stateful Session Bean&lt;/a&gt;&lt;br&gt;










            &lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;small&gt;Message-Driven Bean&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;就是受容器管理的 MessageListener，所以先了解一下 Java Message Service，再來寫個簡單的 Message-Driven Bean。&lt;/small&gt;&lt;/div&gt;
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/MessageConcept.html&quot;&gt;&lt;small&gt;訊息（Message）觀念&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/JavaMessageService.html&quot;&gt;&lt;small&gt;簡介 Java Message Service&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/MessageDrivenBean.html&quot;&gt;&lt;small&gt;第一個 &lt;/small&gt;&lt;small&gt;Message-Driven Bean&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;small&gt;封裝應用程式&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;雖然用 IDE 很方便，但了解一下如何自行封裝 EJB-JAR、EAR 也不錯。&lt;/small&gt;&lt;/div&gt;
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/EJB-JAR.html&quot;&gt;&lt;small&gt;封裝 EJB-JAR&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/EAR.html&quot;&gt;&lt;small&gt;封裝 EAR&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/EJB3Gossip/LoadEARModuleClass.html&quot;&gt;EAR 模組及類別載入&lt;/a&gt;&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;
            &lt;div&gt;
                作者：caterpillar_here 发表于2008-10-16 21:56:00 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/3087399&quot;&gt;原文链接&lt;/a&gt;
            &lt;/div&gt;
            &lt;div&gt;
            阅读：2117 评论：0 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/3087399#comments&quot; target=&quot;_blank&quot;&gt;查看评论&lt;/a&gt;
            &lt;/div&gt;</description><pubDate>Thu, 16 Oct 2008 21:56:00 +0800</pubDate><author>caterpillar_here</author><guid isPermaLink="false">http://blog.csdn.net/caterpillar_here/article/details/3087399</guid><dc:creator>caterpillar_here</dc:creator><fs:srclink>http://blog.csdn.net/caterpillar_here/article/details/3087399</fs:srclink><fs:srcfeed>http://blog.csdn.net/caterpillar_here/feed.aspx</fs:srcfeed><fs:itemid>csdn.net/caterpillar_here/~1120633/638057816/1120629</fs:itemid></item><item><title>[原]GLib 入門</title><link>http://blog.csdn.net/caterpillar_here/article/details/2851491</link><description>&lt;small&gt; &amp;nbsp;&amp;nbsp; &lt;/small&gt;&lt;br&gt;
















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;li&gt;&lt;small&gt;基本型態、巨集、公用（Utility）函式&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;
















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;一些有的沒的常用
函式，先放在一起講......Orz&lt;/small&gt;&lt;/div&gt;
















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GLibBasicTypeMacro.html&quot;&gt;&lt;small&gt;GLib
基本型態與巨集&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GTimer.html&quot;&gt;GTimer&lt;/a&gt;&lt;/small&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/TimeoutIdle.html&quot;&gt;&lt;small&gt;Timeout
與 Idle&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/EnvironmentInfo.html&quot;&gt;&lt;small&gt;環
境資訊&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/Logging.html&quot;&gt;&lt;small&gt;日誌
（Logging）&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;
















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;li&gt;&lt;small&gt;輸入輸出&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;
















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;來了解一些基本檔
案讀寫、目錄資訊的取得方式，以及輸入輸出 Channel 的使用。&lt;/small&gt;&lt;/div&gt;
















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/BasicFileRW.html&quot;&gt;&lt;small&gt;基
本檔案讀寫&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/DirOp.html&quot;&gt;&lt;small&gt;目錄資訊&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GIOChannelFile.html&quot;&gt;&lt;small&gt;GIOChannel
與 檔案處理&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GIOChannelPipe.html&quot;&gt;GIOChannel
與 Pipe&lt;/a&gt;&lt;br&gt;
















            &lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;small&gt;資料結構、記憶體配置&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;
















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;來看看
GLib 提供了哪些常用的資料結構處理及動態記憶體配置函式。&lt;/small&gt;&lt;/div&gt;
















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GString.html&quot;&gt;&lt;small&gt;GString&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GArrayGPtrArrayGByteArray.html&quot;&gt;GArray、GPtrArray、
GByteArray&lt;/a&gt;&lt;br&gt;
















            &lt;/small&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GSListGList.html&quot;&gt;&lt;small&gt;GSList、GList&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GHashTable.html&quot;&gt;&lt;small&gt;GHashTable&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GTreeGNode.html&quot;&gt;&lt;small&gt;GTree 與 GNode&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/MemoryAllocation.html&quot;&gt;&lt;small&gt;記憶體配置&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;







      
      
      
      
      
      
      
      &lt;ul&gt;&lt;li&gt;&lt;small&gt;執
行緒&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;






      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small&gt;GLib 提供了 GThread 作為多執行緒的支援。&lt;/small&gt;&lt;/div&gt;






      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GThread.html&quot;&gt;&lt;small&gt;GThread&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GMutex.html&quot;&gt;&lt;small&gt;GMutex&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GCond.html&quot;&gt;&lt;small&gt;GCond&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;
            &lt;div&gt;
                作者：caterpillar_here 发表于2008-8-30 10:13:00 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/2851491&quot;&gt;原文链接&lt;/a&gt;
            &lt;/div&gt;
            &lt;div&gt;
            阅读：2564 评论：0 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/2851491#comments&quot; target=&quot;_blank&quot;&gt;查看评论&lt;/a&gt;
            &lt;/div&gt;</description><pubDate>Sat, 30 Aug 2008 10:13:00 +0800</pubDate><author>caterpillar_here</author><guid isPermaLink="false">http://blog.csdn.net/caterpillar_here/article/details/2851491</guid><dc:creator>caterpillar_here</dc:creator><fs:srclink>http://blog.csdn.net/caterpillar_here/article/details/2851491</fs:srclink><fs:srcfeed>http://blog.csdn.net/caterpillar_here/feed.aspx</fs:srcfeed><fs:itemid>csdn.net/caterpillar_here/~1120633/638057815/1120629</fs:itemid></item><item><title>[原]GTK 常用圖形元件</title><link>http://blog.csdn.net/caterpillar_here/article/details/2753030</link><description>&lt;font size=&quot;3&quot;&gt;元件講是講不完的，這邊主要在簡介幾個
元件作用。&lt;/font&gt;
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;按鈕&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;






















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;font size=&quot;3&quot;&gt;按鈕是視窗
程式中最基本的元件。&lt;/font&gt;&lt;/div&gt;






















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkButtonGtkToggleButton.html&quot;&gt;GtkButton
與 GtkToggleButton&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/ButtonWithImage.html&quot;&gt;影
像及文字按鈕&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkCheckButtonGtkRadioButton.html&quot;&gt;GtkCheckButton
與 GtkRadioButton&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;對話方塊&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;






















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;font size=&quot;3&quot;&gt;對話方塊用來與使
用者作簡單的訊息交換與溝通。&lt;/font&gt;&lt;/div&gt;






















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkMessageDialog.html&quot;&gt;GtkMessageDialog&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkAboutDialog.html&quot;&gt;GtkAboutDialog&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkColorButtonColorSelectionDialog.html&quot;&gt;GtkColorButton
與 GtkColorSelectionDialog&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkFontButtonFontSelectionDialog.html&quot;&gt;GtkFontButton
與 GtkFontSelectionDialog&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkFileChooserButtonFileChooserDialog.html&quot;&gt;GtkFileChooserButton
與 GtkFileChooserDialog&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkDialog.html&quot;&gt;使
用 GtkDialog 自訂對話方塊&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;文字欄位&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;






















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;font size=&quot;3&quot;&gt;文字欄位是使用者
輸入資訊的基本元件。&lt;/font&gt;&lt;/div&gt;






















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkEntry.html&quot;&gt;GtkEntry&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkSpinButton.html&quot;&gt;GtkSpinButton&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkTextView.html&quot;&gt;GtkTextView&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;選項清單&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;






















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;font size=&quot;3&quot;&gt;這邊的選項清單元
件，遵守 MVC 設計，使用上較為複雜但應用彈性大。&lt;/font&gt;&lt;/div&gt;






















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkComboBox.html&quot;&gt;GtkComboBox&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkComboBoxGtkListStore.html&quot;&gt;GtkComboBox
與 GtkListStore&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkComboBoxGtkTreeStore.html&quot;&gt;GtkComboBox
與 GtkTreeStore&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkTreeViewGtkListStore.html&quot;&gt;GtkTreeView 與
GtkListStore&lt;/a&gt;&lt;br&gt;






















            &lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkTreeViewGtkTreeStrore.html&quot;&gt;GtkTreeView 與
GtkTreeStrore&lt;/a&gt;&lt;br&gt;






















            &lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;版面元件&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;






















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;font size=&quot;3&quot;&gt;除了上面介紹的三
種基本版面配置之外，還可以使用一些版面元件來協助元件的群組與版面的切割。&lt;/font&gt;&lt;/div&gt;






















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkNotebook.html&quot;&gt;GtkNotebook&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkPaned.html&quot;&gt;GtkPaned&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkScrolledWindow.html&quot;&gt;GtkScrolledWindow&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkAlignmentGtkFixedGtkLayout.html&quot;&gt;GtkAlignment、GtkFixed 與 GtkLayout&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkFrameGtkAspectFrame.html&quot;&gt;GtkFrame 與 GtkAspectFrame&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;選單元件&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;













      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;font size=&quot;3&quot;&gt;選單是視窗程式最常見的功能了。&lt;/font&gt;&lt;/div&gt;













      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkHandleBox.html&quot;&gt;GtkHandleBox&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkMenuBarGtkMenuGtkMenuItem.html&quot;&gt;GtkMenuBar、GtkMenu 與 GtkMenuItem&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkCheckMenuItemGtkRadioMenuItemGtkTearoffMenuItem.html&quot;&gt;GtkCheckMenuItem、GtkRadioMenuItem 與&amp;nbsp;GtkTearoffMenuItem&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkUIManager.html&quot;&gt;GtkUIManager&lt;/a&gt;&lt;br&gt;









            &lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;其它常用元件&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;






















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;font size=&quot;3&quot;&gt;簇繁不及備
載...Orz...&lt;/font&gt;&lt;/div&gt;






















      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      &lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkLabel.html&quot;&gt;GtkLabel&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkScale.html&quot;&gt;GtkScale&lt;/a&gt;&lt;br&gt;


            &lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkProgressBar.html&quot;&gt;GtkProgressBar&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkToolBar.html&quot;&gt;GtkToolBar&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font size=&quot;3&quot;&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkStatusBar.html&quot;&gt;GtkStatusBar&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;


      &lt;small&gt;&lt;br&gt;&lt;/small&gt;
            &lt;div&gt;
                作者：caterpillar_here 发表于2008-8-1 12:47:00 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/2753030&quot;&gt;原文链接&lt;/a&gt;
            &lt;/div&gt;
            &lt;div&gt;
            阅读：1882 评论：1 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/2753030#comments&quot; target=&quot;_blank&quot;&gt;查看评论&lt;/a&gt;
            &lt;/div&gt;</description><pubDate>Fri, 01 Aug 2008 12:47:00 +0800</pubDate><author>caterpillar_here</author><guid isPermaLink="false">http://blog.csdn.net/caterpillar_here/article/details/2753030</guid><dc:creator>caterpillar_here</dc:creator><fs:srclink>http://blog.csdn.net/caterpillar_here/article/details/2753030</fs:srclink><fs:srcfeed>http://blog.csdn.net/caterpillar_here/feed.aspx</fs:srcfeed><fs:itemid>csdn.net/caterpillar_here/~1120633/638057814/1120629</fs:itemid></item><item><title>[原]Windows 下第一個 GTK 程式</title><link>http://blog.csdn.net/caterpillar_here/article/details/2722878</link><description>&lt;small&gt;在
這邊說明一下如何在Windows作業系統之下撰寫、編譯GTK，GTK使用GLib、cairo、Pango、ATK、GTK+、gettext-
runtime、libpng、libjpeg、libtiff與zlib，所以您必須也取得這些套件，在GTK官方網站的 &lt;a href=&quot;http://www.gtk.org/download-windows.html&quot;&gt;Windows Download&lt;/a&gt; 中可以取得，最簡單的方法是取得all-in-one&amp;nbsp; bundle。&lt;br&gt;
      &lt;br&gt;
以下說明安裝的步驟：&lt;br&gt;
      &lt;/small&gt;&lt;ol&gt;&lt;li&gt;&lt;small&gt;在 &lt;a href=&quot;http://www.mingw.org/&quot;&gt;http://www.mingw.org/&lt;/a&gt; 下載 MingGW&lt;/small&gt;&lt;/li&gt;&lt;li&gt;&lt;small&gt;
在GTK官網中取得 &lt;/small&gt;&lt;a href=&quot;http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.12/gtk+-bundle-2.12.11.zip&quot;&gt;&lt;small&gt;all-in-one&amp;nbsp; bundle&lt;/small&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;small&gt;安裝 MinGW，選擇安裝base tools、g++ 及 make&lt;/small&gt;&lt;/li&gt;&lt;li&gt;&lt;small&gt;解開all-in-one bundle&lt;/small&gt;&lt;/li&gt;&lt;li&gt;&lt;small&gt;在環境變數PATH中加入MinGW的bin路徑與解開後的GTK之bin路徑&lt;/small&gt;&lt;/li&gt;&lt;/ol&gt;
      
      &lt;small&gt;&lt;br&gt;
      &lt;/small&gt;&lt;small&gt;這樣就完成Windows下撰寫GTK所需的安裝了，您可以執行以下的指令取得include目錄資訊並儲存至inc.txt：&lt;/small&gt;
      &lt;table style=&quot;text-align: left; width: 100%;&quot; border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;2&quot;&gt;









        &lt;tbody&gt;









          &lt;tr&gt;









            &lt;td style=&quot;background-color: rgb(0, 0, 0);&quot;&gt;&lt;small style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;$ pkg-config --cflags --libs gtk+-2.0 &amp;gt; inc.txt&lt;/span&gt;&lt;/small&gt;&lt;br&gt;




            &lt;/td&gt;





          &lt;/tr&gt;





        
        
        
        
        
        &lt;/tbody&gt;
      
      
      
      
      
      &lt;/table&gt;





      &lt;br&gt;
      &lt;small&gt;執行以下的指令取得lib目錄資訊並儲存至lib.txt：&lt;br&gt;
      &lt;/small&gt;
      &lt;table style=&quot;text-align: left; width: 100%;&quot; border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;2&quot;&gt;









        &lt;tbody&gt;









          &lt;tr&gt;









            &lt;td style=&quot;background-color: rgb(0, 0, 0);&quot;&gt;&lt;small style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;$ pkg-config --libs --libs gtk+-2.0 &amp;gt; lib.txt&lt;/span&gt;&lt;/small&gt;&lt;br&gt;




            &lt;/td&gt;





          &lt;/tr&gt;





        
        
        
        
        
        &lt;/tbody&gt;
      
      
      
      
      
      &lt;/table&gt;




      &lt;br&gt;











      &lt;span class=&quot;postbody&quot;&gt;&lt;small&gt;為了方便起見，可撰寫一個簡單的Makefile如下，並將方才的inc.txt與lib.txt之內容分別設定給CFLAGS與LIBS：&lt;br&gt;
      &lt;/small&gt;&lt;/span&gt;
      &lt;ul&gt;&lt;li&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;small&gt;Makefile&lt;/small&gt;&lt;/span&gt;&lt;br&gt;
        &lt;/li&gt;&lt;/ul&gt;
      &lt;pre&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;CC&lt;/span&gt; = gcc&lt;br&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;CFLAGS&lt;/span&gt; = -mms-bitfields -IC:/Winware/Gtk/include/gtk-2.0&lt;br&gt; -IC:/Winware/Gtk/lib/gtk-2.0/include -IC:/Winware/Gtk/include/atk-1.0&lt;br&gt; -IC:/Winware/Gtk/include/cairo -IC:/Winware/Gtk/include/pango-1.0&lt;br&gt; -IC:/Winware/Gtk/include/glib-2.0 -IC:/Winware/Gtk/lib/glib-2.0/include&lt;br&gt; -IC:/Winware/Gtk/include/libpng12&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;LIBS&lt;/span&gt; = -LC:/Winware/Gtk/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0&lt;br&gt; -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo&lt;br&gt; -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl&lt;br&gt;&lt;br&gt;main:&lt;br&gt;        $(CC) foo.c -o foo.exe $(CFLAGS) $(LIBS)&lt;/pre&gt;
      &lt;span class=&quot;postbody&quot;&gt;&lt;small&gt;&lt;br&gt;
然後您可以撰寫一個簡單的GTK程式：&lt;br&gt;
      &lt;/small&gt;&lt;/span&gt;
      &lt;ul&gt;&lt;li&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;small&gt;foo.c&lt;/small&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;
      &lt;pre&gt;#include &amp;lt;gtk/gtk.h&amp;gt;&lt;br&gt;&lt;br&gt;int main(int argc, char *argv[]) {&lt;br&gt;    GtkWidget *window;&lt;br&gt;&lt;br&gt;    gtk_init(&amp;amp;argc, &amp;amp;argv);&lt;br&gt;    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);&lt;br&gt;    gtk_window_set_title(GTK_WINDOW(window), &quot;哈囉！GTK+！&quot;);&lt;br&gt;    gtk_widget_show(window);&lt;br&gt;    gtk_main();&lt;br&gt;&lt;br&gt;    return 0;&lt;br&gt;}&lt;/pre&gt;
      &lt;span class=&quot;postbody&quot;&gt;&lt;br&gt;
      &lt;small&gt;為了可以顯示中文，您的檔案必須以UTF-8存檔（檔首無BOM），接著執行make指令：&lt;br&gt;
      &lt;/small&gt;&lt;/span&gt;
      &lt;table style=&quot;text-align: left; width: 100%;&quot; border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;2&quot;&gt;









        &lt;tbody&gt;









          &lt;tr&gt;









            &lt;td style=&quot;background-color: rgb(0, 0, 0);&quot;&gt;&lt;small style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;$ make&lt;br&gt;
            &lt;/span&gt;gcc foo.c -o foo.exe -mms-bitfields -IC:/Winware/Gtk/include/gtk-2.0 -IC:/Winwar&lt;br&gt;
e/Gtk/lib/gtk-2.0/include -IC:/Winware/Gtk/include/atk-1.0 -IC:/Winware/Gtk/incl&lt;br&gt;
ude/cairo -IC:/Winware/Gtk/include/pango-1.0 -IC:/Winware/Gtk/include/glib-2.0 -&lt;br&gt;
IC:/Winware/Gtk/lib/glib-2.0/include -IC:/Winware/Gtk/include/libpng12 -LC:/Winw&lt;br&gt;
are/Gtk/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangowi&lt;br&gt;
n32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0&lt;br&gt;
&amp;nbsp;-lglib-2.0 -lintl&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br&gt;
            &lt;/span&gt;&lt;/small&gt;



            &lt;/td&gt;





          &lt;/tr&gt;





        
        
        
        
        
        &lt;/tbody&gt;
      
      
      
      
      
      &lt;/table&gt;&lt;p&gt;




      &lt;br&gt;
      &lt;span class=&quot;postbody&quot;&gt;&lt;small&gt;程式將產生foo.exe，執行後的結果如下所示：&lt;/small&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;img src=&quot;http://www.javaworld.com.tw/roller/caterpillar/resource/FirstGTKWindows-1.jpg&quot; vspace=&quot;0&quot; align=&quot;baseline&quot; border=&quot;0&quot; hspace=&quot;0&quot;&gt;&lt;/p&gt;
            &lt;div&gt;
                作者：caterpillar_here 发表于2008-7-28 11:04:00 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/2722878&quot;&gt;原文链接&lt;/a&gt;
            &lt;/div&gt;
            &lt;div&gt;
            阅读：2597 评论：3 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/2722878#comments&quot; target=&quot;_blank&quot;&gt;查看评论&lt;/a&gt;
            &lt;/div&gt;</description><pubDate>Mon, 28 Jul 2008 11:04:00 +0800</pubDate><author>caterpillar_here</author><guid isPermaLink="false">http://blog.csdn.net/caterpillar_here/article/details/2722878</guid><dc:creator>caterpillar_here</dc:creator><fs:srclink>http://blog.csdn.net/caterpillar_here/article/details/2722878</fs:srclink><fs:srcfeed>http://blog.csdn.net/caterpillar_here/feed.aspx</fs:srcfeed><fs:itemid>csdn.net/caterpillar_here/~1120633/638057813/1120629</fs:itemid></item><item><title>[原]GtkTreeView</title><link>http://blog.csdn.net/caterpillar_here/article/details/2646689</link><description>&lt;small&gt;在看這篇之前，請先看過&lt;/small&gt; &lt;a style=&quot;font-size: 10pt;&quot; href=&quot;http://blog.csdn.net/caterpillar_here/archive/2008/07/10/2632833.aspx&quot;&gt;GtkComboBox 與 GtkListStore&lt;/a&gt;&lt;small&gt;，由於以Model-View的方式設計，您可以在不修改Model的情況下，為Model換上另一個顯示的外觀（View），例如為 &lt;/small&gt;&lt;a style=&quot;font-size: 10pt;&quot; href=&quot;http://blog.csdn.net/caterpillar_here/archive/2008/07/10/2632833.aspx&quot;&gt;GtkComboBox 與 GtkListStore&lt;/a&gt;&lt;font size=&quot;2&quot;&gt;&lt;a style=&quot;text-decoration: none; color: rgb(106, 106, 106);&quot; href=&quot;http://www.javaworld.com.tw/roller/caterpillar/entry/gtkcombobox&quot;&gt;&lt;/a&gt;&lt;/font&gt;&lt;small&gt;&lt;big&gt; &lt;small&gt;範例中建立的GtkListStore換上GtkTreeView的外觀。&lt;br&gt;
      &lt;br&gt;
具體來說，也就是該範例中的createModel()內容無需改變，將GtkComboBox的相對應程式碼，換成建立GtkTreeView的程式碼，例如：&lt;br&gt;
      &lt;/small&gt;&lt;/big&gt;&lt;/small&gt;
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;GtkWidget *treeView = gtk_tree_view_new_with_model(createModel());&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new();&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes(&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&quot;Icon&quot;, renderer,&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &quot;pixbuf&quot;,
PIXBUF_COL,&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
NULL);&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;gtk_tree_view_append_column(GTK_TREE_VIEW (treeView), column);&lt;br&gt;
      &lt;br&gt;
renderer = gtk_cell_renderer_text_new();&lt;br&gt;
column = gtk_tree_view_column_new_with_attributes(&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;Filename&quot;, renderer,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;text&quot;, TEXT_COL,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NULL);&lt;br&gt;
gtk_tree_view_append_column(GTK_TREE_VIEW (treeView), column);&lt;br&gt;
      &lt;br&gt;
      &lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;/div&gt;
      &lt;small&gt;&lt;big&gt;&lt;small&gt;GtkTreeViewColumn是GtkTreeView中的列代表，可用以設定該列的內容如何
繪製以及一些相關屬性，基本上以上程式片段中，gtk_tree_view_column_new_with_attributes()與
gtk_tree_view_append_column()函式可以用
gtk_tree_view_insert_column_with_attributes()函式來簡化，也就是可以簡化為：&lt;br&gt;
      &lt;/small&gt;&lt;/big&gt;&lt;/small&gt;
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small style=&quot;font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;GtkWidget *treeView = gtk_tree_view_new_with_model(createModel());&lt;/span&gt;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;GtkCellRenderer *&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;small style=&quot;font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;renderer = gtk_cell_renderer_pixbuf_new();&lt;/span&gt;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;gtk_tree_view_insert_column_with_attributes(&lt;/span&gt;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GTK_TREE_VIEW(treeView), -1, &quot;Icon&quot;, renderer,&lt;/span&gt;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;pixbuf&quot;, PIXBUF_COL,&lt;/span&gt;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NULL);&lt;/span&gt;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;renderer = gtk_cell_renderer_text_new();&lt;/span&gt;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;gtk_tree_view_insert_column_with_attributes(&lt;/span&gt;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GTK_TREE_VIEW(treeView), -1, &quot;Filename&quot;, renderer,&lt;/span&gt;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;text&quot;, TEXT_COL,&lt;/span&gt;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NULL);&lt;/span&gt;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br&gt;
      &lt;/div&gt;
      &lt;small&gt;&lt;big&gt;&lt;small&gt;&lt;br&gt;
在GtkTreeView當中的選擇，是以為個GtkTreeSelection物件作代表，當選擇改變時，會發出&quot;changed&quot;的Signal，所以要連結Signal與Callback函式，可以如下進行：&lt;br&gt;
      &lt;/small&gt;&lt;/big&gt;&lt;/small&gt;
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small style=&quot;font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeView));&lt;/span&gt;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;g_signal_connect(G_OBJECT(selection), &quot;changed&quot;,&lt;/span&gt;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
G_CALLBACK(selection_changed), label);&lt;/span&gt;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br&gt;
      &lt;/div&gt;
      &lt;small&gt;&lt;big&gt;&lt;small&gt;&lt;br&gt;
至於Callback函式的部份大同小異，您要從傳遞的GtkTreeSelection中取得GtkTreeView，從GtkTreeView中取得
GtkTreeModel，再使用gtk_tree_selection_get_selected()將GtkTreeIter指向選中的列，以取得您
想取得的欄位資料：&lt;br&gt;
      &lt;/small&gt;&lt;/big&gt;&lt;/small&gt;
      &lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;gboolean selection_changed(GtkTreeSelection *selection, GtkLabel *label) {&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GtkTreeView *treeView;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GtkTreeModel *model;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GtkTreeIter iter;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gchar *active;&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; treeView = gtk_tree_selection_get_tree_view(selection);&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; model = gtk_tree_view_get_model(treeView);&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gtk_tree_selection_get_selected(selection, &amp;amp;model, &amp;amp;iter);&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gtk_tree_model_get(model, &amp;amp;iter,&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
1, &amp;amp;active,&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
-1);&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gtk_label_set_text(label, active);&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;
      &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&lt;big&gt;&lt;small&gt;}&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;br&gt;
      &lt;/div&gt;
      &lt;small&gt;&lt;big&gt;&lt;small&gt;&lt;br&gt;
下面的範例是以上說明的綜合示範：&lt;br&gt;
      &lt;/small&gt;&lt;/big&gt;&lt;/small&gt;
      &lt;ul&gt;&lt;li&gt;&lt;small&gt;&lt;big&gt;&lt;small&gt;gtk_tree_view_demo.c&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;
      &lt;pre&gt;#include &amp;lt;gtk/gtk.h&amp;gt;&lt;br&gt;&lt;br&gt;enum {&lt;br&gt;    PIXBUF_COL,&lt;br&gt;    TEXT_COL&lt;br&gt;};&lt;br&gt;&lt;br&gt;GtkTreeModel* createModel() {&lt;br&gt;    const gchar *files[] = {&quot;caterpillar.jpg&quot;, &quot;momor.jpg&quot;,&lt;br&gt;                            &quot;hamimi.jpg&quot;, &quot;bush.jpg&quot;};&lt;br&gt;    GdkPixbuf *pixbuf;&lt;br&gt;    GtkTreeIter iter;&lt;br&gt;    GtkListStore *store;&lt;br&gt;    gint i;&lt;br&gt;&lt;br&gt;    store = gtk_list_store_new(2, GDK_TYPE_PIXBUF, G_TYPE_STRING);&lt;br&gt;&lt;br&gt;    for(i = 0; i &amp;lt; 4; i++) {&lt;br&gt;        pixbuf = gdk_pixbuf_new_from_file(files[i], NULL);&lt;br&gt;        gtk_list_store_append(store, &amp;amp;iter);&lt;br&gt;        gtk_list_store_set(store, &amp;amp;iter,&lt;br&gt;                           PIXBUF_COL, pixbuf,&lt;br&gt;                           TEXT_COL, files[i],&lt;br&gt;		           -1);       &lt;br&gt;        gdk_pixbuf_unref(pixbuf);&lt;br&gt;    }&lt;br&gt;&lt;br&gt;    return GTK_TREE_MODEL(store);&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;gboolean selection_changed(GtkTreeSelection *selection, GtkLabel *label) {&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    GtkTreeView *treeView;&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    GtkTreeModel *model;&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    GtkTreeIter iter;&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    gchar *active;&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    &lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    treeView = gtk_tree_selection_get_tree_view(selection);&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    model = gtk_tree_view_get_model(treeView);&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    gtk_tree_selection_get_selected(selection, &amp;amp;model, &amp;amp;iter);&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    gtk_tree_model_get(model, &amp;amp;iter,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;                       1, &amp;amp;active,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;                       -1);&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    gtk_label_set_text(label, active);&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;int main(int argc, char *argv[]) {&lt;br&gt;    GtkWidget *window;&lt;br&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    GtkWidget *treeView;&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;    GtkCellRenderer *renderer;&lt;br&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    GtkTreeViewColumn *column;&lt;/span&gt;&lt;br&gt;    GtkWidget *label;&lt;br&gt;    GtkWidget *vbox;&lt;br&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    GtkTreeSelection *selection;&lt;/span&gt;&lt;br&gt;&lt;br&gt;    gtk_init(&amp;amp;argc, &amp;amp;argv);&lt;br&gt;&lt;br&gt;    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);&lt;br&gt;    gtk_window_set_title(GTK_WINDOW(window), &quot;GtkTreeView&quot;);&lt;br&gt;    gtk_window_set_default_size(GTK_WINDOW(window), 200, 50);&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    treeView = gtk_tree_view_new_with_model(createModel());&lt;/span&gt;&lt;br&gt;&lt;br&gt;    renderer = gtk_cell_renderer_pixbuf_new();&lt;br&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    column = gtk_tree_view_column_new_with_attributes(&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;                     &quot;Icon&quot;, renderer, &lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;                     &quot;pixbuf&quot;, PIXBUF_COL,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;                      NULL);&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    gtk_tree_view_append_column(GTK_TREE_VIEW (treeView), column);&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;br&gt;    renderer = gtk_cell_renderer_text_new();&lt;br&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    column = gtk_tree_view_column_new_with_attributes(&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;                     &quot;Filename&quot;, renderer,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;                     &quot;text&quot;, TEXT_COL,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;                      NULL);&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    gtk_tree_view_append_column(GTK_TREE_VIEW (treeView), column);&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;br&gt;    label = gtk_label_new(&quot;caterpillar.jpg&quot;);&lt;br&gt;    vbox = gtk_vbox_new(FALSE, 5);&lt;br&gt;&lt;br&gt;    gtk_box_pack_start(GTK_BOX(vbox), treeView, TRUE, TRUE, 5);&lt;br&gt;    gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 5);&lt;br&gt;    gtk_container_add(GTK_CONTAINER(window), vbox);&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeView));&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    g_signal_connect(G_OBJECT(selection), &quot;changed&quot;,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;                     G_CALLBACK(selection_changed), label);&lt;/span&gt;&lt;br&gt;&lt;br&gt;    g_signal_connect(GTK_OBJECT(window), &quot;destroy&quot;,&lt;br&gt;                     G_CALLBACK(gtk_main_quit), NULL);&lt;br&gt;&lt;br&gt;    gtk_widget_show_all(window);&lt;br&gt;&lt;br&gt;    gtk_main();&lt;br&gt;&lt;br&gt;    return 0;&lt;br&gt;}&lt;/pre&gt;&lt;p&gt;
      &lt;small&gt;&lt;big&gt;&lt;small&gt;&lt;br&gt;
      &lt;/small&gt;&lt;/big&gt;&lt;/small&gt;










      &lt;span class=&quot;postbody&quot;&gt;&lt;small&gt;一個執行的結果畫面如下所示：&lt;br&gt;
      &lt;br&gt;
      &lt;img style=&quot;width: 354px; height: 269px;&quot; src=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/images/GtkTreeViewGtkListStore-1.jpg&quot;&gt;&lt;/small&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;small&gt;有了以上的基礎，要在GtkTreeView搭配GtkTreeStore就沒什麼好解釋的了，下面這個範例，只是將&lt;/small&gt;&lt;small&gt;範例中的createModel()函式，換成&amp;nbsp;&lt;/small&gt; &lt;a style=&quot;font-size: 10pt;&quot; href=&quot;http://blog.csdn.net/caterpillar_here/archive/2008/07/11/2637854.aspx&quot;&gt;GtkComboBox 與 GtkTreeStore &lt;/a&gt;&lt;small&gt;中的createModel()函式，剩下的都沒有改變，也就是為&lt;/small&gt;&lt;a style=&quot;font-size: 10pt;&quot; href=&quot;http://blog.csdn.net/caterpillar_here/archive/2008/07/11/2637854.aspx&quot;&gt; GtkComboBox 與 GtkTreeStore&lt;/a&gt;&lt;small&gt;&lt;big&gt;&lt;small&gt; 中的Model換上GtkTreeView的外觀顯示&lt;/small&gt;&lt;/big&gt;&lt;/small&gt;&lt;small&gt;：&lt;/small&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;small&gt;gtk_tree_view_with_tree_store.c&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;
      &lt;pre&gt;#include &amp;lt;gtk/gtk.h&amp;gt;&lt;br&gt;&lt;br&gt;enum {&lt;br&gt;    PIXBUF_COL,&lt;br&gt;    TEXT_COL&lt;br&gt;};&lt;br&gt;&lt;br&gt;GtkTreeModel* createModel() {&lt;br&gt;    const gchar *files[] = {&quot;caterpillar.jpg&quot;, &quot;momor.jpg&quot;,&lt;br&gt;                            &quot;hamimi.jpg&quot;, &quot;bush.jpg&quot;};&lt;br&gt;    gchar *stocks[] = {&lt;br&gt;        GTK_STOCK_DIALOG_WARNING,&lt;br&gt;        GTK_STOCK_STOP,&lt;br&gt;        GTK_STOCK_NEW,&lt;br&gt;        GTK_STOCK_CLEAR,&lt;br&gt;        GTK_STOCK_OPEN    &lt;br&gt;    };&lt;br&gt;&lt;br&gt;    gchar *stockNames[] = {&lt;br&gt;        &quot;WARNING&quot;,&lt;br&gt;        &quot;STOP&quot;,&lt;br&gt;        &quot;NEW&quot;,&lt;br&gt;        &quot;GTK_STOCK_CLEAR&quot;,&lt;br&gt;        &quot;GTK_STOCK_OPEN&quot;&lt;br&gt;    };&lt;br&gt;&lt;br&gt;    GtkWidget *cellView;&lt;br&gt;    GdkPixbuf *pixbuf;&lt;br&gt;    GtkTreeIter iter1, iter2;&lt;br&gt;    GtkTreeStore *store;&lt;br&gt;    gint i, j, s;&lt;br&gt;&lt;br&gt;    store = gtk_tree_store_new(2, GDK_TYPE_PIXBUF, G_TYPE_STRING);&lt;br&gt;    cellView = gtk_cell_view_new();&lt;br&gt;    for(i = 0; i &amp;lt; 4; i++) {&lt;br&gt;        pixbuf = gdk_pixbuf_new_from_file(files[i], NULL);&lt;br&gt;        gtk_tree_store_append(store, &amp;amp;iter1, NULL);&lt;br&gt;        gtk_tree_store_set(store, &amp;amp;iter1,&lt;br&gt;                           PIXBUF_COL, pixbuf,&lt;br&gt;                           TEXT_COL, files[i],&lt;br&gt;		           -1);&lt;br&gt;        gdk_pixbuf_unref(pixbuf);&lt;br&gt;&lt;br&gt;        for(j = 0; j &amp;lt; 3; j++) {&lt;br&gt;            s = rand() % 5;&lt;br&gt;            pixbuf = gtk_widget_render_icon(cellView, stocks[s],&lt;br&gt;					   GTK_ICON_SIZE_BUTTON, NULL);&lt;br&gt;            gtk_tree_store_append(store, &amp;amp;iter2, &amp;amp;iter1);&lt;br&gt;            gtk_tree_store_set(store, &amp;amp;iter2, &lt;br&gt;                               PIXBUF_COL, pixbuf,&lt;br&gt;                               TEXT_COL, stockNames[s],&lt;br&gt;                              -1);&lt;br&gt;             gdk_pixbuf_unref(pixbuf);&lt;br&gt;        }&lt;br&gt;    }&lt;br&gt;&lt;br&gt;    return GTK_TREE_MODEL(store);&lt;br&gt;}&lt;br&gt;&lt;br&gt;gboolean selection_changed(GtkTreeSelection *selection, GtkLabel *label) {&lt;br&gt;    GtkTreeView *treeView;&lt;br&gt;    GtkTreeModel *model;&lt;br&gt;    GtkTreeIter iter;&lt;br&gt;    gchar *active;&lt;br&gt;    &lt;br&gt;    treeView = gtk_tree_selection_get_tree_view(selection);&lt;br&gt;    model = gtk_tree_view_get_model(treeView);&lt;br&gt;    gtk_tree_selection_get_selected(selection, &amp;amp;model, &amp;amp;iter);&lt;br&gt;    gtk_tree_model_get(model, &amp;amp;iter,&lt;br&gt;                       1, &amp;amp;active,&lt;br&gt;                       -1);&lt;br&gt;&lt;br&gt;    gtk_label_set_text(label, active);&lt;br&gt;}&lt;br&gt;&lt;br&gt;int main(int argc, char *argv[]) {&lt;br&gt;    GtkWidget *window;&lt;br&gt;    GtkWidget *treeView;&lt;br&gt;    GtkCellRenderer *renderer;&lt;br&gt;    GtkTreeViewColumn *column;&lt;br&gt;    GtkWidget *label;&lt;br&gt;    GtkWidget *vbox;&lt;br&gt;    GtkTreeSelection *selection;&lt;br&gt;&lt;br&gt;    gtk_init(&amp;amp;argc, &amp;amp;argv);&lt;br&gt;&lt;br&gt;    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);&lt;br&gt;    gtk_window_set_title(GTK_WINDOW(window), &quot;GtkTreeView&quot;);&lt;br&gt;    gtk_window_set_default_size(GTK_WINDOW(window), 200, 50);&lt;br&gt;&lt;br&gt;    treeView = gtk_tree_view_new_with_model(createModel());&lt;br&gt;&lt;br&gt;    renderer = gtk_cell_renderer_pixbuf_new();&lt;br&gt;    column = gtk_tree_view_column_new_with_attributes(&lt;br&gt;                     &quot;Icon&quot;, renderer, &lt;br&gt;                     &quot;pixbuf&quot;, PIXBUF_COL,&lt;br&gt;                      NULL);&lt;br&gt;    gtk_tree_view_append_column(GTK_TREE_VIEW (treeView), column);&lt;br&gt;&lt;br&gt;    renderer = gtk_cell_renderer_text_new();&lt;br&gt;    column = gtk_tree_view_column_new_with_attributes(&lt;br&gt;                     &quot;Filename&quot;, renderer,&lt;br&gt;                     &quot;text&quot;, TEXT_COL,&lt;br&gt;                      NULL);&lt;br&gt;    gtk_tree_view_append_column(GTK_TREE_VIEW (treeView), column);&lt;br&gt;&lt;br&gt;    label = gtk_label_new(&quot;caterpillar.jpg&quot;);&lt;br&gt;    vbox = gtk_vbox_new(FALSE, 5);&lt;br&gt;&lt;br&gt;    gtk_box_pack_start(GTK_BOX(vbox), treeView, TRUE, TRUE, 5);&lt;br&gt;    gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 5);&lt;br&gt;    gtk_container_add(GTK_CONTAINER(window), vbox);&lt;br&gt;&lt;br&gt;    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeView));&lt;br&gt;    g_signal_connect(G_OBJECT(selection), &quot;changed&quot;,&lt;br&gt;                     G_CALLBACK(selection_changed), label);&lt;br&gt;&lt;br&gt;    g_signal_connect(GTK_OBJECT(window), &quot;destroy&quot;,&lt;br&gt;                     G_CALLBACK(gtk_main_quit), NULL);&lt;br&gt;&lt;br&gt;    gtk_widget_show_all(window);&lt;br&gt;&lt;br&gt;    gtk_main();&lt;br&gt;&lt;br&gt;    return 0;&lt;br&gt;}&lt;/pre&gt;
      &lt;small&gt;&lt;br&gt;
一個執行的結果如下所示：&lt;br&gt;
      &lt;/small&gt;










      &lt;span class=&quot;postbody&quot;&gt;&lt;br&gt;
      &lt;img style=&quot;width: 441px; height: 584px;&quot; src=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/images/GtkTreeViewGtkTreeStrore-1.jpg&quot;&gt;&lt;/span&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;
            &lt;div&gt;
                作者：caterpillar_here 发表于2008-7-14 9:08:00 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/2646689&quot;&gt;原文链接&lt;/a&gt;
            &lt;/div&gt;
            &lt;div&gt;
            阅读：3105 评论：1 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/2646689#comments&quot; target=&quot;_blank&quot;&gt;查看评论&lt;/a&gt;
            &lt;/div&gt;</description><pubDate>Mon, 14 Jul 2008 09:08:00 +0800</pubDate><author>caterpillar_here</author><guid isPermaLink="false">http://blog.csdn.net/caterpillar_here/article/details/2646689</guid><dc:creator>caterpillar_here</dc:creator><fs:srclink>http://blog.csdn.net/caterpillar_here/article/details/2646689</fs:srclink><fs:srcfeed>http://blog.csdn.net/caterpillar_here/feed.aspx</fs:srcfeed><fs:itemid>csdn.net/caterpillar_here/~1120633/638057812/1120629</fs:itemid></item><item><title>[原]GtkComboBox 與 GtkTreeStore</title><link>http://blog.csdn.net/caterpillar_here/article/details/2637854</link><description>&lt;p&gt;&lt;font size=&quot;2&quot;&gt;接續 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/archive/2008/07/10/2632833.aspx&quot;&gt;GtkComboBox 與 GtkListStore&lt;/a&gt;，有了其中的觀念，接下來要使用GtkTreeStore就不是難事了，只是多了父子關係的部份。&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;&lt;small&gt;若想要製作有階層的樹狀結構，則要搭配GtkTreeStore來使用，主要的差別在於，GtkTreeStroe具 有父子節點關係，也因此在加入子節點時，必須指明父節點為誰，加入節點可以使用gtk_tree_store_append()函式，設定節點資料可以使 用gtk_tree_store_set()函式：
       &lt;/small&gt;       &lt;/p&gt;
&lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;void gtk_tree_store_append(GtkTreeStore *tree_store,&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot; /&gt;       &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GtkTreeIter *iter,&lt;/small&gt;&lt;br style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot; /&gt;       &lt;small style=&quot;font-weight: bold; font-family: Courier New,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GtkTreeIter *parent);
 void gtk_tree_store_set(GtkTreeStore *tree_store,
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GtkTreeIter *iter,
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...);
       &lt;/small&gt;&lt;/div&gt;
&lt;small&gt;
 使用gtk_tree_store_append()時若無父節點，則第三個參數設定為NULL，表示這是最上層節點，也因此，您必須有兩個GtkTreeIter，一個指向目前GtkTreeStore中的父節點位置，一個用以指向子節點位置。
       
 下面這個程式改寫 &lt;/small&gt;&lt;a href=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/GtkComboBoxGtkListStore.html&quot;&gt;&lt;small&gt;GtkComboBox 與 GtkListStore&lt;/small&gt;&lt;/a&gt;，&lt;small&gt;使其具有子階層，在GtkComboBox中會以子選單方式呈現，子選單的內容是亂數選取決定的，程式的改寫主要都是在Model的建立部份：
       &lt;/small&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;small&gt;gtk_combo_box_with_tree_demo.c&lt;/small&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;#include &amp;lt;gtk/gtk.h&amp;gt;

enum {
    PIXBUF_COL,
    TEXT_COL
};

GtkTreeModel* createModel() {
    const gchar *files[] = {&amp;quot;caterpillar.jpg&amp;quot;, &amp;quot;momor.jpg&amp;quot;,
                            &amp;quot;hamimi.jpg&amp;quot;, &amp;quot;bush.jpg&amp;quot;};
&lt;span style=&quot;font-weight: bold;&quot;&gt;    gchar *stocks[] = {&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;        GTK_STOCK_DIALOG_WARNING,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;        GTK_STOCK_STOP,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;        GTK_STOCK_NEW,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;        GTK_STOCK_CLEAR,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;        GTK_STOCK_OPEN    &lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    };&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    gchar *stockNames[] = {&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;        &amp;quot;WARNING&amp;quot;,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;        &amp;quot;STOP&amp;quot;,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;        &amp;quot;NEW&amp;quot;,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;        &amp;quot;GTK_STOCK_CLEAR&amp;quot;,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;        &amp;quot;GTK_STOCK_OPEN&amp;quot;&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    };&lt;/span&gt;

&lt;span style=&quot;font-weight: bold;&quot;&gt;    GtkWidget *cellView;&lt;/span&gt;
    GdkPixbuf *pixbuf;
&lt;span style=&quot;font-weight: bold;&quot;&gt;    GtkTreeIter iter1, iter2;&lt;/span&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;    GtkTreeStore *store;&lt;/span&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;    gint i, j, s;&lt;/span&gt;

&lt;span style=&quot;font-weight: bold;&quot;&gt;    store = gtk_tree_store_new(2, GDK_TYPE_PIXBUF, G_TYPE_STRING);&lt;/span&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;    cellView = gtk_cell_view_new();&lt;/span&gt;
    for(i = 0; i &amp;lt; 4; i++) {
        pixbuf = gdk_pixbuf_new_from_file(files[i], NULL);
&lt;span style=&quot;font-weight: bold;&quot;&gt;        gtk_tree_store_append(store, &amp;amp;iter1, NULL);&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;        gtk_tree_store_set(store, &amp;amp;iter1,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;                           PIXBUF_COL, pixbuf,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;                           TEXT_COL, files[i],&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;		           -1);&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;        gdk_pixbuf_unref(pixbuf);

&lt;span style=&quot;font-weight: bold;&quot;&gt;        for(j = 0; j &amp;lt; 3; j++) {&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;            s = rand() % 5;&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;            pixbuf = gtk_widget_render_icon(cellView, stocks[s],&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;					   GTK_ICON_SIZE_BUTTON, NULL);&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;            gtk_tree_store_append(store, &amp;amp;iter2, &amp;amp;iter1);&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;            gtk_tree_store_set(store, &amp;amp;iter2, &lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;                               PIXBUF_COL, pixbuf,&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;                               TEXT_COL, stockNames[s],&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;                              -1);&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;             gdk_pixbuf_unref(pixbuf);&lt;/span&gt;&lt;br style=&quot;font-weight: bold;&quot; /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;        }&lt;/span&gt;
    }

    return GTK_TREE_MODEL(store);
}

gboolean combo_changed(GtkComboBox *comboBox, GtkLabel *label) {
    GtkTreeModel *model = gtk_combo_box_get_model(comboBox);
    GtkTreeIter iter;
    gchar *active;
    gtk_combo_box_get_active_iter(comboBox, &amp;amp;iter);
    gtk_tree_model_get(model, &amp;amp;iter,
                       1, &amp;amp;active,
                       -1);

    gtk_label_set_text(label, active);
}

int main(int argc, char *argv[]) {
    GtkWidget *window;
    GtkWidget *comboBox;
    GtkCellRenderer *renderer;
    GtkWidget *label;
    GtkWidget *vbox;

    gtk_init(&amp;amp;argc, &amp;amp;argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(window), &amp;quot;GtkComboBox&amp;quot;);
    gtk_window_set_default_size(GTK_WINDOW(window), 200, 50);

    comboBox = gtk_combo_box_new_with_model(createModel());
    gtk_combo_box_set_active(GTK_COMBO_BOX(comboBox), 0);
    renderer = gtk_cell_renderer_pixbuf_new();
    gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(comboBox), renderer, FALSE);
    gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(comboBox), renderer,
				   &amp;quot;pixbuf&amp;quot;, PIXBUF_COL, 
				   NULL);
    renderer = gtk_cell_renderer_text_new();
    gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(comboBox), renderer, FALSE);
    gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(comboBox), renderer,
				   &amp;quot;text&amp;quot;, TEXT_COL,
				   NULL);    

    label = gtk_label_new(&amp;quot;caterpillar.jpg&amp;quot;);
    vbox = gtk_vbox_new(TRUE, 5);

    gtk_box_pack_start(GTK_BOX(vbox), comboBox, TRUE, TRUE, 5);
    gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 5);
    gtk_container_add(GTK_CONTAINER(window), vbox);

    g_signal_connect(GTK_OBJECT(comboBox), &amp;quot;changed&amp;quot;,
                     G_CALLBACK(combo_changed), label);

    g_signal_connect(GTK_OBJECT(window), &amp;quot;destroy&amp;quot;,
                     G_CALLBACK(gtk_main_quit), NULL);

    gtk_widget_show_all(window);

    gtk_main();

    return 0;
}&lt;/pre&gt;
&lt;small&gt;
 一個執行的結果如下所示：
       
       &lt;/small&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;small&gt;&lt;img src=&quot;http://caterpillar.onlyfun.net/Gossip/GTKGossip/images/GtkComboBoxGtkTreeStore-1.jpg&quot; style=&quot;width: 546px; height: 295px;&quot; alt=&quot;&quot; /&gt;&lt;/small&gt;
&lt;small&gt;       &lt;/small&gt;&lt;/div&gt;
            &lt;div&gt;
                作者：caterpillar_here 发表于2008-7-11 10:23:00 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/2637854&quot;&gt;原文链接&lt;/a&gt;
            &lt;/div&gt;
            &lt;div&gt;
            阅读：1896 评论：0 &lt;a href=&quot;http://blog.csdn.net/caterpillar_here/article/details/2637854#comments&quot; target=&quot;_blank&quot;&gt;查看评论&lt;/a&gt;
            &lt;/div&gt;</description><pubDate>Fri, 11 Jul 2008 10:23:00 +0800</pubDate><author>caterpillar_here</author><guid isPermaLink="false">http://blog.csdn.net/caterpillar_here/article/details/2637854</guid><dc:creator>caterpillar_here</dc:creator><fs:srclink>http://blog.csdn.net/caterpillar_here/article/details/2637854</fs:srclink><fs:srcfeed>http://blog.csdn.net/caterpillar_here/feed.aspx</fs:srcfeed><fs:itemid>csdn.net/caterpillar_here/~1120633/638057811/1120629</fs:itemid></item></channel></rss>
