You are previewing Foundations of GTK+ Development.
O'Reilly logo
Foundations of GTK+ Development

Book Description

GTK+ is one of the most influential graphical toolkits for the Linux operating system. It is the technology upon which the GNOME and XFCE desktop environments are based, and its crucial to have clear understanding of its complexities to build even a simple Linux desktop application. Foundations of GTK+ Development guides you through these complexities, laying the foundation that will allow you to cross from novice to professional.

Foundations of GTK+ Development is aimed at C programmers and presents numerous real-life examples that you can immediately put to use in your projects. Some familiarity with C programming is assumed, as the book delves into new topics from the beginning. Topics like object inheritance are covered early on to allow for complete understanding of code examples later. And the provided examples are real-life situations that can help you get a head start on your own applications.

Table of Contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Author
  6. Acknowledgments
  7. Introduction
    1. Who Should Read This Book
    2. How This Book Is Organized
    3. Conventions
    4. What You Need
    5. Official Web Site
  8. CHAPTER 1: Getting Started
    1. A Brief History of GTK+
    2. The X Window System
    3. GTK+ and Supporting Libraries
    4. Language Bindings
    5. Installing GTK+
    6. Summary
  9. CHAPTER 2: Your First GTK+ Applications
    1. Hello World
    2. Using GCC and pkg-config to Compile
    3. Extending "Hello World"
    4. Signals and Callbacks
    5. Events
    6. Further GTK+ Functions
    7. Buttons
    8. Widget Properties
    9. Test Your Understanding
    10. Summary
  10. CHAPTER 3: Container Widgets
    1. GtkContainer
    2. Horizontal and Vertical Boxes
    3. Horizontal and Vertical Panes
    4. Tables
    5. Fixed Containers
    6. Expanders
    7. Handle Boxes
    8. Notebooks
    9. Event Boxes
    10. Test Your Understanding
    11. Summary
  11. CHAPTER 4: Basic Widgets
    1. Using Stock Items
    2. Toggle Buttons
    3. Text Entries
    4. Spin Buttons
    5. Horizontal and Vertical Scales
    6. Widget Styles
    7. Additional Buttons
    8. Test Your Understanding
    9. Summary
  12. CHAPTER 5: Dialogs
    1. Creating Your Own Dialogs
    2. Built-in Dialogs
    3. Dialogs with Multiple Pages
    4. Test Your Understanding
    5. Summary
  13. CHAPTER 6: Using GLib
    1. GLib Basics
    2. Message Logging
    3. Memory Management
    4. Utility Functions
    5. The Main Loop
    6. Data Types
    7. Input-Output Channels
    8. Dynamic Modules
    9. Test Your Understanding
    10. Summary
  14. CHAPTER 7: The Text View Widget
    1. Scrolled Windows
    2. Text Views
    3. Text Iterators and Marks
    4. Text Tags
    5. Inserting Images
    6. Inserting Child Widgets
    7. GtkSourceView
    8. Test Your Understanding
    9. Summary
  15. CHAPTER 8: The Tree View Widget
    1. Parts of a Tree View
    2. Using GtkListStore
    3. Using GtkTreeStore
    4. Referencing Rows
    5. Adding Rows and Handling Selections
    6. Editable Text Renderers
    7. Cell Data Functions
    8. Cell Renderers
    9. Test Your Understanding
    10. Summary
  16. CHAPTER 9: Menus and Toolbars
    1. Pop-up Menus
    2. Keyboard Accelerators
    3. Status Bar Hints
    4. Menu Items
    5. Menu Bars
    6. Toolbars
    7. Toolbar Items
    8. Dynamic Menu Creation
    9. Custom Stock Items
    10. Test Your Understanding
    11. Summary
  17. CHAPTER 10: Dynamic User Interfaces
    1. User Interface Design
    2. The Glade User Interface Builder
    3. Using Libglade
    4. Test Your Understanding
    5. Summary
  18. CHAPTER 11: Creating Custom Widgets
    1. Deriving New Widgets
    2. Creating a Widget from Scratch
    3. Implementing Interfaces
    4. Test Your Understanding
    5. Summary
  19. CHAPTER 12: Additional GTK+ Widgets
    1. Drawing Widgets
    2. Calendars
    3. Status Icons
    4. Printing Support
    5. Cairo Drawing Context
    6. Recent Files
    7. Automatic Completion
    8. Test Your Understanding
    9. Summary
  20. CHAPTER 13: Putting It All Together
    1. File Browser
    2. Calculator
    3. Hangman
    4. Ping Utility
    5. Calendar
    6. Further Resources
    7. Summary
  21. APPENDIX A: GTK+ Properties
    1. GTK+ Properties
    2. Child Widget Properties
  22. APPENDIX B: GTK+ Signals
    1. Events
    2. Widget Signals
  23. APPENDIX C: GTK+ Styles
    1. Default RC File Styles
    2. Pango Text Markup Language
    3. GtkTextTag Styles
    4. Widget Style Properties
  24. APPENDIX D: GTK+ Stock Items
  25. APPENDIX E: GError Types
  26. APPENDIX F: Exercise Solutions and Hints
    1. Exercise 2-1. Using Events and Properties
    2. Exercise 2-2. GObject Property System
    3. Exercise 3-1. Using Multiple Containers
    4. Exercise 3-2. Even More Containers
    5. Exercise 4-1. Renaming Files
    6. Exercise 4-2. Spin Buttons and Scales
    7. Exercise 5-1. Implementing File Chooser Dialogs
    8. Exercise 6-1. Working with Files
    9. Exercise 6-2. Timeout Functions
    10. Exercise 7-1. Text Editor
    11. Exercise 8-1. File Browser
    12. Exercise 9-1. Toolbars
    13. Exercise 9-2. Menu Bars
    14. Exercise 10-1. Glade Text Editor
    15. Exercise 10-2. Glade Text Editor with Menus
    16. Exercise 11-1. Expanding MyMarquee
    17. Exercise 12-1. Full Text Editor
  27. Index