solvespace/fltk/xFl_Gl_Window_Group.H

104 lines
2.5 KiB
C++
Raw Normal View History

Initial Autotools and FLTK support With this commit, SolveSpace gains an Autotools build system and a new platform-dependent backend implemented using the FLTK GUI toolkit. These will allow the application to be built and run on Linux and other Unix-like operating systems, and prospectively, MacOS X. A number of new files have been added: * Makefile.am: Automake makefile template; this contains some experimental support for MinGW and MSVC++ builds that needs further development * ac-aux/ax_fltk.m4: Autoconf M4 macro to locate and query the system's installation of FLTK; this will eventually be contributed to the GNU Autoconf Archive * autogen.sh: Script to bootstrap the Autotools build system, usually for a tree just checked out from source control * configure.ac: Source for the Autoconf configure script; note that this file specifies a version of 2.1, near the top * fltk/fltkmain.cpp: Main FLTK backend implementation * fltk/fltkutil.cpp: Utility functions for the FLTK backend * fltk/xFl_Gl_Window_Group.{H,cxx}: Implementation of a new Fl_Gl_Window_Group widget for FLTK, needed to facilitate drawing FLTK widgets on top of OpenGL graphics as SolveSpace does. This has been submitted to the FLTK project for (hopefully) eventual upstream inclusion: http://www.fltk.org/str.php?L2992 The following minor changes are also a part of this commit: * Makefile.msvc: Define PACKAGE_VERSION=2.1 for the benefit of solvespace.cpp in MSVC++ builds * solvespace.cpp: In the About dialog text, use PACKAGE_VERSION rather than hard-coding the version of the program * solvespace.h: Don't define the C99 integer types if HAVE_C99_INTEGER_TYPES is defined, to facilitate MinGW builds
2013-10-28 05:28:42 +00:00
//
// "$Id$"
//
// OpenGL window group widget for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2010 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
/* \file
Fl_Gl_Window_Group widget . */
#ifndef Fl_Gl_Window_Group_H
#define Fl_Gl_Window_Group_H
#include <FL/Fl_Gl_Window.H> //#include "Fl_Gl_Window.H"
#include <FL/x.H> //#include "x.H"
#define Fl_Gl_Window_Group xFl_Gl_Window_Group
class Fl_Gl_Window_Group_INTERNAL;
/**
The Fl_Gl_Window_Group widget is an extended form of Fl_Gl_Window that
can contain child widgets not specially modified to use OpenGL calls.
After the main OpenGL area is drawn, child widgets are each drawn into an
offscreen buffer (using the standard FLTK drawing routines), and then
copied into the OpenGL window using a textured quad.
*/
class FL_EXPORT Fl_Gl_Window_Group : public Fl_Gl_Window {
class Fl_Gl_Window_Group_INTERNAL *glstandin;
Fl_Offscreen offscr;
int offscr_w, offscr_h;
uchar *imgbuf;
GLContext children_context;
unsigned int texid;
void init(void);
void adjust_offscr(int w, int h);
public:
~Fl_Gl_Window_Group(void);
/**
Creates a new Fl_Gl_Window_Group widget using the given size and label string.
*/
Fl_Gl_Window_Group(int W, int H, const char *l=0)
: Fl_Gl_Window(W,H,l) {init();}
/**
Creates a new Fl_Gl_Window_Group widget using the given position,
size, and label string.
*/
Fl_Gl_Window_Group(int X, int Y, int W, int H, const char *l=0)
: Fl_Gl_Window(X,Y,W,H,l) {init();}
void show(void);
void hide(void);
void clear(void);
void flush(void);
/**
Handles the specified event.
This method only receives events that were not used by any of the child
widgets. Unlike most handle() methods, this should not call the
inherited handle() method, or else an infinite loop will result.
*/
virtual int handle_gl(int event);
protected:
void draw(void);
void draw_children(void);
void draw_child(Fl_Widget& widget);
/**
Draws the main OpenGL area of the Fl_Gl_Window_Group.
You \e \b must override the draw_gl() method.
*/
virtual void draw_gl(void);
};
#endif
//
// End of "$Id:$".
//