public void Show(bool show = true) { #if WINDOWS PInvokeWindows.ShowWindow(_hwnd, show ? PInvokeWindows.ShowWindowCommands.Show : PInvokeWindows.ShowWindowCommands.Hide); #elif GTKMONO if (show) { PInvokeGTK.gtk_window_present(_gtkwindow); } else { PInvokeGTK.gtk_widget_hide(_hwnd); } #elif OSX if (show) { _nsview.Window.MakeMainWindow(); _nsview.Window.MakeKeyAndOrderFront(null); } else { _nsview.Window.OrderOut(_nsview.Window); // PerformMiniaturize? } #endif }
static void Main(string[] args) { if (IntPtr.Size == 4) { Debug.Assert(false, "sciter.dll that comes bundled in Omni is the x64 version, make sure to change it to the x86 version if building for x86 (Windows only)"); } #if WINDOWS // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero); Debug.Assert(oleres == 0); #endif #if GTKMONO PInvokeGTK.gtk_init(IntPtr.Zero, IntPtr.Zero); Mono.Setup(); #endif /* * NOTE: * In Linux, if you are getting a System.TypeInitializationException below, it is because you don't have 'libsciter-gtk-64.so' in your LD_LIBRARY_PATH. * Run 'sudo bash install-libsciter.sh' contained in this package to install it in your system. */ App.ParseArgs(args); if (App.Setup()) { SaveRegistryRunPath(); PInvokeUtils.RunMsgLoop(); GC.Collect(); GC.WaitForPendingFinalizers(); } }
/// <summary> /// Centers the window in the screen. You must call it after the window is created, but before it is shown to avoid flickering /// </summary> public void CenterTopLevelWindow() { #if WINDOWS PInvokeUtils.RECT rectWindow; PInvokeWindows.GetWindowRect(_hwnd, out rectWindow); PInvokeUtils.RECT rectWorkArea = new PInvokeUtils.RECT(); PInvokeWindows.SystemParametersInfo(PInvokeWindows.SPI_GETWORKAREA, 0, ref rectWorkArea, 0); int nX = (rectWorkArea.Width - rectWindow.Width) / 2 + rectWorkArea.left; int nY = (rectWorkArea.Height - rectWindow.Height) / 2 + rectWorkArea.top; PInvokeWindows.MoveWindow(_hwnd, nX, nY, rectWindow.Width, rectWindow.Height, false); #elif GTKMONO int screen_width = PInvokeGTK.gdk_screen_width(); int screen_height = PInvokeGTK.gdk_screen_height(); int window_width, window_height; PInvokeGTK.gtk_window_get_size(_gtkwindow, out window_width, out window_height); int nX = (screen_width - window_width) / 2; int nY = (screen_height - window_height) / 2; PInvokeGTK.gtk_window_move(_gtkwindow, nX, nY); #elif OSX _nsview.Window.Center(); #endif }
static void Main(string[] args) { #if WINDOWS // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero); Debug.Assert(oleres == 0); #endif #if GTKMONO PInvokeGTK.gtk_init(IntPtr.Zero, IntPtr.Zero); Mono.Setup(); #endif #if false //#if !DEBUG && WINDOWS if (SingleInstance.IsRunningAndAcquire()) { return; } #endif App.Run(); #if false //#if !DEBUG && WINDOWS SingleInstance.Release(); #endif }
static void Main(string[] args) { #if WINDOWS // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero); Debug.Assert(oleres == 0); #endif #if GTKMONO PInvokeGTK.gtk_init(IntPtr.Zero, IntPtr.Zero); Mono.Setup(); #endif /* * NOTE: * In Linux, if you are getting a System.TypeInitializationException below, it is because you don't have 'libsciter-gtk-64.so' in your LD_LIBRARY_PATH. * Run 'sudo bash install-libsciter.sh' contained in this package to install it in your system. */ // Create the window AppWindow = new Window(); // Prepares SciterHost and then load the page AppHost = new Host(AppWindow); // Run message loop PInvokeUtils.RunMsgLoop(); }
static void Main(string[] args) { MessageBox.Show(IntPtr.Zero, "ola", "mnundo"); if (IntPtr.Size == 4) { Debug.Assert(false, "sciter.dll that comes bundled in TestGTK is the x64 version, make sure to change it to the x86 version if building for x86 (Windows only)"); } #if WINDOWS // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero); Debug.Assert(oleres == 0); #endif #if GTKMONO PInvokeGTK.gtk_init(IntPtr.Zero, IntPtr.Zero); Mono.Setup(); #endif /* * NOTE: * In Linux, if you are getting a System.TypeInitializationException below, it is because you don't have 'libsciter-gtk-64.so' in your LD_LIBRARY_PATH. * Run 'sudo bash install-libsciter.sh' contained in this package to install it in your system. */ // Create the window AppWindow = new Window(); // Prepares SciterHost and then load the page AppHost = new Host(AppWindow); // Run message loop PInvokeUtils.RunMsgLoop(); }
public void Destroy() { #if WINDOWS PInvokeWindows.DestroyWindow(_hwnd); #elif GTKMONO PInvokeGTK.gtk_widget_destroy(_gtkwindow); #endif }
/// <summary> /// Close the window. Posts WM_CLOSE message on Windows. /// </summary> public void Close() { #if WINDOWS PInvokeWindows.PostMessage(_hwnd, PInvokeWindows.Win32Msg.WM_CLOSE, IntPtr.Zero, IntPtr.Zero); #elif GTKMONO PInvokeGTK.gtk_window_close(_gtkwindow); #elif OSX _nsview.Window.Close(); #endif }
/// <summary> /// Centers the window in the screen. You must call it after the window is created, but before it is shown to avoid flickering /// </summary> public void CenterTopLevelWindow() { #if WINDOWS IntPtr hwndParent = PInvokeWindows.GetDesktopWindow(); PInvokeUtils.RECT rectWindow, rectParent; PInvokeWindows.GetWindowRect(_hwnd, out rectWindow); PInvokeWindows.GetWindowRect(hwndParent, out rectParent); int nWidth = rectWindow.right - rectWindow.left; int nHeight = rectWindow.bottom - rectWindow.top; int nX = ((rectParent.right - rectParent.left) - nWidth) / 2 + rectParent.left; int nY = ((rectParent.bottom - rectParent.top) - nHeight) / 2 + rectParent.top; int nScreenWidth = PInvokeWindows.GetSystemMetrics(PInvokeWindows.SystemMetric.SM_CXSCREEN); int nScreenHeight = PInvokeWindows.GetSystemMetrics(PInvokeWindows.SystemMetric.SM_CYSCREEN); if (nX < 0) { nX = 0; } if (nY < 0) { nY = 0; } if (nX + nWidth > nScreenWidth) { nX = nScreenWidth - nWidth; } if (nY + nHeight > nScreenHeight) { nY = nScreenHeight - nHeight; } PInvokeWindows.MoveWindow(_hwnd, nX, nY, nWidth, nHeight, false); #elif GTKMONO int screen_width = PInvokeGTK.gdk_screen_width(); int screen_height = PInvokeGTK.gdk_screen_height(); int window_width, window_height; PInvokeGTK.gtk_window_get_size(_gtkwindow, out window_width, out window_height); int nX = (screen_width - window_width) / 2; int nY = (screen_height - window_height) / 2; PInvokeGTK.gtk_window_move(_gtkwindow, nX, nY); #elif OSX _nsview.Window.Center(); #endif }
public SciterWindow(IntPtr hwnd) { #if WINDOWS _proc = InternalProcessSciterWindowMessage; #else _proc = null; #endif _hwnd = hwnd; #if GTKMONO _gtkwindow = PInvokeGTK.gtk_widget_get_toplevel(_hwnd); Debug.Assert(_gtkwindow != IntPtr.Zero); #elif OSX _nsview = new OSXView(_hwnd); #endif }
/// <summary> /// Cross-platform handy method to get the size of the screen /// </summary> /// <returns>SIZE measures of the screen of primary monitor</returns> public static PInvokeUtils.SIZE GetPrimaryMonitorScreenSize() { #if WINDOWS int nScreenWidth = PInvokeWindows.GetSystemMetrics(PInvokeWindows.SystemMetric.SM_CXSCREEN); int nScreenHeight = PInvokeWindows.GetSystemMetrics(PInvokeWindows.SystemMetric.SM_CYSCREEN); return(new PInvokeUtils.SIZE() { cx = nScreenWidth, cy = nScreenHeight }); #elif GTKMONO int screen_width = PInvokeGTK.gdk_screen_width(); int screen_height = PInvokeGTK.gdk_screen_height(); return(new PInvokeUtils.SIZE() { cx = screen_width, cy = screen_height }); #elif OSX return(new PInvokeUtils.SIZE()); // TODO #endif }
static void Main(string[] args) { if (IntPtr.Size == 4) { Debug.Assert(false, "sciter.dll that comes bundled in DeveloperArsenal is the x64 version, make sure to change it to the x86 version if building for x86 (Windows only)"); } SciterX.API.SciterSetOption(IntPtr.Zero, SciterXDef.SCITER_RT_OPTIONS.SCITER_SET_GFX_LAYER, (IntPtr)SciterXDef.GFX_LAYER.GFX_LAYER_D2D); #if WINDOWS // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero); Debug.Assert(oleres == 0); #endif #if GTKMONO PInvokeGTK.gtk_init(IntPtr.Zero, IntPtr.Zero); Mono.Setup(); #endif App.Run(); }
/// <summary> /// Creates the Sciter window and returns the native handle /// </summary> /// <param name="frame">Rectangle of the window</param> /// <param name="creationFlags">Flags for the window creation, defaults to SW_MAIN | SW_TITLEBAR | SW_RESIZEABLE | SW_CONTROLS | SW_ENABLE_DEBUG</param> public void CreateWindow(PInvokeUtils.RECT frame = new PInvokeUtils.RECT(), SciterXDef.SCITER_CREATE_WINDOW_FLAGS creationFlags = DefaultCreateFlags, IntPtr parent = new IntPtr()) { _hwnd = _api.SciterCreateWindow( creationFlags, ref frame, _proc, IntPtr.Zero, parent ); Debug.Assert(_hwnd != IntPtr.Zero); if (_hwnd == IntPtr.Zero) { throw new Exception("CreateWindow() failed"); } #if GTKMONO _gtkwindow = PInvokeGTK.gtk_widget_get_toplevel(_hwnd); Debug.Assert(_gtkwindow != IntPtr.Zero); #elif OSX _nsview = new NSView(_hwnd); #endif }
static void Main(string[] args) { // if (IntPtr.Size == 4) // { // Debug.Assert(false, "sciter.dll that comes bundled in my_sciter_demo02 is the x64 version, make sure to change it to the x86 version if building for x86 (Windows only)"); // } #if WINDOWS // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero); Debug.Assert(oleres == 0); #endif #if GTKMONO PInvokeGTK.gtk_init(IntPtr.Zero, IntPtr.Zero); Mono.Setup(); #endif /* * NOTE: * In Linux, if you are getting a System.TypeInitializationException below, it is because you don't have 'libsciter-gtk-64.so' in your LD_LIBRARY_PATH. * Run 'sudo bash install-libsciter.sh' contained in this package to install it in your system. */ App.Run(); }