home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 December / macformat-031.iso / mac / Shareware City / Developers / CopyBits Demo 3.1 / Dialog Utilities.h < prev    next >
Encoding:
Text File  |  1995-06-02  |  2.6 KB  |  77 lines  |  [TEXT/MMCC]

  1. // Dialog Utilities.h v1.0
  2. //
  3. // by Kenneth Worley
  4. // Public Domain
  5. //
  6. // Contact me at:  America Online: KNEworley
  7. //            internet: KNEworley@aol.com or kworley@fascination.com
  8. //
  9. // Functions to make working with dialog items, controls, and
  10. // text fields (and the same in control panels) easier and
  11. // more convenient.
  12. //
  13.  
  14. #ifndef Dialog_Utilities_h
  15. #define Dialog_Utilities_h
  16.  
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20.  
  21. // GetItemHandle returns the handle of an item in a dialog.
  22. Handle GetItemHandle( DialogPtr dlg, short itemNo );
  23.  
  24. // GetItemRect returns the rectangle of a dialog item (in local
  25. // coordinates) given the dialog ptr, and the item number.
  26. void    GetItemRect( DialogPtr dlg, short itemNo, Rect *aRect );
  27.  
  28. // GetOnOff returns the on/off status of a radio button or check box.
  29. Boolean GetOnOff( DialogPtr dlg, short itemNo );
  30.  
  31. // SetOnOff turns a radio button or check box on or off.
  32. void SetOnOff( DialogPtr dlg, short itemNo, Boolean turnOn );
  33.  
  34. // Toggle toggles the on/off value of a radio button or check box.
  35. void Toggle( DialogPtr dlg, short itemNo );
  36.  
  37. // GetRadioButton returns the item number of the first radio button
  38. // it finds turned on in the given range of items.
  39. short GetRadioButton( DialogPtr dlg, short first, short last );
  40.  
  41. // SetRadioButton turns on the radio button whose item number is
  42. // specified in target and makes sure the rest of the radio buttons
  43. // in the given range are off.
  44. void SetRadioButton( DialogPtr dlg, short first, short last, short target );
  45.  
  46. // SetChars sets a text field in a dialog to the text specified.
  47. void SetChars( DialogPtr dlg, short itemNo, char *str, short len );
  48.  
  49. // GetChars returns the text and length of text in the specified field.
  50. void GetChars( DialogPtr dlg, short itemNo, char *str, short *len );
  51.  
  52. // SetText sets a text field in a dialog to the text specified.
  53. void SetText( DialogPtr dlg, short itemNo, Str255 str );
  54.  
  55. // GetText returns the text of the specified field.
  56. void GetText( DialogPtr dlg, short itemNo, Str255 str );
  57.  
  58. // Activate control either activates or deactivates a control
  59. // depending on the activate parameter.
  60. void ActivateControl( DialogPtr dlg, short itemNo, Boolean activate );
  61.  
  62. // GetDialogNumberField converts the text in the specified text field
  63. // and returns it as a number.
  64. long GetDialogNumberField( DialogPtr dlg, short itemNo );
  65.  
  66. // SetDialogNumberField sets a text field to the string representation
  67. // of the number given.
  68. void SetDialogNumberField( DialogPtr dlg, short itemNo, long theNumber );
  69.  
  70. // SelectTextField selects all the text in a dialog text field.
  71. void SelectTextField( DialogPtr dlg, short itemNo );
  72.  
  73. #ifdef __cplusplus
  74. }
  75. #endif
  76.  
  77. #endif // Dialog_Utilities_h