root/OpenSceneGraph/trunk/examples/osgviewerFOX/osgviewerFOX.cpp @ 13348

Revision 12292, 2.7 kB (checked in by robert, 4 years ago)

Ran svn propset -R svn:eol-style native . on the OpenSceneGraph

  • Property svn:eol-style set to native
Line 
1#ifdef __BORLANDC__
2#pragma hdrstop
3#endif
4
5#include "osgviewerFOX.h"
6
7#include "FOX_OSG_MDIView.h"
8
9/* My frame constructor */
10MainFrame::MainFrame(FXApp *app, const FXString &name, FXIcon *ic, FXIcon *mi, FXuint opts, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb, FXint hs, FXint vs) : FXMainWindow(app, name, ic, mi, opts, x, y, w, h, pl, pr, pt, pb, hs, vs)
11{
12
13
14        // Site where to dock
15        FXDockSite* topdock=new FXDockSite(this,DOCKSITE_NO_WRAP|LAYOUT_SIDE_TOP|LAYOUT_FILL_X);
16
17        // Menubar 1
18        m_fxToolbarShell1=new FXToolBarShell(this,FRAME_RAISED);
19        FXMenuBar* menubar=new FXMenuBar(topdock,m_fxToolbarShell1,LAYOUT_DOCK_SAME|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|FRAME_RAISED);
20        new FXToolBarGrip(menubar,menubar,FXMenuBar::ID_TOOLBARGRIP,TOOLBARGRIP_DOUBLE);
21
22        // Contents
23        FXHorizontalFrame *frame=new FXHorizontalFrame(this,LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0, 4,4);
24
25        // Nice sunken box around GL viewer
26        FXVerticalFrame *box=new FXVerticalFrame(frame,FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0, 0,0,0,0);
27
28        // MDI Client
29        FXMDIClient* mdiclient=new FXMDIClient(box,LAYOUT_FILL_X|LAYOUT_FILL_Y);
30
31        // Make MDI Window Menu
32        FXMDIMenu* mdimenu=new FXMDIMenu(this,mdiclient);
33
34        // MDI buttons in menu:- note the message ID's!!!!!
35        // Normally, MDI commands are simply sensitized or desensitized;
36        // Under the menubar, however, they're hidden if the MDI Client is
37        // not maximized.  To do this, they must have different ID's.
38        new FXMDIWindowButton(menubar,mdimenu,mdiclient,FXMDIClient::ID_MDI_MENUWINDOW,LAYOUT_LEFT|LAYOUT_CENTER_Y);
39        new FXMDIDeleteButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENUCLOSE,FRAME_RAISED|LAYOUT_RIGHT|LAYOUT_CENTER_Y);
40        new FXMDIRestoreButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENURESTORE,FRAME_RAISED|LAYOUT_RIGHT|LAYOUT_CENTER_Y);
41        new FXMDIMinimizeButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENUMINIMIZE,FRAME_RAISED|LAYOUT_RIGHT|LAYOUT_CENTER_Y);
42
43        // Make an MDI Child
44        FOX_OSG_MDIView* mdichild=new FOX_OSG_MDIView(mdiclient,"FOX osgViewer", NULL, mdimenu,MDI_TRACKING|MDI_MAXIMIZED,30,30,300,200);
45        mdichild->setFocus();
46
47        // Make it active
48        mdiclient->setActiveChild(mdichild);
49
50}
51
52// Create and initialize
53void MainFrame::create(){
54  FXMainWindow::create();
55  m_fxToolbarShell1->create();
56  show(PLACEMENT_SCREEN);
57}
58
59int main(int argc, char** argv){
60
61        // Make application
62        FXApp application("OSGViewer","FoxTest");
63
64        // Open the display
65        application.init(argc,argv);
66
67        // Make window
68        new MainFrame(&application, "Fox Toolkit OSG Sample", NULL, NULL, DECOR_ALL, 100, 100, 800, 600);
69
70        // Create the application's windows
71        application.create();
72
73        // Run the application
74        return application.run();
75}
Note: See TracBrowser for help on using the browser.