Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

apress foundations_of gtk plus development 2007 phần 1 pot
Nội dung xem thử
Mô tả chi tiết
this print for content only—size & color not accurate spine = 1.235" 656 page count
Books for professionals by professionals®
Foundations of GTK+ Development
Dear Reader,
Maybe you have a great idea for the world’s next killer application. Or perhaps
you just want to add a simple graphical interface to that clumsy command-line
utility. No matter the goal, developers regularly look to the open source toolkit
known as GTK+ to build sophisticated graphical interfaces. But learning how
to effectively use GTK+ can be a daunting task. Some features can be difficult
to understand, and online documentation is often scant. Figuring out where to
begin may be even trickier, since GTK+ depends on so many libraries. For these
reasons, I decided to write a practical guide to GTK+ development.
Because so many newcomers struggle with simply getting started using
GTK+, I thought it appropriate to dirty your hands as quickly as possible. After
devoting Chapter 1 to an overview of key concepts, I will show you how to create,
compile, and execute your first application. The chapters that follow introduce
you to the wide variety of widgets and signals at your disposal, which embody
your application’s look and behavior respectively. To cement your knowledge,
along the way we will create several interesting applications such as a file
browser and a text editor. By the time you complete the last chapter, you will be
able to implement very complex GUI applications.
I wrote this book to be not only a practical tutorial but also a reasonably
complete reference. To that end, I’ve included an extensive array of appendixes
covering object properties, widget signals, style properties, stock items, and
GError types; the information they contain will become indispensable as you
begin writing your own applications.
Andrew Krause
US $49.99
Shelve in
Linux
User level:
Beginner–Intermediate
Krause GTK+Development
The EXPERT’s VOIce® in Open Source
Foundations of
GTK+
Development
CYAN
MAGENTA
YELLOW
BLACK
PANTONE 123 C
Andrew Krause
Companion
eBook Available
THE APRESS ROADMAP
Foundations of Qt®
Development
Foundations of
GTK+ Development
Beginning C,
Fourth Edition
Beginning SUSE Linux,
Second Edition
Beginning Ubuntu Linux,
Second Edition
www.apress.com
SOURCE CODE ONLINE
Companion eBook
See last page for details
on $10 eBook version
ISBN-13: 978-1-59059-793-4
ISBN-10: 1-59059-793-1
9 781590 597934
5 4 9 9 9
Build sophisticated graphical applications using one
of the world's most powerful cross-platform toolkits!
Foundations of
Foundations of
GTK+
Development
■■■
Andrew Krause
7931.book Page i Wednesday, March 28, 2007 7:35 PM
Foundations of GTK+ Development
Copyright © 2007 by Andrew Krause
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-59059-793-4
ISBN-10 (pbk): 1-59059-793-1
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence
of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark
owner, with no intention of infringement of the trademark.
Lead Editors: Jason Gilmore, Matt Wade
Technical Reviewers: Christiana Evelyn Johnson, Micah Carrick
Editorial Board: Steve Anglin, Ewan Buckingham, Gary Cornell, Jason Gilmore, Jonathan Gennick,
Jonathan Hassell, James Huddleston, Chris Mills, Matthew Moodie, Jeff Pepper, Paul Sarknas,
Dominic Shakeshaft, Jim Sumser, Matt Wade
Project Manager: Richard Dal Porto
Copy Edit Manager: Nicole Flores
Copy Editor: Heather Lang
Assistant Production Director: Kari Brooks-Copony
Production Editor: Katie Stence
Compositor: Pat Christenson
Proofreader: Elizabeth Berry
Indexer: Ann Rogers
Artist: April Milne
Cover Designer: Kurt Krames
Manufacturing Director: Tom Debolski
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor,
New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or
visit http://www.springeronline.com.
For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA
94710. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit http://www.apress.com.
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution
has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to
any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly
by the information contained in this work.
The source code for this book is available to readers at http://www.apress.com in the Source Code/
Download section or at the official book site, http://www.gtkbook.com.
7931.book Page ii Wednesday, March 28, 2007 7:35 PM
I dedicate this book to Mrs. Kaminsky, for never allowing me to settle for anything but my
best. I hope you can look at this book and see everything that you have done for me,
even though I have yet to broaden the scope of my writing beyond technology.
7931.book Page iii Wednesday, March 28, 2007 7:35 PM
7931.book Page iv Wednesday, March 28, 2007 7:35 PM
v
Contents at a Glance
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xvii
Acknowledgments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
■CHAPTER 1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
■CHAPTER 2 Your First GTK+ Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
■CHAPTER 3 Container Widgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
■CHAPTER 4 Basic Widgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
■CHAPTER 5 Dialogs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
■CHAPTER 6 Using GLib. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
■CHAPTER 7 The Text View Widget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
■CHAPTER 8 The Tree View Widget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
■CHAPTER 9 Menus and Toolbars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
■CHAPTER 10 Dynamic User Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
■CHAPTER 11 Creating Custom Widgets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
■CHAPTER 12 Additional GTK+ Widgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
■CHAPTER 13 Putting It All Together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
■APPENDIX A GTK+ Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
■APPENDIX B GTK+ Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529
■APPENDIX C GTK+ Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
■APPENDIX D GTK+ Stock Items. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
■APPENDIX E GError Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587
■APPENDIX F Exercise Solutions and Hints. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605
7931.book Page v Wednesday, March 28, 2007 7:35 PM
7931.book Page vi Wednesday, March 28, 2007 7:35 PM