mirror of https://github.com/fltk/fltk
Moving fl_beep into screen driver.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11152 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
1a3c2dfd08
commit
5aa3fc9655
File diff suppressed because it is too large
Load Diff
|
@ -26,12 +26,6 @@
|
|||
#include <FL/Fl_Printer.H>
|
||||
#include "flstring.h"
|
||||
|
||||
#if defined(WIN32) || defined(__APPLE__)
|
||||
#elif defined(FL_PORTING)
|
||||
# pragma message "FL_PORTING: implement RGB image handling here"
|
||||
#else
|
||||
#endif
|
||||
|
||||
void fl_restore_clip(); // from fl_rect.cxx
|
||||
|
||||
//
|
||||
|
|
|
@ -19,8 +19,11 @@
|
|||
|
||||
#include "../../config_lib.h"
|
||||
#include "Fl_Cocoa_Screen_Driver.h"
|
||||
#include <FL/fl_ask.h>
|
||||
|
||||
|
||||
extern "C" void NSBeep(void);
|
||||
|
||||
|
||||
/**
|
||||
Creates a driver that manages all screen and display related calls.
|
||||
|
@ -93,6 +96,22 @@ void Fl_Cocoa_Screen_Driver::screen_dpi(float &h, float &v, int n)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Emits a system beep message.
|
||||
\param[in] type The beep type from the \ref Fl_Beep enumeration.
|
||||
\note \#include <FL/fl_ask.H>
|
||||
*/
|
||||
void Fl_Cocoa_Screen_Driver::beep(int type) {
|
||||
switch (type) {
|
||||
case FL_BEEP_DEFAULT :
|
||||
case FL_BEEP_ERROR :
|
||||
NSBeep();
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
|
|
|
@ -55,6 +55,8 @@ public:
|
|||
virtual void screen_xywh(int &X, int &Y, int &W, int &H, int n);
|
||||
virtual void screen_dpi(float &h, float &v, int n=0);
|
||||
virtual void screen_work_area(int &X, int &Y, int &W, int &H, int n);
|
||||
// --- audible output
|
||||
virtual void beep(int type);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "../../config_lib.h"
|
||||
#include "Fl_WinAPI_Screen_Driver.h"
|
||||
#include <FL/fl_ask.h>
|
||||
|
||||
# if !defined(HMONITOR_DECLARED) && (_WIN32_WINNT < 0x0500)
|
||||
# define COMPILE_MULTIMON_STUBS
|
||||
|
@ -172,6 +173,7 @@ void Fl_WinAPI_Screen_Driver::screen_dpi(float &h, float &v, int n)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
int Fl_WinAPI_Screen_Driver::x()
|
||||
{
|
||||
RECT r;
|
||||
|
@ -180,6 +182,7 @@ int Fl_WinAPI_Screen_Driver::x()
|
|||
return r.left;
|
||||
}
|
||||
|
||||
|
||||
int Fl_WinAPI_Screen_Driver::y()
|
||||
{
|
||||
RECT r;
|
||||
|
@ -188,6 +191,7 @@ int Fl_WinAPI_Screen_Driver::y()
|
|||
return r.top;
|
||||
}
|
||||
|
||||
|
||||
int Fl_WinAPI_Screen_Driver::h()
|
||||
{
|
||||
RECT r;
|
||||
|
@ -196,6 +200,7 @@ int Fl_WinAPI_Screen_Driver::h()
|
|||
return r.bottom - r.top;
|
||||
}
|
||||
|
||||
|
||||
int Fl_WinAPI_Screen_Driver::w()
|
||||
{
|
||||
RECT r;
|
||||
|
@ -205,6 +210,29 @@ int Fl_WinAPI_Screen_Driver::w()
|
|||
}
|
||||
|
||||
|
||||
void Fl_WinAPI_Screen_Driver::beep(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case FL_BEEP_QUESTION :
|
||||
case FL_BEEP_PASSWORD :
|
||||
MessageBeep(MB_ICONQUESTION);
|
||||
break;
|
||||
case FL_BEEP_MESSAGE :
|
||||
MessageBeep(MB_ICONASTERISK);
|
||||
break;
|
||||
case FL_BEEP_NOTIFICATION :
|
||||
MessageBeep(MB_ICONASTERISK);
|
||||
break;
|
||||
case FL_BEEP_ERROR :
|
||||
MessageBeep(MB_ICONERROR);
|
||||
break;
|
||||
default :
|
||||
MessageBeep(0xFFFFFFFF);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
class FL_EXPORT Fl_WinAPI_Screen_Driver : public Fl_Screen_Driver
|
||||
{
|
||||
protected:
|
||||
RECT screens[MAX_SCREENS];
|
||||
RECT work_area[MAX_SCREENS];
|
||||
float dpi[MAX_SCREENS][2];
|
||||
|
||||
static BOOL CALLBACK screen_cb(HMONITOR mon, HDC, LPRECT r, LPARAM);
|
||||
BOOL screen_cb(HMONITOR mon, HDC, LPRECT r);
|
||||
RECT screens[MAX_SCREENS];
|
||||
RECT work_area[MAX_SCREENS];
|
||||
float dpi[MAX_SCREENS][2];
|
||||
|
||||
static BOOL CALLBACK screen_cb(HMONITOR mon, HDC, LPRECT r, LPARAM);
|
||||
BOOL screen_cb(HMONITOR mon, HDC, LPRECT r);
|
||||
|
||||
public:
|
||||
virtual void init();
|
||||
|
@ -48,6 +48,8 @@ public:
|
|||
virtual void screen_xywh(int &X, int &Y, int &W, int &H, int n);
|
||||
virtual void screen_dpi(float &h, float &v, int n=0);
|
||||
virtual void screen_work_area(int &X, int &Y, int &W, int &H, int n);
|
||||
// --- audible output
|
||||
virtual void beep(int type);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "Fl_X11_Screen_Driver.h"
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/fl_ask.h>
|
||||
|
||||
#if HAVE_XINERAMA
|
||||
# include <X11/extensions/Xinerama.h>
|
||||
|
@ -186,6 +187,21 @@ void Fl_X11_Screen_Driver::screen_dpi(float &h, float &v, int n)
|
|||
}
|
||||
|
||||
|
||||
void Fl_X11_Screen_Driver::beep(int type) {
|
||||
switch (type) {
|
||||
case FL_BEEP_DEFAULT :
|
||||
case FL_BEEP_ERROR :
|
||||
if (!fl_display) fl_open_display();
|
||||
XBell(fl_display, 100);
|
||||
break;
|
||||
default :
|
||||
if (!fl_display) fl_open_display();
|
||||
XBell(fl_display, 50);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
virtual void screen_xywh(int &X, int &Y, int &W, int &H, int n);
|
||||
virtual void screen_dpi(float &h, float &v, int n=0);
|
||||
virtual void screen_work_area(int &X, int &Y, int &W, int &H, int n);
|
||||
// --- audible output
|
||||
virtual void beep(int type);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <FL/Fl_Input.H>
|
||||
#include <FL/Fl_Secret_Input.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/Fl_Screen_Driver.H>
|
||||
#include <FL/fl_draw.H>
|
||||
|
||||
static Fl_Window *message_form;
|
||||
|
@ -54,9 +55,6 @@ static const char *message_title_default;
|
|||
Fl_Font fl_message_font_ = FL_HELVETICA;
|
||||
Fl_Fontsize fl_message_size_ = -1;
|
||||
static int enableHotspot = 1;
|
||||
#ifdef __APPLE__
|
||||
extern "C" void NSBeep(void);
|
||||
#endif
|
||||
|
||||
static char avoidRecursion = 0;
|
||||
|
||||
|
@ -275,59 +273,18 @@ const char* fl_cancel= "Cancel"; ///< string pointer used in common dialogs, you
|
|||
const char* fl_close= "Close"; ///< string pointer used in common dialogs, you can change it to another language
|
||||
|
||||
// fltk functions:
|
||||
|
||||
/**
|
||||
Emits a system beep message.
|
||||
\param[in] type The beep type from the \ref Fl_Beep enumeration.
|
||||
\note \#include <FL/fl_ask.H>
|
||||
*/
|
||||
void fl_beep(int type) {
|
||||
#ifdef WIN32
|
||||
switch (type) {
|
||||
case FL_BEEP_QUESTION :
|
||||
case FL_BEEP_PASSWORD :
|
||||
MessageBeep(MB_ICONQUESTION);
|
||||
break;
|
||||
case FL_BEEP_MESSAGE :
|
||||
MessageBeep(MB_ICONASTERISK);
|
||||
break;
|
||||
case FL_BEEP_NOTIFICATION :
|
||||
MessageBeep(MB_ICONASTERISK);
|
||||
break;
|
||||
case FL_BEEP_ERROR :
|
||||
MessageBeep(MB_ICONERROR);
|
||||
break;
|
||||
default :
|
||||
MessageBeep(0xFFFFFFFF);
|
||||
break;
|
||||
}
|
||||
#elif defined(__APPLE__)
|
||||
switch (type) {
|
||||
case FL_BEEP_DEFAULT :
|
||||
case FL_BEEP_ERROR :
|
||||
NSBeep();
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
#elif defined(FL_PORTING)
|
||||
# pragma message "FL_PORTING: implement beeping or other noise generating functions"
|
||||
#else
|
||||
switch (type) {
|
||||
case FL_BEEP_DEFAULT :
|
||||
case FL_BEEP_ERROR :
|
||||
if (!fl_display) fl_open_display();
|
||||
|
||||
XBell(fl_display, 100);
|
||||
break;
|
||||
default :
|
||||
if (!fl_display) fl_open_display();
|
||||
|
||||
XBell(fl_display, 50);
|
||||
break;
|
||||
}
|
||||
#endif // WIN32
|
||||
void fl_beep(int type)
|
||||
{
|
||||
Fl::screen_driver()->beep(type);
|
||||
}
|
||||
|
||||
|
||||
/** Shows an information message dialog box.
|
||||
|
||||
\note Common dialog boxes are application modal. No more than one common dialog box
|
||||
|
|
Loading…
Reference in New Issue