Files
s7/Resources/Utilities/MiscTools.h
Saleem Edah-Tally 4b23b1f3de Allow cancelling a scan session.
- perform scanning in a thread
 - change the label of the scan button
 - trigger cancel with the same button and with the ESC key
 - process all GUI updates in asynchronous mode.

Do not use a top window as parent of popups:
 - If a top window goes away in an application with multiple instances of
 XInsaneWidget, any call to a scanner widget leads to a crash.

Minor changes.
2025-07-12 23:03:32 +02:00

62 lines
1.5 KiB
C++

/*
* File: MiscTools.h
* Author: Saleem EDAH-TALLY - nmset@yandex.com
* License: CeCILL-C
* Copyright Saleem EDAH-TALLY - © 2017
*
* Created on 4 mars 2017, 11:40
*/
#ifndef MISCTOOLS_H
#define MISCTOOLS_H
#include <wx/wx.h>
#include <wx/config.h>
#include <wx/popupwin.h>
/**
* Miscellaneous static functions.
*/
class MiscTools
{
public:
MiscTools();
virtual ~MiscTools();
/**
* Saves size and position of a wxWindow.
*/
static void SaveSizePos ( wxConfig * config, wxWindow * wind, const wxString& pathPrefix );
/**
* Restores size and position of a wxWindow.
*/
static void RestoreSizePos ( wxConfig * config, wxWindow * wind, const wxString& pathPrefix );
/**
* Shows a transient popup at mouse cursor.
* Position the popup relative to screen edges and popup dimensions,
* if possible.
*/
static void ShowTransientPopup ( wxPopupTransientWindow * p, wxWindow* content,
const int width = 0, const int height = 0 );
/**
* Shows a message as a modal dialog or as a notification.
*/
static void MessageBox ( const wxString& msg, const bool notify = false );
static void AsyncMessageBox ( const wxString& msg, const bool notify = false );
/**
* Creates a validator excluding file name forbidden characters, path
* separator and optionally space character.
*/
static wxTextValidator* MakeFileNameValidator ( bool excludeSpace = true );
private:
};
#endif /* MISCTOOLS_H */