added partial mouse events on osx
This commit is contained in:
@@ -1,34 +1,45 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<layout>
|
<layout>
|
||||||
<flex dir="col" wrap="0" width="100%" height="100%" pad="10">
|
<flex dir="col" wrap="0" width="100%" height="100%" pad="10">
|
||||||
<!-- toolbar -->
|
<!-- toolbar -->
|
||||||
<plane height="50" width="100%" pad="5" dir="row" color=".2">
|
<plane height="50" width="100%" pad="5" dir="row" color=".2">
|
||||||
<plane width="50" margin="0 5 0 0" color=".6"></plane>
|
<plane width="50" margin="0 5 0 0" color=".1"></plane>
|
||||||
<plane width="50" margin="0 5 0 0"></plane>
|
<plane width="50" margin="0 5 0 0" color=".2"></plane>
|
||||||
<plane width="50" margin="0 5 0 0"></plane>
|
<plane width="50" margin="0 5 0 0" color=".3"></plane>
|
||||||
<separator width="10" />
|
<separator width="10" />
|
||||||
<plane width="50" margin="0 5 0 0"></plane>
|
<plane width="50" margin="0 5 0 0" color=".1"></plane>
|
||||||
<plane width="50" margin="0 5 0 0"></plane>
|
<plane width="50" margin="0 5 0 0" color=".2"></plane>
|
||||||
<plane width="50" margin="0 5 0 0"></plane>
|
<plane width="50" margin="0 5 0 0" color=".3"></plane>
|
||||||
<separator width="10" />
|
<separator width="10" />
|
||||||
<plane width="50" margin="0 5 0 0"></plane>
|
<plane width="50" margin="0 5 0 0"></plane>
|
||||||
<plane width="50" margin="0 5 0 0"></plane>
|
<plane width="50" margin="0 5 0 0"></plane>
|
||||||
<plane width="50" margin="0 5 0 0"></plane>
|
<plane width="50" margin="0 5 0 0"></plane>
|
||||||
</plane>
|
</plane>
|
||||||
<plane grow="1" dir="row" wrap="1" height="0">
|
<!-- central row -->
|
||||||
<plane width="200" height="100%"></plane>
|
<plane grow="1" dir="row" wrap="1" height="0">
|
||||||
<plane width="1" grow="1" height="100%" pad="30" wrap="1">
|
<!-- side bar -->
|
||||||
<plane color=".2"></plane>
|
<plane width="200" height="100%" wrap="1" dir="col">
|
||||||
</plane>
|
<plane pad="5" margin="2 2 10 2" color=".9" width="100%" height="10">
|
||||||
</plane>
|
<plane height="30" color=".4" />
|
||||||
<!-- status bar -->
|
<plane height="30" color=".4" />
|
||||||
<plane height="30" width="100%" />
|
<plane height="30" color=".4" />
|
||||||
<!--<plane height="100%" width="50%" wrap="1" dir="col">
|
<plane height="30" color=".4" />
|
||||||
<plane height="150" width="100%" />
|
</plane>
|
||||||
<plane height="50%" width="50%">
|
<plane width="100%" height="1" grow="1" color=".4"/>
|
||||||
<plane height="30" width="45" />
|
</plane>
|
||||||
<plane height="30" width="45" />
|
<!-- content panel -->
|
||||||
</plane>
|
<plane width="1" grow="1" height="100%" pad="30" wrap="1">
|
||||||
</plane>-->
|
<plane color=".2"></plane>
|
||||||
</flex>
|
</plane>
|
||||||
|
</plane>
|
||||||
|
<!-- status bar -->
|
||||||
|
<plane height="30" width="100%" />
|
||||||
|
<!--<plane height="100%" width="50%" wrap="1" dir="col">
|
||||||
|
<plane height="150" width="100%" />
|
||||||
|
<plane height="50%" width="50%">
|
||||||
|
<plane height="30" width="45" />
|
||||||
|
<plane height="30" width="45" />
|
||||||
|
</plane>
|
||||||
|
</plane>-->
|
||||||
|
</flex>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
@@ -486,3 +486,16 @@ void App::resize(float w, float h)
|
|||||||
YGNodeStyleSetHeight(y_root, height);
|
YGNodeStyleSetHeight(y_root, height);
|
||||||
update_layout();
|
update_layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void App::mouse_down(int button, float x, float y)
|
||||||
|
{
|
||||||
|
printf("mouse click %f %f\n", x, y);
|
||||||
|
}
|
||||||
|
void App::mouse_move(float x, float y)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void App::mouse_up(int button, float x, float y)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ public:
|
|||||||
void create();
|
void create();
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
void resize(float w, float h);
|
void resize(float w, float h);
|
||||||
|
void mouse_down(int button, float x, float y);
|
||||||
|
void mouse_move(float x, float y);
|
||||||
|
void mouse_up(int button, float x, float y);
|
||||||
void update_layout();
|
void update_layout();
|
||||||
void load_layout();
|
void load_layout();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -192,6 +192,21 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
|
|||||||
|
|
||||||
[super renewGState];
|
[super renewGState];
|
||||||
}
|
}
|
||||||
|
- (void)mouseDown:(NSEvent *)theEvent
|
||||||
|
{
|
||||||
|
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||||
|
App::I.mouse_down(0, mouseLoc.x, mouseLoc.y);
|
||||||
|
}
|
||||||
|
- (void)mouseUp:(NSEvent *)theEvent
|
||||||
|
{
|
||||||
|
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||||
|
App::I.mouse_up(0, mouseLoc.x, mouseLoc.y);
|
||||||
|
}
|
||||||
|
- (void)mouseMoved:(NSEvent *)theEvent
|
||||||
|
{
|
||||||
|
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||||
|
App::I.mouse_move(mouseLoc.x, mouseLoc.y);
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface Window : NSWindow
|
@interface Window : NSWindow
|
||||||
|
|||||||
Reference in New Issue
Block a user