Forge: Window Class Reference

Forge

- Main Page
- Namespaces
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Class Hierarchy
- Data Fields

Public Member Functions
Window Class Reference

Window is where other objects such as Images, Plots etc. More...

`#include <window.h>`

## Public Member Functions
FGAPI | Window (int pWidth, int pHeight, const char *pTitle, const Window *pWindow=0, const bool invisible=false)
| Creates a Window object. More...
FGAPI | Window (const Window &other)
| Copy constructor for Window. More...
FGAPI | ~Window ()
| Window Destructor. More...
FGAPI void | setFont (Font *pFont)
| Set font to be used by the window to draw text. More...
FGAPI void | setTitle (const char *pTitle)
| Set the window title. More...
FGAPI void | setPos (int pX, int pY)
| Set the start position where the window will appear. More...
FGAPI void | setSize (unsigned pWidth, unsigned pHeight)
| Set the size of the window programmatically. More...
FGAPI void | setColorMap (ColorMap cmap)
| Set the colormap to be used for subsequent rendering calls. More...
FGAPI long long | context () const
| Get OpenGL context handle. More...
FGAPI long long | display () const
| Get Native Window display handle. More...
FGAPI int | width () const
FGAPI int | height () const
FGAPI internal::_Window * | get () const
FGAPI void | makeCurrent ()
| Make the current window's OpenGL context active context. More...
FGAPI void | hide ()
| Hide the window. More...
FGAPI void | show ()
| Show the window if hidden, otherwise no effect. More...
FGAPI bool | close ()
| Check if the window is ready for close. More...
FGAPI void | draw (const Image &pImage, const bool pKeepAspectRatio=true)
| Render an Image to Window. More...
FGAPI void | draw (const Plot &pPlot)
| Render a Plot to Window. More...
FGAPI void | draw (const Plot3 &pPlot3)
| Render a Plot3 to Window. More...
FGAPI void | draw (const Surface &pSurface)
| Render a Surface to Window. More...
FGAPI void | draw (const Histogram &pHist)
| Render Histogram to Window. More...
FGAPI void | grid (int pRows, int pCols)
| Setup grid layout for multivew mode. More...
FGAPI void | draw (int pColId, int pRowId, const Image &pImage, const char *pTitle=0, const bool pKeepAspectRatio=true)
| Render Image to given sub-region of the window in multiview mode. More...
FGAPI void | draw (int pColId, int pRowId, const Plot &pPlot, const char *pTitle=0)
| Render Plot to given sub-region of the window in multiview mode. More...
FGAPI void | draw (int pColId, int pRowId, const Plot3 &pPlot3, const char *pTitle=0)
| Render Plot3 to given sub-region of the window in multiview mode. More...
FGAPI void | draw (int pColId, int pRowId, const Surface &pSurface, const char *pTitle=0)
| Render Surface to given sub-region of the window in multiview mode. More...
FGAPI void | draw (int pColId, int pRowId, const Histogram &pHist, const char *pTitle=0)
| Render Histogram to given sub-region of the window in multiview mode. More...
FGAPI void | swapBuffers ()
| Swaps background OpenGL buffer with front buffer. More...

## Detailed Description

Window is where other objects such as Images, Plots etc.

are rendered.

## Constructor & Destructor Documentation

FGAPI Window | ( | int | pWidth,
|  | int | pHeight,
|  | const char * | pTitle,
|  | const Window * | pWindow = `0`,
|  | const bool | invisible = `false`
| ) |  |

Creates a Window object.

Parameters

  [in] | pWidth | Width of the display window
  [in] | pHeight | Height of the display window
  [in] | pTitle | window Title
  [in] | pWindow | An already existing window with which the window to be created should share the OpenGL context.
  [in] | invisible | window is created in invisible mode. User has to call Window::show() when they decide to actually display the window

FGAPI Window | ( | const Window & | other | ) |

Copy constructor for Window.

Parameters

  [in] | other | is the Window of which we make a copy of.

FGAPI ~Window | ( |  | ) |

Window Destructor.

## Member Function Documentation

FGAPI bool close | ( |  | ) |

Check if the window is ready for close.

This happens when an user presses `ESC` key while the window is in focus or clicks on the close button of the window

Returns
  true | false

FGAPI long long context | ( |  | ) | const

Get OpenGL context handle.

Returns
  Context handle for the window's OpenGL context

FGAPI long long display | ( |  | ) | const

Get Native Window display handle.

Returns
  Display handle of the native window implemenation of Window

FGAPI void draw | ( | const Image & | pImage,
|  | const bool | pKeepAspectRatio = `true`
| ) |  |

Render an Image to Window.

Parameters

  [in] | pImage | is an object of class Image
  [in] | pKeepAspectRatio | when set to true keeps the aspect ratio of the input image constant.

Note
  this draw call does a OpenGL swap buffer, so we do not need to call Window::draw() after this function is called upon for rendering an image

FGAPI void draw | ( | const Plot & | pPlot | ) |

Render a Plot to Window.

Parameters

  [in] | pPlot | is an object of class Plot

Note
  this draw call does a OpenGL swap buffer, so we do not need to call Window::draw() after this function is called upon for rendering a plot

FGAPI void draw | ( | const Plot3 & | pPlot3 | ) |

Render a Plot3 to Window.

Parameters

  [in] | pPlot3 | is an object of class Plot3

Note
  this draw call does a OpenGL swap buffer, so we do not need to call Window::draw() after this function is called upon for rendering a plot

FGAPI void draw | ( | const Surface & | pSurface | ) |

Render a Surface to Window.

Parameters

  [in] | pSurface | is an object of class Surface

Note
  this draw call does a OpenGL swap buffer, so we do not need to call Window::draw() after this function is called upon for rendering a plot

FGAPI void draw | ( | const Histogram & | pHist | ) |

Render Histogram to Window.

Parameters

  [in] | pHist | is an object of class Histogram

Note
  this draw call does a OpenGL swap buffer, so we do not need to call Window::draw() after this function is called upon for rendering a histogram

FGAPI void draw | ( | int | pColId,
|  | int | pRowId,
|  | const Image & | pImage,
|  | const char * | pTitle = `0`,
|  | const bool | pKeepAspectRatio = `true`
| ) |  |

Render Image to given sub-region of the window in multiview mode.

Window::grid should have been already called before any of the draw calls that accept coloum index and row index is used to render an object.

Parameters

  [in] | pColId | is coloumn index
  [in] | pRowId | is row index
  [in] | pImage | is an object of class Image
  [in] | pTitle | is the title that will be displayed for the cell represented by `pColId` and `pRowId`
  [in] | pKeepAspectRatio | when set to true keeps the aspect ratio of the input image constant.

Note
  This draw call doesn't do OpenGL swap buffer since it doesn't have the knowledge of which sub-regions already got rendered. We should call Window::draw() once all draw calls corresponding to all sub-regions are called when in multiview mode.

FGAPI void draw | ( | int | pColId,
|  | int | pRowId,
|  | const Plot & | pPlot,
|  | const char * | pTitle = `0`
| ) |  |

Render Plot to given sub-region of the window in multiview mode.

Window::grid should have been already called before any of the draw calls that accept coloum index and row index is used to render an object.

Parameters

  [in] | pColId | is coloumn index
  [in] | pRowId | is row index
  [in] | pPlot | is an object of class Plot
  [in] | pTitle | is the title that will be displayed for the cell represented by `pColId` and `pRowId`

Note
  This draw call doesn't do OpenGL swap buffer since it doesn't have the knowledge of which sub-regions already got rendered. We should call Window::draw() once all draw calls corresponding to all sub-regions are called when in multiview mode.

FGAPI void draw | ( | int | pColId,
|  | int | pRowId,
|  | const Plot3 & | pPlot3,
|  | const char * | pTitle = `0`
| ) |  |

Render Plot3 to given sub-region of the window in multiview mode.

Window::grid should have been already called before any of the draw calls that accept coloum index and row index is used to render an object.

Parameters

  [in] | pColId | is coloumn index
  [in] | pRowId | is row index
  [in] | pPlot3 | is an object of class Plot3
  [in] | pTitle | is the title that will be displayed for the cell represented by `pColId` and `pRowId`

Note
  This draw call doesn't do OpenGL swap buffer since it doesn't have the knowledge of which sub-regions already got rendered. We should call Window::draw() once all draw calls corresponding to all sub-regions are called when in multiview mode.

FGAPI void draw | ( | int | pColId,
|  | int | pRowId,
|  | const Surface & | pSurface,
|  | const char * | pTitle = `0`
| ) |  |

Render Surface to given sub-region of the window in multiview mode.

Window::grid should have been already called before any of the draw calls that accept coloum index and row index is used to render an object.

Parameters

  [in] | pColId | is coloumn index
  [in] | pRowId | is row index
  [in] | pSurface | is an object of class Surface
  [in] | pTitle | is the title that will be displayed for the cell represented by `pColId` and `pRowId`

Note
  This draw call doesn't do OpenGL swap buffer since it doesn't have the knowledge of which sub-regions already got rendered. We should call Window::draw() once all draw calls corresponding to all sub-regions are called when in multiview mode.

FGAPI void draw | ( | int | pColId,
|  | int | pRowId,
|  | const Histogram & | pHist,
|  | const char * | pTitle = `0`
| ) |  |

Render Histogram to given sub-region of the window in multiview mode.

Window::grid should have been already called before any of the draw calls that accept coloum index and row index is used to render an object.

Parameters

  [in] | pColId | is coloumn index
  [in] | pRowId | is row index
  [in] | pHist | is an object of class Histogram
  [in] | pTitle | is the title that will be displayed for the cell represented by `pColId` and `pRowId`

Note
  This draw call doesn't do OpenGL swap buffer since it doesn't have the knowledge of which sub-regions already got rendered. We should call Window::draw() once all draw calls corresponding to all sub-regions are called when in multiview mode.

FGAPI internal::_Window* get | ( |  | ) | const

Returns
  internal handle for window implementation

FGAPI void grid | ( | int | pRows,
|  | int | pCols
| ) |  |

Setup grid layout for multivew mode.

Multiview mode is where you can render different objects to different sub-regions of a given window

Parameters

  [in] | pRows | is number of rows in grid layout
  [in] | pCols | is number of coloumns in grid layout

FGAPI int height | ( |  | ) | const

Returns
  window height

FGAPI void hide | ( |  | ) |

Hide the window.

FGAPI void makeCurrent | ( |  | ) |

Make the current window's OpenGL context active context.

FGAPI void setColorMap | ( | ColorMap | cmap | ) |

Set the colormap to be used for subsequent rendering calls.

Parameters

  [in] | cmap | should be one of the enum values from ColorMap

FGAPI void setFont | ( | Font * | pFont | ) |

Set font to be used by the window to draw text.

Parameters

  [in] | pFont | Font object pointer

FGAPI void setPos | ( | int | pX,
|  | int | pY
| ) |  |

Set the start position where the window will appear.

Parameters

  [in] | pX | is horizontal coordinate
  [in] | pY | is vertical coordinate

FGAPI void setSize | ( | unsigned | pWidth,
|  | unsigned | pHeight
| ) |  |

Set the size of the window programmatically.

Parameters

  [in] | pWidth | target width
  [in] | pHeight | target height

FGAPI void setTitle | ( | const char * | pTitle | ) |

Set the window title.

Parameters

  [in] | pTitle | is the window title

FGAPI void show | ( |  | ) |

Show the window if hidden, otherwise no effect.

FGAPI void swapBuffers | ( |  | ) |

Swaps background OpenGL buffer with front buffer.

This draw call should only be used when the window is displaying something in multiview mode

FGAPI int width | ( |  | ) | const

Returns
  window width

The documentation for this class was generated from the following file:

- window.h