remove scrollview and add window.m scroll funs
This commit is contained in:
parent
8faae4eacc
commit
8584d90452
|
@ -6,7 +6,6 @@ struct browser_window;
|
|||
@interface BrowserWindowController : NSWindowController<NSTextFieldDelegate> {
|
||||
id backButton;
|
||||
id forwardButton;
|
||||
id scrollView;
|
||||
id urlBar;
|
||||
struct browser_window *browser;
|
||||
id plotView;
|
||||
|
@ -18,6 +17,8 @@ struct browser_window;
|
|||
|
||||
// Browser control
|
||||
-(NSSize)getBrowserSize;
|
||||
-(NSPoint)getBrowserScroll;
|
||||
-(void)setBrowserScroll: (NSPoint)scroll;
|
||||
-(void)invalidateBrowser;
|
||||
-(void)invalidateBrowser: (NSRect)rect;
|
||||
@end
|
||||
|
|
|
@ -16,9 +16,7 @@
|
|||
}
|
||||
|
||||
-(void)awakeFromNib {
|
||||
plotView = [[PlotView alloc] initWithFrame: NSMakeRect(0, 0, 800, 600)];
|
||||
[plotView setBrowser: browser];
|
||||
[[scrollView contentView] addSubview: plotView];
|
||||
NSLog(@"Browser window loaded");
|
||||
}
|
||||
|
||||
|
@ -35,6 +33,12 @@
|
|||
-(NSSize)getBrowserSize {
|
||||
return [plotView frame].size;
|
||||
}
|
||||
-(NSPoint)getBrowserScroll {
|
||||
return [plotView visibleRect].origin;
|
||||
}
|
||||
-(void)setBrowserScroll: (NSPoint)scroll {
|
||||
[plotView scrollPoint: scroll];
|
||||
}
|
||||
-(void)invalidateBrowser {
|
||||
[plotView setNeedsDisplay: YES];
|
||||
}
|
||||
|
|
|
@ -240,6 +240,7 @@ static const struct plotter_table gnustep_plotters = {
|
|||
|
||||
-(void)drawRect: (NSRect)rect {
|
||||
NSLog(@"Drawing plotview");
|
||||
|
||||
struct redraw_context ctx = {
|
||||
.interactive = true,
|
||||
.background_images = true,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
backButton,
|
||||
forwardButton,
|
||||
urlBar,
|
||||
scrollView
|
||||
plotView
|
||||
);
|
||||
Super = NSWindowController;
|
||||
};
|
||||
|
@ -22,7 +22,7 @@
|
|||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
PlotterView = {
|
||||
PlotView = {
|
||||
Actions = (
|
||||
);
|
||||
Outlets = (
|
||||
|
|
Binary file not shown.
|
@ -42,12 +42,16 @@ static nserror gnustep_window_invalidate(struct gui_window *gw, const struct rec
|
|||
// Put the current scroll offset into sx and sy
|
||||
static bool gnustep_window_get_scroll(struct gui_window *gw, int *sx, int *sy) {
|
||||
NSLog(@"gnustep_window_get_scroll");
|
||||
NSPoint scroll = [(id)gw getBrowserScroll];
|
||||
*sx = scroll.x;
|
||||
*sy = scroll.y;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Set the current scroll offset
|
||||
static nserror gnustep_window_set_scroll(struct gui_window *gw, const struct rect *rect) {
|
||||
NSLog(@"gnustep_window_set_scroll");
|
||||
[(id)gw setBrowserScroll: NSMakePoint(rect->x0, rect->y0)];
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue