home *** CD-ROM | disk | FTP | other *** search
/ Superpower (Alt) / SUPERPOWER.iso / q / source / popscrol.m < prev    next >
Encoding:
Text File  |  1996-08-08  |  1.5 KB  |  88 lines

  1.  
  2. #import "qedefs.h"
  3.  
  4. @implementation PopScrollView
  5.  
  6. /*
  7. ====================
  8. initFrame: button:
  9.  
  10. Initizes a scroll view with a button at it's lower right corner
  11. ====================
  12. */
  13.  
  14. - initFrame:(const NXRect *)frameRect button1:b1 button2:b2
  15. {
  16.     [super  initFrame: frameRect];    
  17.  
  18.     [self addSubview: b1];
  19.     [self addSubview: b2];
  20.  
  21.     button1 = b1;
  22.     button2 = b2;
  23.  
  24.     [self setHorizScrollerRequired: YES];
  25.     [self setVertScrollerRequired: YES];
  26.  
  27.     [self setBorderType: NX_BEZEL];
  28.         
  29.     return self;
  30. }
  31.  
  32.  
  33. /*
  34. ================
  35. tile
  36.  
  37. Adjust the size for the pop up scale menu
  38. =================
  39. */
  40.  
  41. - tile
  42. {
  43.     NXRect    scrollerframe;
  44.     NXRect    buttonframe, buttonframe2;
  45.     NXRect    newframe;
  46.     
  47.     [super tile];
  48.     [button1 getFrame: &buttonframe];
  49.     [button2 getFrame: &buttonframe2];
  50.     [hScroller getFrame: &scrollerframe];
  51.  
  52.     newframe.origin.y = scrollerframe.origin.y;
  53.     newframe.origin.x = frame.size.width - buttonframe.size.width;
  54.     newframe.size.width = buttonframe.size.width;
  55.     newframe.size.height = scrollerframe.size.height;
  56.     scrollerframe.size.width -= newframe.size.width;
  57.     [button1 setFrame: &newframe];
  58.     newframe.size.width = buttonframe2.size.width;
  59.     newframe.origin.x -= newframe.size.width;
  60.     [button2 setFrame: &newframe];
  61.     scrollerframe.size.width -= newframe.size.width;
  62.  
  63.     [hScroller setFrame: &scrollerframe];
  64.  
  65.     return self;
  66. }
  67.  
  68.  
  69. - superviewSizeChanged:(const NXSize *)oldSize
  70. {
  71.     [super superviewSizeChanged: oldSize];
  72.     
  73.     [[self docView] newSuperBounds];
  74.     
  75.     return self;
  76. }
  77.  
  78.  
  79. -(BOOL) acceptsFirstResponder
  80. {
  81.     return YES;
  82. }
  83.  
  84.  
  85.  
  86. @end
  87.  
  88.