Open3D (C++ API)  0.18.0+252c867
Data Structures | Public Member Functions | Static Public Attributes | Protected Member Functions | Friends
open3d::visualization::gui::Window Class Reference

#include <Window.h>

Inheritance diagram for open3d::visualization::gui::Window:
open3d::visualization::GuiVisualizer open3d::visualization::visualizer::O3DVisualizer

Data Structures

struct  Impl
 

Public Member Functions

 Window (const std::string &title, int flags=0)
 
 Window (const std::string &title, int width, int height, int flags=0)
 
 Window (const std::string &title, int x, int y, int width, int height, int flags=0)
 
virtual ~Window ()
 
const ThemeGetTheme () const
 
visualization::rendering::RendererGetRenderer () const
 
Rect GetOSFrame () const
 
void SetOSFrame (const Rect &r)
 
const char * GetTitle () const
 
void SetTitle (const char *title)
 
void SizeToFit ()
 
void SetSize (const Size &size)
 Sets the size of the window in pixels. Includes menubar on Linux. More...
 
Size GetSize () const
 
Rect GetContentRect () const
 
float GetScaling () const
 Returns the scaling factor from OS pixels to device pixels. More...
 
Point GlobalToWindowCoord (int global_x, int global_y)
 Returns the global point (in OS pixels) in window local coordinates. More...
 
bool IsVisible () const
 
void Show (bool vis=true)
 
void Close ()
 
void SetNeedsLayout ()
 Instructs the window to relayout before the next draw. More...
 
void PostRedraw ()
 
void SetTopmost (bool topmost)
 
void RaiseToTop () const
 
bool IsActiveWindow () const
 
void SetFocusWidget (Widget *w)
 Sets. More...
 
void AddChild (std::shared_ptr< Widget > w)
 
void SetOnMenuItemActivated (Menu::ItemId item_id, std::function< void()> callback)
 
void SetOnTickEvent (std::function< bool()> callback)
 
void SetOnClose (std::function< bool()> callback)
 
void SetOnKeyEvent (std::function< bool(const KeyEvent &)> callback)
 
void ShowDialog (std::shared_ptr< Dialog > dlg)
 
void CloseDialog ()
 Closes the dialog. More...
 
void ShowMessageBox (const char *title, const char *message)
 
void DestroyWindow ()
 
virtual void OnMenuItemSelected (Menu::ItemId item_id)
 
virtual void OnDragDropped (const char *path)
 
void ShowMenu (bool show)
 
int GetMouseMods () const
 
std::string GetWebRTCUID () const
 
void OnDraw ()
 
void OnResize ()
 
void OnMouseEvent (const MouseEvent &e)
 
void OnKeyEvent (const KeyEvent &e)
 
void OnTextInput (const TextInputEvent &e)
 
void OnTickEvent (const TickEvent &e)
 
WindowSystem::OSWindow GetOSWindow () const
 

Static Public Attributes

static const int FLAG_HIDDEN = (1 << 0)
 
static const int FLAG_TOPMOST = (1 << 1)
 

Protected Member Functions

virtual Size CalcPreferredSize ()
 
virtual void Layout (const LayoutContext &context)
 
LayoutContext GetLayoutContext ()
 
const std::vector< std::shared_ptr< Widget > > & GetChildren () const
 

Friends

class Application
 
class Renderer
 

Constructor & Destructor Documentation

◆ Window() [1/3]

open3d::visualization::gui::Window::Window ( const std::string &  title,
int  flags = 0 
)
explicit

Creates a Window that is auto-sized and centered. Window creation is NOT thread-safe. Window must be created on the same thread that calls Application::Run().

◆ Window() [2/3]

open3d::visualization::gui::Window::Window ( const std::string &  title,
int  width,
int  height,
int  flags = 0 
)

Creates a Window that is centered. Window creation is NOT thread-safe. Window must be created on the same thread that calls Application::Run().

◆ Window() [3/3]

open3d::visualization::gui::Window::Window ( const std::string &  title,
int  x,
int  y,
int  width,
int  height,
int  flags = 0 
)

Creates a Window. Window creation is NOT thread-safe. Window must be created on the same thread that calls Application::Run().

◆ ~Window()

open3d::visualization::gui::Window::~Window ( )
virtual

Member Function Documentation

◆ AddChild()

void open3d::visualization::gui::Window::AddChild ( std::shared_ptr< Widget w)

◆ CalcPreferredSize()

Size open3d::visualization::gui::Window::CalcPreferredSize ( )
protectedvirtual

Returns the preferred size of the window. The window is not obligated to honor this size. If all children of the window are layouts, this function does not need to be overridden. This function can only be called after MakeDrawContextCurrent() has been called.

◆ Close()

void open3d::visualization::gui::Window::Close ( )

Closes the window and destroys it (unless the close callback cancels the close)

◆ CloseDialog()

void open3d::visualization::gui::Window::CloseDialog ( )

Closes the dialog.

◆ DestroyWindow()

void open3d::visualization::gui::Window::DestroyWindow ( )

This is for internal use in rare circumstances when the destructor will not be called in a timely fashion.

◆ GetChildren()

const std::vector< std::shared_ptr< Widget > > & open3d::visualization::gui::Window::GetChildren ( ) const
protected

◆ GetContentRect()

Rect open3d::visualization::gui::Window::GetContentRect ( ) const

Returns the rectangle that is available to widgets to use; excludes the menubar.

◆ GetLayoutContext()

LayoutContext open3d::visualization::gui::Window::GetLayoutContext ( )
protected

◆ GetMouseMods()

int open3d::visualization::gui::Window::GetMouseMods ( ) const

◆ GetOSFrame()

Rect open3d::visualization::gui::Window::GetOSFrame ( ) const

Gets the window's size and position in OS pixels, not actual device pixels.

◆ GetOSWindow()

WindowSystem::OSWindow open3d::visualization::gui::Window::GetOSWindow ( ) const

◆ GetRenderer()

visualization::rendering::Renderer & open3d::visualization::gui::Window::GetRenderer ( ) const

◆ GetScaling()

float open3d::visualization::gui::Window::GetScaling ( ) const

Returns the scaling factor from OS pixels to device pixels.

◆ GetSize()

Size open3d::visualization::gui::Window::GetSize ( ) const

Returns the total interior size of window, in pixels. On Linux this includes the menubar.

◆ GetTheme()

const Theme & open3d::visualization::gui::Window::GetTheme ( ) const

◆ GetTitle()

const char * open3d::visualization::gui::Window::GetTitle ( ) const

◆ GetWebRTCUID()

std::string open3d::visualization::gui::Window::GetWebRTCUID ( ) const

Returns the window's unique identifier when WebRTCWindowSystem is in use. Returns "window_undefined" if the window system is not WebRTCWindowSystem.

◆ GlobalToWindowCoord()

Point open3d::visualization::gui::Window::GlobalToWindowCoord ( int  global_x,
int  global_y 
)

Returns the global point (in OS pixels) in window local coordinates.

◆ IsActiveWindow()

bool open3d::visualization::gui::Window::IsActiveWindow ( ) const

◆ IsVisible()

bool open3d::visualization::gui::Window::IsVisible ( ) const

◆ Layout()

void open3d::visualization::gui::Window::Layout ( const LayoutContext context)
protectedvirtual

Lays out all the widgets in the window. If all children of the window are layouts, this function does not need to be overridden.

Reimplemented in open3d::visualization::GuiVisualizer, and open3d::visualization::visualizer::O3DVisualizer.

◆ OnDragDropped()

void open3d::visualization::gui::Window::OnDragDropped ( const char *  path)
virtual

◆ OnDraw()

void open3d::visualization::gui::Window::OnDraw ( )

◆ OnKeyEvent()

void open3d::visualization::gui::Window::OnKeyEvent ( const KeyEvent e)

◆ OnMenuItemSelected()

void open3d::visualization::gui::Window::OnMenuItemSelected ( Menu::ItemId  item_id)
virtual

◆ OnMouseEvent()

void open3d::visualization::gui::Window::OnMouseEvent ( const MouseEvent e)

◆ OnResize()

void open3d::visualization::gui::Window::OnResize ( )

◆ OnTextInput()

void open3d::visualization::gui::Window::OnTextInput ( const TextInputEvent e)

◆ OnTickEvent()

void open3d::visualization::gui::Window::OnTickEvent ( const TickEvent e)

◆ PostRedraw()

void open3d::visualization::gui::Window::PostRedraw ( )

Sends a draw event to the window through the operating system's event queue.

◆ RaiseToTop()

void open3d::visualization::gui::Window::RaiseToTop ( ) const

◆ SetFocusWidget()

void open3d::visualization::gui::Window::SetFocusWidget ( Widget w)

Sets.

Parameters
was widget with text focus.

◆ SetNeedsLayout()

void open3d::visualization::gui::Window::SetNeedsLayout ( )

Instructs the window to relayout before the next draw.

◆ SetOnClose()

void open3d::visualization::gui::Window::SetOnClose ( std::function< bool()>  callback)

Sets a callback that will be called immediately before the window is closed. Callback should return true if the window should continue closing or false to cancel the close.

◆ SetOnKeyEvent()

void open3d::visualization::gui::Window::SetOnKeyEvent ( std::function< bool(const KeyEvent &)>  callback)

Sets a callback that will intercept key event dispatching to focused widget. Callback should return true to stop more dispatching or false to dispatch to focused widget.

◆ SetOnMenuItemActivated()

void open3d::visualization::gui::Window::SetOnMenuItemActivated ( Menu::ItemId  item_id,
std::function< void()>  callback 
)

Sets a callback for menu items. If you inherit from Window you can also override OnMenuItemSelected(); however, you should choose one or the other, but don't use both.

◆ SetOnTickEvent()

void open3d::visualization::gui::Window::SetOnTickEvent ( std::function< bool()>  callback)

Sets a callback that will be called on every UI tick (about 10 msec). Callback should return true if a redraw is required (i.e. the UI or a 3D scene has changed), false otherwise.

◆ SetOSFrame()

void open3d::visualization::gui::Window::SetOSFrame ( const Rect r)

Sets the window's size and position in OS pixels, not actual device pixels.

◆ SetSize()

void open3d::visualization::gui::Window::SetSize ( const Size size)

Sets the size of the window in pixels. Includes menubar on Linux.

◆ SetTitle()

void open3d::visualization::gui::Window::SetTitle ( const char *  title)

◆ SetTopmost()

void open3d::visualization::gui::Window::SetTopmost ( bool  topmost)

◆ Show()

void open3d::visualization::gui::Window::Show ( bool  vis = true)

◆ ShowDialog()

void open3d::visualization::gui::Window::ShowDialog ( std::shared_ptr< Dialog dlg)

Shows the dialog. If a dialog is currently being shown it will be closed.

◆ ShowMenu()

void open3d::visualization::gui::Window::ShowMenu ( bool  show)

◆ ShowMessageBox()

void open3d::visualization::gui::Window::ShowMessageBox ( const char *  title,
const char *  message 
)

◆ SizeToFit()

void open3d::visualization::gui::Window::SizeToFit ( )

Auto-sizes the window to the results of CalcPreferredSize(), which by default is the size that the layouts of the window want.

Friends And Related Function Documentation

◆ Application

friend class Application
friend

◆ Renderer

friend class Renderer
friend

Field Documentation

◆ FLAG_HIDDEN

const int open3d::visualization::gui::Window::FLAG_HIDDEN = (1 << 0)
static

◆ FLAG_TOPMOST

const int open3d::visualization::gui::Window::FLAG_TOPMOST = (1 << 1)
static

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