home *** CD-ROM | disk | FTP | other *** search
/ Peanuts NeXT Software Archives / Peanuts-Update.iso / CDROM / Contents / READMEs / Peanuts-2 / X11 / clients / developer / objc-motif.README < prev    next >
Encoding:
Text File  |  1996-11-09  |  2.2 KB  |  61 lines

  1. This is NOT the way to encapsulate X Widgets and Motif.  It is much
  2. like the application framework that Young demonstrated for C++.
  3.  
  4.  
  5. Quite frankly, encapsulating one object paradigm within another just
  6. brings about kludges and ugly hacks to get things to work.
  7.  
  8.  
  9. I wrote all of this in a day or so by cut-n-paste from young's work so
  10. it isn't pretty.  I did this to understand the problems with
  11. integrating X into Objective-C (and to see if they were about the same
  12. as integrating with C++).
  13.  
  14. There are no docs.  Some of the classes do not work (like MacMainWindow,
  15. Browser,ListView) since I did not continue the investigation.  The ``init''
  16. methods are not well defined and change depending on what object it is
  17. so do not expect consistency.
  18.  
  19. It's just nasty meshing.  Here is an example of building a menu:
  20.  
  21.  
  22.   mb = [[MenuBar alloc] init:"blah" mainWindow:mw ];
  23.   sm = [[mb addSubMenuItem:mb xname:"blah"] label:"Doc" mnemonic:'D'];
  24.   [[mb addMenuItem:sm xname:"open"] label: "Open" mnemonic:'O'];
  25.   [[mb addMenuItem:sm xname:"new"] label: "New"];    
  26.   [[mb addMenuItem:sm xname:"new"] label: "Save"];
  27.   [[mb addMenuItem:sm xname:"new"] label: "Save As"];
  28.   [[mb addMenuItem:sm xname:"new"] label: "Save To"];
  29.   [[mb addMenuItem:sm xname:"close"] label: "Close"];
  30.   sm2 = [[mb addSubMenuItem:sm xname:"blah2"] label:"Windows" mnemonic:'W'];
  31.   [[mb addMenuItem:sm2 xname:"tile"] label:"Tile"];
  32.   sm3 = [[mb addSubMenuItem:mb xname:"exit"] label:"Exit"];
  33.   [[mb addMenuItem:sm3 xname:"exit"] label:"Exit" mnemonic:'E'
  34.     accelerator:"Ctrl<Key>E" acceleratorText:"Ctrl-E"];
  35.   [[mb addMenuItem:sm3 xname:"quit"] label:"Quit" mnemonic:'Q'
  36.    accelerator:"Ctrl<Key>Q" acceleratorText:"Ctrl-Q"];
  37.   [mw menuBar:mb];
  38.  
  39.   [mw makeKeyAndOrderFront: self];
  40.   a = [[BlahWindow new:"blah1MainWindow"] init]; <- This is a window
  41.   [a makeKeyAndOrderFront: self];
  42.  
  43.  
  44.  
  45. The good things:
  46.  
  47. 1) it compiles
  48. 2) there is an example program (look for prefixes of blah in the filenames).
  49.     executable is called blah.
  50.  
  51. Note that it was originally compiled under a 2.2(?) or 2.3(?) or so with the objc
  52. parts from the beta release of the runtime.  It did compile under 2.4.3 with
  53. the included runtime.
  54.  
  55.  
  56.  
  57.  
  58. Gregory B. Lampshire
  59. gbol@rglnext.geol.vt.edu
  60. gbol@shell.com
  61.