2018-10-03 10:02:43 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file ui_common.h
|
|
|
|
* Functions to provide common constants and other functions to assist
|
|
|
|
* in making a consistent UI
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef UI_COMMON_H
|
|
|
|
#define UI_COMMON_H
|
|
|
|
|
2020-10-18 11:31:07 +00:00
|
|
|
#include <wx/string.h>
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2020-10-25 16:41:38 +00:00
|
|
|
class wxSize;
|
|
|
|
class wxTextCtrl;
|
|
|
|
class wxTextEntry;
|
|
|
|
class wxWindow;
|
|
|
|
|
2018-10-03 10:02:43 +00:00
|
|
|
namespace KIUI
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the standard margin around a widget in the KiCad UI
|
|
|
|
* @return margin in pixels
|
|
|
|
*/
|
|
|
|
int GetStdMargin();
|
|
|
|
|
2020-10-25 16:41:38 +00:00
|
|
|
/**
|
|
|
|
* Return the size of @a aSingleLine of text when it is rendered in @a aWindow
|
|
|
|
* using whatever font is currently set in that window.
|
|
|
|
*/
|
|
|
|
wxSize GetTextSize( const wxString& aSingleLine, wxWindow* aWindow );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the minimum pixel width on a text control in order to make a text
|
|
|
|
* string be fully visible within it.
|
|
|
|
*
|
|
|
|
* The current font within the text control is considered. The text can come either from
|
|
|
|
* the control or be given as an argument. If the text control is larger than needed, then
|
|
|
|
* nothing is done.
|
|
|
|
*
|
|
|
|
* @param aCtrl the text control to potentially make wider.
|
|
|
|
* @param aString the text that is used in sizing the control's pixel width.
|
|
|
|
* If NULL, then
|
|
|
|
* the text already within the control is used.
|
|
|
|
* @return bool - true if the \a aCtrl had its size changed, else false.
|
|
|
|
*/
|
|
|
|
bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString = NULL );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Select the number (or "?") in a reference for ease of editing.
|
|
|
|
*/
|
|
|
|
void SelectReferenceNumber( wxTextEntry* aTextEntry );
|
|
|
|
|
2020-11-05 02:06:36 +00:00
|
|
|
/**
|
|
|
|
* Checks if a input control has focus
|
|
|
|
*/
|
|
|
|
bool IsInputControlFocused();
|
|
|
|
|
2020-11-26 15:43:48 +00:00
|
|
|
bool IsModalDialogFocused();
|
|
|
|
|
2018-10-03 10:02:43 +00:00
|
|
|
}
|
|
|
|
|
2020-03-04 09:48:18 +00:00
|
|
|
// Note: On windows, SEVERITY_ERROR collides with a system declaration,
|
|
|
|
// so we used RPT_SEVERITY _xxx instead of SEVERITY _xxx
|
2020-02-28 00:05:40 +00:00
|
|
|
enum SEVERITY {
|
2020-03-04 09:48:18 +00:00
|
|
|
RPT_SEVERITY_UNDEFINED = 0x00,
|
|
|
|
RPT_SEVERITY_INFO = 0x01,
|
|
|
|
RPT_SEVERITY_EXCLUSION = 0x02,
|
|
|
|
RPT_SEVERITY_ACTION = 0x04,
|
|
|
|
RPT_SEVERITY_WARNING = 0x08,
|
|
|
|
RPT_SEVERITY_ERROR = 0x10,
|
|
|
|
RPT_SEVERITY_IGNORE = 0x20
|
2020-02-28 00:05:40 +00:00
|
|
|
};
|
|
|
|
|
2020-06-08 02:19:46 +00:00
|
|
|
SEVERITY SeverityFromString( const wxString& aSeverity );
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2020-06-08 02:19:46 +00:00
|
|
|
wxString SeverityToString( const SEVERITY& aSeverity );
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2020-06-08 02:19:46 +00:00
|
|
|
#endif // UI_COMMON_H
|