Moon Travel Planner: Adding Printing to the Moon Facts Window
In Chapter 8 you created the Facts for the Traveler (or moon facts) window to display various information about the moon. To add printing support to the moon facts window, you perform these steps:
Define constants for working with printing.
Define data types for working with printing.
Define prototypes for printing functions.
Write printing functions.
Add a print error format string to the
Localizable.stringsfile.Add print setup code to the
mainfunction.Adjust code in the moon facts window event handler.
Test the Page Setup and Print commands to prove it all works.
These steps are described in the sections that follow.
Define Constants for Working with Printing
In this section, you’ll define additional constants you’ll need to hook up printing for the moon facts window.
In Chapter 6 you
defined the constant kMTPApplicationSignature for
the Moon Travel Planner application. In Chapter 8
you defined the constants kMTPPageSetupCommand and kMTPPrintCommand for
the Page Setup and Print commands, as well as kMTPMoonFactsTextKey to
identify the moon facts window text. You’ll use all these constants
in your printing code.
Now you’ll need to define constants to use when you store
and retrieve printing information for the moon facts window and
when you display printing errors. Copy the following definitions to
the main.c file, below
the definition for kMTPPrintCommand:
#define kMTPPrintInfoProperty 'Piwp' #define KMTPPrintFormatStrKey ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access