Skip to content
Snippets Groups Projects
Select Git revision
  • 6359a4040230005c87ac84d0fccd76a683faedda
  • master default protected
  • clem_dev
  • clem_dev_corrected
  • kokkos
  • devel
  • bcast_debug
  • MC/high_order_geometry
  • MC/mpi_nonblocking
  • MC/multigpu
  • MC/lifting_oneshot
  • MC/physent
  • curls_marco
  • MC/gefpg_lua_binding
  • emdant/dg-cherry-pick-8f1f09f5
  • v0.3.0
  • v0.2.0
  • v0.1.0
18 results

entity.h

Blame
  • paletteWindow.h 1.25 KiB
    // Gmsh - Copyright (C) 1997-2018 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to the public mailing list <gmsh@onelab.info>.
    
    #ifndef _PALETTE_WINDOW_H
    #define _PALETTE_WINDOW_H
    
    #include <FL/Fl.H>
    #include <FL/Fl_Double_Window.H>
    
    // Derive special windows from Fl_Double_Window to correctly process
    // the OS-specific shorcuts (Esc & Cmd-w on Mac, Alt+F4 on Windows)
    class paletteWindow : public Fl_Double_Window {
     public:
      paletteWindow(int w, int h, bool nonModal, const char *l=0)
        : Fl_Double_Window(w, h, l)
      {
        if(nonModal) set_non_modal();
      }
      virtual int handle(int event)
      {
        switch (event) {
        case FL_SHORTCUT:
        case FL_KEYBOARD:
    #if defined(__APPLE__)
          if(Fl::test_shortcut(FL_META+'w') || Fl::test_shortcut(FL_Escape)){
    #elif defined(WIN32)
          if(Fl::test_shortcut(FL_ALT+FL_F+4) || Fl::test_shortcut(FL_Escape)){
    #else
          if(Fl::test_shortcut(FL_CTRL+'w') || Fl::test_shortcut(FL_Escape)){
    #endif
            do_callback();
            return 1;
          }
          break;
        }
        return Fl_Double_Window::handle(event);
      }
      virtual void show()
      {
        if(non_modal() && !shown()) Fl_Double_Window::show(); // fix ordering
        Fl_Double_Window::show();
      }
    };
    
    #endif