CS 551. Programming Graphical User Interfaces

Naming Conventions in X

Type of name Spelling conventions Examples
application name all lower case, perhaps with underscores xhelp
animator
code_view
application class name first (or first two, if it begins with "X") letter capitalized; mixed case instead of underscores XHelp
Animator
CodeView
widget (and other) variable names all lower case, perhaps with underscores; may be array window
quit_button
button[10]
widget instance names same as widget variable names, but no arrays

[Exception: where it will be displayed as a string (e.g., Label, Command), name may be capitalized or shortened]
window
quit_button
button
[QUIT]
[Quit]
callbacks, actions, and event handlers first letter capitalized; mixed case instead of underscores Quit
StoreData
ExpandCode
resource names first letter lower-case; mixed case instead of underscores; no arrays background
borderWidth
resource class names same word as resource name, but with first letter capitalized, and preceded by "XtC" XtCBackground
XtCBorderWidth
resource "named constants" same word as resource name, but preceded by "XtN" XtNbackground
XtNborderWidth
resource converters same as data type (multiple words are run together), but with first letter capitalized, and preceded by "XtR" XtRPixel
XtRUnsignedChar
application defaults files duplicates application class name XHelp
Animator
CodeView
application icon same as application name, with file extension of ".xbm" (X bitmap) xhelp.xbm
animator.xbm
codeview.xbm

For naming conventions within widgets, see Appendix D in Vol. 4 of the text