Commit 71758aa9 authored by Davis King's avatar Davis King
Browse files

Merging in the unicode branch. The change log for that branch is as follows:

	------------------------------------------------------------------------
	r2331 | davisking | 2008-06-15 15:03:05 -0400 (Sun, 15 Jun 2008) | 1 line
	Changed paths:
	   M /branches/unicode/dlib/CMakeLists.txt

	Added another link library to the windows part of the cmake file
	------------------------------------------------------------------------
	r2330 | davisking | 2008-06-15 14:11:47 -0400 (Sun, 15 Jun 2008) | 3 lines
	Changed paths:
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_1.cpp
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_1.h
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_2.cpp
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_2.h
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_abstract.h
	   M /branches/unicode/dlib/gui_widgets/base_widgets.cpp
	   M /branches/unicode/dlib/gui_widgets/base_widgets.h
	   M /branches/unicode/dlib/gui_widgets/base_widgets_abstract.h
	   M /branches/unicode/dlib/gui_widgets/drawable.cpp
	   M /branches/unicode/dlib/gui_widgets/drawable.h
	   M /branches/unicode/dlib/gui_widgets/fonts.cpp
	   M /branches/unicode/dlib/gui_widgets/fonts.h
	   M /branches/unicode/dlib/gui_widgets/widgets.cpp
	   M /branches/unicode/dlib/gui_widgets/widgets.h
	   M /branches/unicode/dlib/gui_widgets/widgets_abstract.h

	Added Keita Mochizuki's name to a bunch of files.  Also added a missing
	prototype for the get_native_font() function in fonts.h

	------------------------------------------------------------------------
	r2329 | davisking | 2008-06-15 14:05:17 -0400 (Sun, 15 Jun 2008) | 2 lines
	Changed paths:
	   M /branches/unicode/dlib/gui_widgets/fonts.cpp
	   M /branches/unicode/dlib/gui_widgets/fonts_abstract.h
	   A /branches/unicode/dlib/gui_widgets/nativefont.h

	Added the nativefont object from Keita Mochizuki

	------------------------------------------------------------------------
	r2328 | davisking | 2008-06-15 14:04:44 -0400 (Sun, 15 Jun 2008) | 2 lines
	Changed paths:
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_2.cpp

	Removed an unused variable

	------------------------------------------------------------------------
	r2327 | davisking | 2008-06-15 13:33:31 -0400 (Sun, 15 Jun 2008) | 2 lines
	Changed paths:
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_1.cpp
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_1.h
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_2.cpp
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_2.h
	   M /branches/unicode/dlib/gui_widgets/base_widgets.h
	   M /branches/unicode/dlib/gui_widgets/base_widgets_abstract.h
	   M /branches/unicode/dlib/gui_widgets/drawable.cpp
	   M /branches/unicode/dlib/gui_widgets/drawable.h
	   M /branches/unicode/dlib/gui_widgets/drawable_abstract.h
	   M /branches/unicode/dlib/gui_widgets/widgets.cpp
	   M /branches/unicode/dlib/gui_widgets/widgets.h

	Converted tabs to spaces

	------------------------------------------------------------------------
	r2326 | davisking | 2008-06-15 13:31:32 -0400 (Sun, 15 Jun 2008) | 2 lines
	Changed paths:
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_1.cpp
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_1.h
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_2.cpp
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_2.h
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_abstract.h
	   M /branches/unicode/dlib/gui_widgets/drawable.cpp
	   M /branches/unicode/dlib/gui_widgets/drawable.h
	   M /branches/unicode/dlib/gui_widgets/drawable_abstract.h
	   M /branches/unicode/dlib/gui_widgets/widgets.cpp
	   M /branches/unicode/dlib/gui_widgets/widgets.h

	Checking in the on_string_put() event patch from Keita Mochizuki.

	------------------------------------------------------------------------
	r2325 | davisking | 2008-06-15 13:13:49 -0400 (Sun, 15 Jun 2008) | 2 lines
	Changed paths:
	   M /branches/unicode/dlib/gui_widgets/base_widgets.h
	   M /branches/unicode/dlib/gui_widgets/base_widgets_abstract.h
	   M /branches/unicode/dlib/gui_widgets/style.cpp
	   M /branches/unicode/dlib/gui_widgets/style.h
	   M /branches/unicode/dlib/gui_widgets/style_abstract.h
	   M /branches/unicode/dlib/gui_widgets/widgets.cpp
	   M /branches/unicode/dlib/gui_widgets/widgets.h
	   M /branches/unicode/dlib/gui_widgets/widgets_abstract.h
	   M /branches/unicode/dlib/serialize.h

	Added the first part of the UNICODE patch from Keita Mochizuki

	------------------------------------------------------------------------
	r2324 | davisking | 2008-06-15 13:05:17 -0400 (Sun, 15 Jun 2008) | 2 lines
	Changed paths:
	   M /branches/unicode/dlib/gui_widgets/fonts_abstract.h

	Fixed a typo in a comment

	------------------------------------------------------------------------
	r2244 | davisking | 2008-05-15 17:40:47 -0400 (Thu, 15 May 2008) | 3 lines
	Changed paths:
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_1.cpp
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_2.cpp
	   M /branches/unicode/dlib/unicode/unicode.cpp
	   M /branches/unicode/dlib/unicode/unicode.h
	   M /branches/unicode/dlib/unicode/unicode_abstract.h

	Put the convert_wstring_to_mbstring() function back in but in a way that
	works with mingw.

	------------------------------------------------------------------------
	r2219 | davisking | 2008-05-04 11:13:23 -0400 (Sun, 04 May 2008) | 1 line
	Changed paths:
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_2.cpp

	changed to be the same as the windows version
	------------------------------------------------------------------------
	r2218 | davisking | 2008-05-04 10:42:28 -0400 (Sun, 04 May 2008) | 4 lines
	Changed paths:
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_1.cpp
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_2.cpp
	   M /branches/unicode/dlib/unicode/unicode.cpp
	   M /branches/unicode/dlib/unicode/unicode.h
	   M /branches/unicode/dlib/unicode/unicode_abstract.h

	Moved some more stuff around and cleaned up the code.  The wcstombs got
	moved into the gui_core_kernel_2.cpp file since I removed it from the
	unicode.cpp file.  This was because mingw doesn't seem to support it.

	------------------------------------------------------------------------
	r2216 | davisking | 2008-05-03 16:03:40 -0400 (Sat, 03 May 2008) | 1 line
	Changed paths:
	   M /branches/unicode/dlib/algs.h
	   M /branches/unicode/dlib/string/string.h
	   M /branches/unicode/dlib/unicode/unicode.h

	Changed code to avoid compiler trouble in mingw and inane warnings in
	visual studio.
	------------------------------------------------------------------------
	r2215 | davisking | 2008-05-03 10:22:35 -0400 (Sat, 03 May 2008) | 3 lines
	Changed paths:
	   M /branches/unicode/dlib/unicode/unicode.h

	Added a char_traits for dlib::unichar since gcc 3.3 (and probably others)
	won't compile without it.

	------------------------------------------------------------------------
	r2214 | davisking | 2008-05-03 10:21:32 -0400 (Sat, 03 May 2008) | 2 lines
	Changed paths:
	   M /branches/unicode/dlib/gui_widgets/style.h

	Added a missing #include

	------------------------------------------------------------------------
	r2213 | davisking | 2008-05-02 15:11:23 -0400 (Fri, 02 May 2008) | 3 lines
	Changed paths:
	   M /branches/unicode/dlib/string/string.h
	   M /branches/unicode/dlib/unicode/unicode.cpp

	mingw doesn't have a std::wcstombs so I replaced calls to it with calls to
	dlib::narrow.  Also changed dlib::narrow so it works in mingw as well since
	the previous version ended up calling something that mingw doesn't have as
	well.
	------------------------------------------------------------------------
	r2212 | davisking | 2008-05-02 11:23:41 -0400 (Fri, 02 May 2008) | 3 lines
	Changed paths:
	   M /branches/unicode/dlib/all/source.cpp

	Applying more of Keita Mochizuki's unicode patch.


	------------------------------------------------------------------------
	r2211 | davisking | 2008-05-02 11:22:58 -0400 (Fri, 02 May 2008) | 2 lines
	Changed paths:
	   M /branches/unicode/dlib/unicode/unicode.h
	   M /branches/unicode/dlib/unicode/unicode_abstract.h

	updated specs a little

	------------------------------------------------------------------------
	r2210 | davisking | 2008-05-02 11:16:33 -0400 (Fri, 02 May 2008) | 2 lines
	Changed paths:
	   A /branches/unicode/dlib/unicode/unicode.cpp
	   M /branches/unicode/dlib/unicode/unicode.h

	Applying more of the unicode patch from Keita Mochizuki

	------------------------------------------------------------------------
	r2209 | davisking | 2008-05-02 11:10:19 -0400 (Fri, 02 May 2008) | 2 lines
	Changed paths:
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_1.cpp
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_1.h
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_2.cpp
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_2.h
	   M /branches/unicode/dlib/gui_core/gui_core_kernel_abstract.h

	Applying the first part of the unicode patch from Keita Mochizuki

	------------------------------------------------------------------------
	r2208 | davisking | 2008-05-02 10:49:15 -0400 (Fri, 02 May 2008) | 3 lines
	Changed paths:
	   A /branches/unicode (from /trunk:2207)

	Adding a branch to deal with the unicode patch from Keita Mochizuki.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402333
parent 8dda77b5
......@@ -51,7 +51,7 @@ IF (NOT DLIB_ISO_CPP_ONLY)
if (DLIB_NO_GUI_SUPPORT)
set (dlib_needed_libraries ws2_32)
else()
set (dlib_needed_libraries ws2_32 comctl32 gdi32)
set (dlib_needed_libraries ws2_32 comctl32 gdi32 imm32)
endif()
ELSEIF(APPLE) ############################################################################
FIND_LIBRARY(pthreadlib pthread)
......
......@@ -6,19 +6,6 @@
// this file contains miscellaneous stuff
#include <algorithm> // for std::swap
#include <new> // for std::bad_alloc
#include <string> // for the exceptions
#include <cstdlib>
#include "platform.h"
#include "assert.h"
#include "error.h"
#include "noncopyable.h"
#include "enable_if.h"
#include "uintn.h"
#ifdef _MSC_VER
// Disable the following warnings for Visual Studio
......@@ -56,6 +43,19 @@
#endif
#include <algorithm> // for std::swap
#include <new> // for std::bad_alloc
#include <string> // for the exceptions
#include <cstdlib>
#include "platform.h"
#include "assert.h"
#include "error.h"
#include "noncopyable.h"
#include "enable_if.h"
#include "uintn.h"
// ----------------------------------------------------------------------------------------
/*!A _dT !*/
......
......@@ -15,6 +15,7 @@
#include "../md5/md5_kernel_1.cpp"
#include "../pixel.cpp"
#include "../tokenizer/tokenizer_kernel_1.cpp"
#include "../unicode/unicode.cpp"
#ifndef DLIB_ISO_CPP_ONLY
// Code that depends on OS specific APIs
......
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net)
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), Keita Mochizuki
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_GUI_CORE_KERNEL_1_CPp_
#define DLIB_GUI_CORE_KERNEL_1_CPp_
......@@ -14,6 +14,7 @@
#pragma comment (lib, "gdi32.lib")
#pragma comment (lib, "comctl32.lib")
#pragma comment (lib, "user32.lib")
#pragma comment (lib, "imm32.lib")
#endif
......@@ -44,7 +45,7 @@ namespace dlib
static bool core_has_been_initialized = false;
static bool quit_windows_loop = false;
static bool set_window_title_done = true;
static std::string window_title;
static std::wstring window_title;
static bool move_window_done = true;
static HWND move_window_hwnd = NULL;
static int move_window_width = 0;
......@@ -54,6 +55,7 @@ namespace dlib
static bool request_new_window = false;
static DWORD dwStyle;
static HWND new_window = NULL;
static bool in_ime_composition = false;
// the window_table.get_mutex() mutex locks the above 11 variables
......@@ -549,7 +551,7 @@ namespace dlib
case WM_USER+CALL_SET_WINDOW_TITLE:
if (hwnd == helper_window)
{
SetWindowText((HWND)wParam,window_title.c_str());
SetWindowTextW((HWND)wParam,window_title.c_str());
set_window_title_done = true;
et_signaler.broadcast();
}
......@@ -588,6 +590,8 @@ namespace dlib
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
{
if (in_ime_composition) break;
base_window** win_ = window_table[hwnd];
base_window* win;
if (win_)
......@@ -1109,6 +1113,39 @@ namespace dlib
}
return DefWindowProc (hwnd, message, wParam, lParam);
case WM_IME_STARTCOMPOSITION:
in_ime_composition = true;
break;
case WM_IME_COMPOSITION:
{
in_ime_composition = false;
base_window** win_ = window_table[hwnd];
base_window* win;
if (win_)
win = *win_;
else
break;
HIMC hImc = ImmGetContext(hwnd);
if (lParam & GCS_RESULTSTR){
WCHAR wc;
LONG bufbyte = ImmGetCompositionStringW(hImc, GCS_RESULTSTR, &wc, 0);
if (bufbyte != IMM_ERROR_NODATA && bufbyte != IMM_ERROR_GENERAL){
bufbyte += sizeof(WCHAR);
WCHAR *buf = new WCHAR[bufbyte / sizeof(WCHAR)];
ImmGetCompositionStringW(hImc, GCS_RESULTSTR, buf, bufbyte);
buf[bufbyte / sizeof(WCHAR) - 1] = L'\0';
// signal the putstring event
win->on_string_put(std::wstring(buf));
delete [] buf;
}
}
ImmReleaseContext(hwnd, hImc);
}
break;
default:
break;
......@@ -1578,7 +1615,23 @@ namespace dlib
void base_window::
set_title (
const std::string& title
const std::string &title
)
{
set_title(convert_mbstring_to_wstring(title));
}
void base_window::
set_title (
const ustring &title
)
{
set_title(convert_utf32_to_wstring(title));
}
void base_window::
set_title (
const std::wstring& title
)
{
DLIB_ASSERT(is_closed() == false,
......@@ -1596,7 +1649,7 @@ namespace dlib
if (get_thread_id() == gui_core_kernel_1_globals::event_thread_id)
{
SetWindowText(hwnd,title.c_str());
SetWindowTextW(hwnd,title.c_str());
}
else
{
......@@ -1902,6 +1955,20 @@ namespace dlib
void put_on_clipboard (
const std::string& str
)
{
put_on_clipboard(convert_mbstring_to_wstring(str));
}
void put_on_clipboard (
const dlib::ustring& str
)
{
put_on_clipboard(convert_utf32_to_wstring(str));
}
void put_on_clipboard (
const std::wstring& str
)
{
using namespace gui_core_kernel_1_globals;
using namespace std;
......@@ -1913,34 +1980,34 @@ namespace dlib
EmptyClipboard();
auto_mutex M(window_table.get_mutex());
const unsigned long newlines = count(str.begin(),str.end(),'\n');
const unsigned long newlines = count(str.begin(),str.end(),L'\n');
HGLOBAL mem = GlobalAlloc(GMEM_MOVEABLE,str.size()+newlines+1);
HGLOBAL mem = GlobalAlloc(GMEM_MOVEABLE,(str.size()+newlines+1)*sizeof(wchar_t));
if (mem != NULL)
{
char* buf = reinterpret_cast<char*>(GlobalLock(mem));
wchar_t* buf = reinterpret_cast<wchar_t*>(GlobalLock(mem));
if (buf != NULL)
{
// copy str into buf while also replacing all the \n with \r\n
for (string::size_type i = 0; i < str.size(); ++i)
for (wstring::size_type i = 0; i < str.size(); ++i)
{
if (str[i] != '\n')
if (str[i] != L'\n')
{
*buf = str[i];
++buf;
}
else
{
*buf = '\r';
*buf = L'\r';
++buf;
*buf = '\n';
*buf = L'\n';
++buf;
}
}
*buf = '\0';
*buf = L'\0';
GlobalUnlock(mem);
SetClipboardData(CF_TEXT,mem);
SetClipboardData(CF_UNICODETEXT,mem);
}
}
CloseClipboard();
......@@ -1952,6 +2019,24 @@ namespace dlib
void get_from_clipboard (
std::string& str
)
{
std::wstring wstr;
get_from_clipboard(wstr);
str = convert_wstring_to_mbstring(wstr);
}
void get_from_clipboard (
dlib::ustring& str
)
{
std::wstring wstr;
get_from_clipboard(wstr);
str = convert_wstring_to_utf32(wstr);
}
void get_from_clipboard (
std::wstring& str
)
{
using namespace gui_core_kernel_1_globals;
using namespace std;
......@@ -1962,19 +2047,19 @@ namespace dlib
if (OpenClipboard(helper_window))
{
HANDLE data = GetClipboardData(CF_TEXT);
HANDLE data = GetClipboardData(CF_UNICODETEXT);
if (data != NULL)
{
char* buf = reinterpret_cast<char*>(GlobalLock(data));
wchar_t* buf = reinterpret_cast<wchar_t*>(GlobalLock(data));
if (buf != 0)
{
str.clear();
// copy the data from buf into str while also removing any '\r'
// characters.
while (*buf != '\0')
while (*buf != L'\0')
{
if (*buf != '\r')
if (*buf != L'\r')
str += *buf;
++buf;
}
......
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net)
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), Keita Mochizuki
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_GUI_CORE_KERNEl_1_
#define DLIB_GUI_CORE_KERNEl_1_
......@@ -38,6 +38,7 @@
#include "../assert.h"
#include "../queue.h"
#include "../pixel.h"
#include "../unicode.h"
namespace dlib
......@@ -136,12 +137,28 @@ namespace dlib
const std::string& str
);
void put_on_clipboard (
const std::wstring& str
);
void put_on_clipboard (
const dlib::ustring& str
);
// ----------------------------------------------------------------------------------------
void get_from_clipboard (
std::string& str
);
void get_from_clipboard (
std::wstring& str
);
void get_from_clipboard (
dlib::ustring& str
);
// ----------------------------------------------------------------------------------------
class base_window
......@@ -186,6 +203,14 @@ namespace dlib
const std::string& title
);
void set_title (
const std::wstring& title
);
void set_title (
const ustring& title
);
virtual void show (
);
......@@ -353,6 +378,10 @@ namespace dlib
bool is_printable,
unsigned long state
){}
virtual void on_string_put (
const std::wstring &str
){}
private:
......
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net)
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), Keita Mochizuki
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_GUI_CORE_KERNEL_2_CPp_
#define DLIB_GUI_CORE_KERNEL_2_CPp_
......@@ -12,6 +12,8 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/Xlocale.h>
#include <poll.h>
#include <iostream>
#include "../assert.h"
#include "../queue.h"
......@@ -37,6 +39,7 @@ namespace dlib
{
Window hwnd;
Time last_click_time;
XIC xic;
};
typedef sync_extension<binary_search_tree<Window,base_window*>::kernel_1a>::kernel_1a
......@@ -44,11 +47,12 @@ namespace dlib
int depth;
Display* disp;
XIM xim;
static Screen* screen;
Atom delete_window;
static Window exit_window;
static std::string clipboard;
static std::wstring clipboard;
static bool core_has_been_initialized = false;
static int alt_mask = 0;
......@@ -369,12 +373,27 @@ namespace dlib
bool quit_event_loop = false;
while (quit_event_loop == false)
{
// get a lock on the window_table's mutex
auto_mutex window_table_locker(window_table.get_mutex());
XEvent ev;
while (XPending(disp) == 0){
window_table.get_mutex().unlock();
// wait until receiving X11 next event
struct pollfd pfd;
pfd.fd = ConnectionNumber(disp);
pfd.events = POLLIN | POLLPRI;
poll(&pfd, 1, -1);
window_table.get_mutex().lock();
}
XNextEvent(disp,&ev);
// get a lock on the window_table's mutex
auto_mutex window_table_locker(window_table.get_mutex());
// pass events to input method.
// if this event is needed by input method, XFilterEvent returns True
if (XFilterEvent(&ev, None) == True){
continue;
}
// if this event is for one of the windows in the window_table
// then get that window out of the table and put it into win.
......@@ -398,6 +417,7 @@ namespace dlib
case SelectionRequest:
{
Atom a_ct = XInternAtom(disp, "COMPOUND_TEXT", False);
XSelectionRequestEvent* req = reinterpret_cast<XSelectionRequestEvent*>(&ev.xselectionrequest);
XEvent respond;
......@@ -409,6 +429,18 @@ namespace dlib
XA_STRING,
8,
PropModeReplace,
reinterpret_cast<const unsigned char*>(convert_wstring_to_mbstring(clipboard).c_str()),
clipboard.size()+1);
respond.xselection.property=req->property;
}
else if (req->target == a_ct)
{
XChangeProperty (disp,
req->requestor,
req->property,
a_ct,
sizeof(wchar_t)*8,
PropModeReplace,
reinterpret_cast<const unsigned char*>(clipboard.c_str()),
clipboard.size()+1);
respond.xselection.property=req->property;
......@@ -494,17 +526,30 @@ namespace dlib
if((e->state & scroll_lock_mask)!=0)
state |= base_window::KBD_MOD_SCROLL_LOCK;
char buffer[2];
KeySym key;
XLookupString(e,buffer,2,&key,NULL);
Status status;
std::wstring wstr;
wstr.resize(2);
int len = XwcLookupString(win->x11_stuff.xic,e,&wstr[0],wstr.size(),&key,&status);
if (status == XBufferOverflow){
wstr.resize(len);
len = XwcLookupString(win->x11_stuff.xic,e,&wstr[0],wstr.size(),&key,&status);
}
if (status == XLookupChars){
win->on_string_put(wstr);
}
bool is_printable;
unsigned long result;
else if (status == XLookupKeySym || status == XLookupBoth){
if (map_keys(key,shift,caps,result,is_printable))
{
// signal the keyboard event
win->on_keydown(result,is_printable,state);
bool is_printable;
unsigned long result;
if (map_keys(key,shift,caps,result,is_printable))
{
// signal the keyboard event
win->on_keydown(result,is_printable,state);
}
}
} break;
......@@ -1009,6 +1054,9 @@ namespace dlib
using namespace gui_core_kernel_2_globals;
try
{
/*
// causes dead-lock when using with XIM
if (XInitThreads() == 0)
{
dlog << LFATAL << "Unable to initialize threading support.";
......@@ -1019,12 +1067,16 @@ namespace dlib
window_table.get_mutex().unlock();
return;
}
*/
window_table.get_mutex().lock();
disp = XOpenDisplay(NULL);
window_table.get_mutex().unlock();
if (disp == 0)
{
window_table.get_mutex().lock();
disp = XOpenDisplay(":0.0");
window_table.get_mutex().unlock();
if (disp == 0)
{
dlog << LFATAL << "Unable to connect to the X display.";
......@@ -1037,14 +1089,23 @@ namespace dlib
}
}
window_table.get_mutex().lock();
screen = DefaultScreenOfDisplay(disp);
depth = DefaultDepthOfScreen(screen);
delete_window = XInternAtom(disp,"WM_DELETE_WINDOW",1);
window_table.get_mutex().unlock();
xim = NULL;
window_table.get_mutex().lock();
if (setlocale( LC_CTYPE, "" ) && XSupportsLocale() && XSetLocaleModifiers("")){
xim = XOpenIM(disp, NULL, NULL, NULL);
}
window_table.get_mutex().unlock();
// make this window just so we can send messages to it and trigger
// events in the event thread
XSetWindowAttributes attr;
window_table.get_mutex().lock();
exit_window = XCreateWindow(
disp,
DefaultRootWindow(disp),
......@@ -1059,6 +1120,7 @@ namespace dlib
0,
&attr
);
window_table.get_mutex().unlock();
// signal that the event thread is now up and running
window_table.get_mutex().lock();
......@@ -1203,6 +1265,20 @@ namespace dlib
void put_on_clipboard (
const std::string& str
)
{
put_on_clipboard(convert_mbstring_to_wstring(str));
}
void put_on_clipboard (
const dlib::ustring& str
)
{
put_on_clipboard(convert_utf32_to_wstring(str));
}
void put_on_clipboard (
const std::wstring& str
)
{
using namespace gui_core_kernel_2_globals;
init_gui_core();
......@@ -1234,12 +1310,31 @@ namespace dlib
void get_from_clipboard (
std::string& str
)
{
std::wstring wstr;
get_from_clipboard(wstr);
str = convert_wstring_to_mbstring(wstr);
}
void get_from_clipboard (
dlib::ustring& str
)
{
std::wstring wstr;
get_from_clipboard(wstr);
str = convert_wstring_to_utf32(wstr);
}
void get_from_clipboard (
std::wstring& str
)
{
using namespace gui_core_kernel_2_globals;
init_gui_core();
auto_mutex M(window_table.get_mutex());
str.clear();
unsigned char *data = 0;
wchar_t **plist = 0;
Window sown;
Atom type;
int format, result;
......@@ -1248,6 +1343,7 @@ namespace dlib
try
{
Atom atom_ct = XInternAtom(disp, "COMPOUND_TEXT", False);
sown = XGetSelectionOwner (disp, XA_PRIMARY);
if (sown == exit_window)
{
......@@ -1261,7 +1357,7 @@ namespace dlib
// of the exit_window. It doesn't matter what window we put it in
// so long as it is one under the control of this process and exit_window
// is easy to use here so that is what I'm using.
XConvertSelection (disp, XA_PRIMARY, XA_STRING, XA_PRIMARY,
XConvertSelection (disp, XA_PRIMARY, atom_ct, XA_PRIMARY,
exit_window, CurrentTime);
// This will wait until we get a SelectionNotify event which should happen
......@@ -1283,20 +1379,23 @@ namespace dlib
XFree(data);
data = 0;
}
if (bytes_left > 0 && type == XA_STRING)
if (bytes_left > 0 && type == atom_ct)
{
XTextProperty p;
result = XGetWindowProperty (disp, exit_window,
XA_PRIMARY, 0,bytes_left,0,
AnyPropertyType, &type,&format,
&len, &dummy, &data);
if (result == Success && type == XA_STRING)
AnyPropertyType, &p.encoding,&p.format,
&p.nitems, &dummy, &p.value);
if (result == Success && p.encoding == atom_ct)
{
str = (char*)data;
int n;
XwcTextPropertyToTextList(disp, &p, &plist, &n);
str = plist[0];
}
if (data)
if (plist)
{
XFree(data);
data = 0;
XwcFreeStringList(plist);
plist = 0;
}
}
}
......@@ -1305,6 +1404,11 @@ namespace dlib
{
if (data)
XFree(data);
if (plist)
{
XwcFreeStringList(plist);
plist = 0;
}
}
}
......@@ -1421,16 +1525,31 @@ namespace dlib
&attr
);
x11_stuff.xic = NULL;
if (gui_core_kernel_2_globals::xim)
{
x11_stuff.xic = XCreateIC(
gui_core_kernel_2_globals::xim,
XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
XNClientWindow, x11_stuff.hwnd,
NULL
);
}
Window temp = x11_stuff.hwnd;
base_window* ttemp = this;
gui_core_kernel_2_globals::window_table.add(temp,ttemp);
// query event mask required by input method
unsigned long event_xim = 0;
XGetICValues( x11_stuff.xic, XNFilterEvents, &event_xim, NULL );
XSelectInput(
gui_core_kernel_2_globals::disp,
x11_stuff.hwnd,
StructureNotifyMask|ExposureMask|ButtonPressMask|ButtonReleaseMask|
PointerMotionMask|LeaveWindowMask|EnterWindowMask|KeyPressMask|
KeyReleaseMask| FocusChangeMask
KeyReleaseMask| FocusChangeMask | event_xim
);
XSetWMProtocols(
......@@ -1483,6 +1602,9 @@ namespace dlib
gui_core_kernel_2_globals::window_table.destroy(x11_stuff.hwnd);
XDestroyIC(x11_stuff.xic);
x11_stuff.xic = 0;
XDestroyWindow(gui_core_kernel_2_globals::disp,x11_stuff.hwnd);
x11_stuff.hwnd = 0;
gui_core_kernel_2_globals::window_close_signaler.broadcast();
......@@ -1506,6 +1628,23 @@ namespace dlib
const std::string& title_
)
{
set_title(convert_mbstring_to_wstring(title_));
}
void base_window::
set_title (
const ustring& title_
)
{
set_title(convert_utf32_to_wstring(title_));
}
void base_window::
set_title (
const std::wstring& title_
)
{
auto_mutex M(wm);
DLIB_ASSERT(is_closed() == false,
"\tvoid base_window::set_title"
<< "\n\tYou can't do this to a window that has been closed."
......@@ -1513,9 +1652,9 @@ namespace dlib
);
// I'm pretty sure the pointer won't be modified even though
// it isn't const anymore.
char *title = const_cast<char*>(title_.c_str());
wchar_t *title = const_cast<wchar_t *>(title_.c_str());
XTextProperty property;
XStringListToTextProperty(&title,1,&property);
XwcTextListToTextProperty(gui_core_kernel_2_globals::disp,&title,1,XStdICCTextStyle, &property);
XSetWMName(gui_core_kernel_2_globals::disp,x11_stuff.hwnd,&property);
XFree(property.value);
XFlush(gui_core_kernel_2_globals::disp);
......@@ -1527,6 +1666,7 @@ namespace dlib
show (
)
{
auto_mutex M(wm);
DLIB_ASSERT(is_closed() == false,
"\tvoid base_window::show"
<< "\n\tYou can't do this to a window that has been closed."
......@@ -1553,6 +1693,7 @@ namespace dlib
hide (
)
{
auto_mutex M(wm);
DLIB_ASSERT(is_closed() == false,
"\tvoid base_window::hide"
<< "\n\tYou can't do this to a window that has been closed."
......
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net)
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), Keita Mochizuki
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_GUI_CORE_KERNEl_2_
#define DLIB_GUI_CORE_KERNEl_2_
......@@ -21,6 +21,7 @@
#include "../binary_search_tree.h"
#include <string.h>
#include "../pixel.h"
#include "../unicode.h"
namespace dlib
......@@ -46,12 +47,28 @@ namespace dlib
const std::string& str
);
void put_on_clipboard (
const std::wstring& str
);
void put_on_clipboard (
const dlib::ustring& str
);
// ----------------------------------------------------------------------------------------
void get_from_clipboard (
std::string& str
);
void get_from_clipboard (
std::wstring& str
);
void get_from_clipboard (
dlib::ustring& str
);
// ----------------------------------------------------------------------------------------
class canvas : public rectangle
......@@ -252,6 +269,14 @@ namespace dlib
const std::string& title_
);
void set_title (
const std::wstring& title_
);
void set_title (
const dlib::ustring& title_
);
virtual void show (
);
......@@ -352,6 +377,10 @@ namespace dlib
unsigned long state
){}
virtual void on_string_put (
const std::wstring &str
){}
private:
virtual void paint (
......
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net)
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), Keita Mochizuki
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_GUI_CORE_KERNEl_ABSTRACT_
#ifdef DLIB_GUI_CORE_KERNEl_ABSTRACT_
......@@ -6,6 +6,7 @@
#include <string>
#include "../algs.h"
#include "../geometry/rectangle_abstract.h"
#include "../unicode/unicode_abstract.h"
namespace dlib
{
......@@ -61,6 +62,10 @@ namespace dlib
- dlib::thread_error
!*/
// overloads for wide character strings
void put_on_clipboard (const std::wstring& str);
void put_on_clipboard (const dlib::ustring& str);
// ----------------------------------------------------------------------------------------
void get_from_clipboard (
......@@ -78,6 +83,10 @@ namespace dlib
- dlib::thread_error
!*/
// overloads for wide character strings
void get_from_clipboard (std::wtring& str);
void get_from_clipboard (dlib::utring& str);
// ----------------------------------------------------------------------------------------
......@@ -356,6 +365,26 @@ namespace dlib
- sets the title of the window
!*/
void set_title (
const std::wstring& title
);
/*!
requires
- is_closed() == false
ensures
- sets the title of the window
!*/
void set_title (
const dlib::ustring& title
);
/*!
requires
- is_closed() == false
ensures
- sets the title of the window
!*/
virtual void show (
);
/*!
......@@ -708,6 +737,20 @@ namespace dlib
- does not change the state of mutex wm
!*/
virtual void on_string_put (
const std::wstring &str
){}
/*!
requires
- is_closed() == false
- mutex wm is locked
- is called when a wide/multibyte character input method determines a string
that is being input to the window.
- str == the string that is being input
ensures
- does not change the state of mutex wm
!*/
private:
virtual void paint (
......
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net)
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), Keita Mochizuki
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_BASE_WIDGETs_CPP_
#define DLIB_BASE_WIDGETs_CPP_
......
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net)
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), Keita Mochizuki
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_BASE_WIDGETs_
......@@ -16,6 +16,7 @@
#include "../image_transforms.h"
#include "../array.h"
#include "../smart_pointers.h"
#include "../unicode.h"
#include <cctype>
......@@ -981,6 +982,20 @@ namespace dlib
void set_text (
const std::string& str
)
{
set_text(convert_mbstring_to_wstring(str));
}
void set_text (
const std::wstring& str
)
{
set_text(convert_wstring_to_utf32(str));
}
void set_text (
const ustring& str
)
{
auto_mutex M(m);
if (!stuff)
......@@ -994,9 +1009,21 @@ namespace dlib
const std::string text (
) const
{
return convert_wstring_to_mbstring(wtext());
}
const std::wstring wtext (
) const
{
return convert_utf32_to_wstring(utext());
}
const dlib::ustring utext (
) const
{
auto_mutex M(m);
std::string temp;
dlib::ustring temp;
if (stuff)
{
temp = stuff->win.text;
......@@ -1067,15 +1094,29 @@ namespace dlib
{
}
std::string text;
ustring text;
rectangle rect_all;
rectangle rect_text;
const unsigned long pad;
const font* mfont;
void set_text (
const std::string& str
)
{
set_text(convert_mbstring_to_wstring(str));
}
void set_text (
const std::wstring& str
)
{
set_text(convert_wstring_to_utf32(str));
}
void set_text (
const dlib::ustring& str
)
{
text = str.c_str();
......@@ -1227,15 +1268,11 @@ namespace dlib
class menu_item_submenu : public menu_item
{
public:
menu_item_submenu (
const std::string& str,
unichar hk = 0
) :
text(str),
f(default_font::get_font()),
hotkey(hk)
void initialize (
unichar hk
)
{
const dlib::ustring &str = text;
if (hk != 0)
{
std::string::size_type pos = str.find_first_of(hk);
......@@ -1252,6 +1289,39 @@ namespace dlib
}
}
}
public:
menu_item_submenu (
const std::string& str,
unichar hk = 0
) :
text(convert_wstring_to_utf32(convert_mbstring_to_wstring(str))),
f(default_font::get_font()),
hotkey(hk)
{
initialize(hk);
}
menu_item_submenu (
const std::wstring& str,
unichar hk = 0
) :
text(convert_wstring_to_utf32(str)),
f(default_font::get_font()),
hotkey(hk)
{
initialize(hk);
}
menu_item_submenu (
const dlib::ustring& str,
unichar hk = 0
) :
text(str),
f(default_font::get_font()),
hotkey(hk)
{
initialize(hk);
}
virtual unichar get_hot_key (
) const { return hotkey; }
......@@ -1337,7 +1407,7 @@ namespace dlib
}
private:
std::string text;
dlib::ustring text;
const font* f;
member_function_pointer<>::kernel_1a action;
unichar hotkey;
......@@ -1349,18 +1419,14 @@ namespace dlib
class menu_item_text : public menu_item
{
public:
template <typename T>
menu_item_text (
const std::string& str,
T& object,
void initialize (
T &object,
void (T::*event_handler_)(),
unichar hk = 0
) :
text(str),
f(default_font::get_font()),
hotkey(hk)
unichar hk
)
{
dlib::ustring &str = text;
action.set(object,event_handler_);
if (hk != 0)
......@@ -1380,6 +1446,49 @@ namespace dlib
}
}
public:
template <typename T>
menu_item_text (
const std::string& str,
T& object,
void (T::*event_handler_)(),
unichar hk = 0
) :
text(convert_wstring_to_utf32(convert_mbstring_to_wstring(str))),
f(default_font::get_font()),
hotkey(hk)
{
initialize(object, event_handler_, hk);
}
template <typename T>
menu_item_text (
const std::wstring& str,
T& object,
void (T::*event_handler_)(),
unichar hk = 0
) :
text(convert_wstring_to_utf32(str)),
f(default_font::get_font()),
hotkey(hk)
{
initialize(object, event_handler_, hk);
}
template <typename T>
menu_item_text (
const dlib::ustring& str,
T& object,
void (T::*event_handler_)(),
unichar hk = 0
) :
text(str),
f(default_font::get_font()),
hotkey(hk)
{
initialize(object, event_handler_, hk);
}
virtual unichar get_hot_key (
) const { return hotkey; }
......@@ -1444,7 +1553,7 @@ namespace dlib
) const { return true; }
private:
std::string text;
dlib::ustring text;
const font* f;
member_function_pointer<>::kernel_1a action;
unichar hotkey;
......
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net)
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), Keita Mochizuki
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_BASE_WIDGETs_ABSTRACT_
#ifdef DLIB_BASE_WIDGETs_ABSTRACT_
......@@ -907,6 +907,15 @@ namespace dlib
will display on the screen when the user hovers the mouse over it
!*/
// overloads for wide character strings
void set_text (
const std::wstring& str
);
void set_text (
const dlib::ustring& str
);
const std::string text (
) const;
/*!
......@@ -915,6 +924,22 @@ namespace dlib
tooltip
!*/
const std::wstring wtext (
) const;
/*!
ensures
- returns the text that is displayed inside this
tooltip
!*/
const dlib::ustring utext (
) const;
/*!
ensures
- returns the text that is displayed inside this
tooltip
!*/
private:
// restricted functions
......@@ -1102,6 +1127,27 @@ namespace dlib
clicked by the user.
- #get_hot_key() == hotkey
!*/
// overloads for wide charactor strings
template <
typename T
>
menu_item_text (
const std::wstring& str,
T& object,
void (T::*on_click_handler)(),
unichar hotkey = 0
);
template <
typename T
>
menu_item_text (
const dlib::ustring& str,
T& object,
void (T::*on_click_handler)(),
unichar hotkey = 0
);
};
// ----------------------------------------------------------------------------------------
......@@ -1126,6 +1172,17 @@ namespace dlib
clicked by the user.
- #get_hot_key() == hotkey
!*/
//overloads for wide charactor strings
menu_item_submenu (
const std::wstring& str,
unichar hotkey = 0
);
menu_item_submenu (
const dlib::ustring& str,
unichar hotkey = 0
);
};
// ----------------------------------------------------------------------------------------
......
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net)
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), Keita Mochizuki
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_DRAWABLe_CPP_
#define DLIB_DRAWABLe_CPP_
......@@ -330,6 +330,25 @@ namespace dlib
}
}
// ----------------------------------------------------------------------------------------
void drawable_window::
on_string_put (
const std::wstring &str
)
{
++event_id;
string_put.reset();
while (string_put.move_next())
{
if (string_put.element()->event_id != event_id)
{
string_put.element()->event_id = event_id;
string_put.element()->on_string_put(str);
}
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ----------- drawable object ----------------------------------------------------------
......@@ -399,6 +418,11 @@ namespace dlib
temp = this;
parent.window_moved.add(temp);
}
if (events & STRING_PUT)
{
temp = this;
parent.string_put.add(temp);
}
parent.invalidate_rectangle(rect);
}
}
......@@ -481,6 +505,8 @@ namespace dlib
parent.focus.remove(this,junk);
if (events & WINDOW_MOVED)
parent.window_moved.remove(this,junk);
if (events & STRING_PUT)
parent.string_put.remove(this,junk);
}
}
......
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net)
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), Keita Mochizuki
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_DRAWABLe_
......@@ -149,6 +149,10 @@ namespace dlib
unsigned long state
);
void on_string_put (
const std::wstring &str
);
void on_user_event (
void* p,
int i
......@@ -173,6 +177,7 @@ namespace dlib
set_of_drawables keyboard;
set_of_drawables focus;
set_of_drawables window_moved;
set_of_drawables string_put;
long lastx, lasty;
unsigned long event_id;
......@@ -201,7 +206,8 @@ namespace dlib
WINDOW_RESIZED = 8,
KEYBOARD_EVENTS = 16,
FOCUS_EVENTS = 32,
WINDOW_MOVED = 64
WINDOW_MOVED = 64,
STRING_PUT = 128
};
class drawable
......@@ -496,6 +502,10 @@ namespace dlib
bool is_printable,
unsigned long state
){}
virtual void on_string_put (
const std::wstring &str
){}
};
// ----------------------------------------------------------------------------------------
......
......@@ -132,7 +132,8 @@ namespace dlib
WINDOW_RESIZED = 8,
KEYBOARD_EVENTS = 16,
FOCUS_EVENTS = 32,
WINDOW_MOVED = 64
WINDOW_MOVED = 64,
STRING_PUT = 128
};
class drawable
......@@ -665,6 +666,19 @@ namespace dlib
- does not change the state of mutex m.
!*/
virtual void on_string_put (
const std::wstring &str
){}
/*!
requires
- events_are_enabled() == true
- mutex m is locked
- this is just the base_window::on_put_string() event forwarded to
this object. See the gui_core specs for the details about this event.
ensures
- does not change the state of mutex m.
!*/
virtual void draw (
const canvas& c
) const=0;
......
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), and Nils Labugt
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), and Nils Labugt, Keita Mochizuki
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_FONTs_CPP_
#define DLIB_FONTs_CPP_
......@@ -11,6 +11,7 @@
#include "../compress_stream.h"
#include <fstream>
#include "../tokenizer.h"
#include "nativefont.h"
namespace dlib
{
......@@ -657,6 +658,14 @@ namespace dlib
return true;
}
// ----------------------------------------------------------------------------------------
const font* get_native_font (
)
{
return nativefont::native_font::get_font();
}
// ----------------------------------------------------------------------------------------
}
......
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), and Nils Labugt
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), and Nils Labugt, Keita Mochizuki
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_FONTs_
......@@ -475,6 +475,10 @@ namespace dlib
};
// ----------------------------------------------------------------------------------------
const font* get_native_font ();
// ----------------------------------------------------------------------------------------
class default_font : public font
......
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), and Nils Labugt
// Copyright (C) 2005 Davis E. King (davisking@users.sourceforge.net), Nils Labugt, Keita Mochizuki
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_FONTs_ABSTRACT_
#ifdef DLIB_FONTs_ABSTRACT_
......@@ -379,7 +378,7 @@ namespace dlib
{
/*!
WHAT THIS OBJECT REPRESENTS
This is an implementation of the Times New Roman font.
This is an implementation of the Helvetica 12 point font.
THREAD SAFETY
It is safe to call get_font() and access the returned font from any
......@@ -478,6 +477,15 @@ namespace dlib
};
// ----------------------------------------------------------------------------------------
font* get_native_font (
);
/*!
ensures
- returns a font object that uses the local font
!*/
// ----------------------------------------------------------------------------------------
}
......
This diff is collapsed.
......@@ -22,7 +22,7 @@ namespace dlib
const font& mfont,
const long lastx,
const long lasty,
const std::string& name,
const ustring& name,
const bool is_depressed
) const
{
......@@ -87,7 +87,7 @@ namespace dlib
rectangle button_style_default::
get_min_size (
const std::string& name,
const ustring& name,
const font& mfont
) const
{
......@@ -112,7 +112,7 @@ namespace dlib
const font& mfont,
const long lastx,
const long lasty,
const std::string& name,
const ustring& name,
const bool is_depressed
) const
{
......@@ -186,7 +186,7 @@ namespace dlib
rectangle button_style_toolbar1::
get_min_size (
const std::string& name,
const ustring& name,
const font& mfont
) const
{
......@@ -211,7 +211,7 @@ namespace dlib
const font& mfont,
const long lastx,
const long lasty,
const std::string& name,
const ustring& name,
const bool is_depressed
) const
{
......@@ -268,7 +268,7 @@ namespace dlib
rectangle button_style_toolbar_icon1::
get_min_size (
const std::string& name,
const ustring& name,
const font& mfont
) const
{
......@@ -289,7 +289,7 @@ namespace dlib
const font& mfont,
const long lastx,
const long lasty,
const std::string& name,
const ustring& name,
const bool is_depressed,
const bool is_checked
) const
......@@ -355,7 +355,7 @@ namespace dlib
rectangle toggle_button_style_default::
get_min_size (
const std::string& name,
const ustring& name,
const font& mfont
) const
{
......@@ -380,7 +380,7 @@ namespace dlib
const font& mfont,
const long lastx,
const long lasty,
const std::string& name,
const ustring& name,
const bool is_depressed,
const bool is_checked
) const
......@@ -447,7 +447,7 @@ namespace dlib
rectangle toggle_button_style_check_box::
get_min_size (
const std::string& name,
const ustring& name,
const font& mfont
) const
{
......@@ -473,7 +473,7 @@ namespace dlib
const font& mfont,
const long lastx,
const long lasty,
const std::string& name,
const ustring& name,
const bool is_depressed,
const bool is_checked
) const
......@@ -567,7 +567,7 @@ namespace dlib
rectangle toggle_button_style_radio_button::
get_min_size (
const std::string& name,
const ustring& name,
const font& mfont
) const
{
......
......@@ -12,6 +12,7 @@
#include "../unicode.h"
#include "../array2d.h"
#include "../pixel.h"
#include "fonts.h"
namespace dlib
......@@ -38,7 +39,7 @@ namespace dlib
) const { return false; }
virtual rectangle get_min_size (
const std::string& name,
const ustring& name,
const font& mfont
) const = 0;
......@@ -50,7 +51,7 @@ namespace dlib
const font& mfont,
const long lastx,
const long lasty,
const std::string& name,
const ustring& name,
const bool is_depressed
) const = 0;
};
......@@ -70,12 +71,12 @@ namespace dlib
const font& mfont,
const long lastx,
const long lasty,
const std::string& name,
const ustring& name,
const bool is_depressed
) const;
virtual rectangle get_min_size (
const std::string& name,
const ustring& name,
const font& mfont
) const;
......@@ -104,7 +105,7 @@ namespace dlib
const font& mfont,
const long lastx,
const long lasty,
const std::string& name,
const ustring& name,
const bool is_depressed
) const;
......@@ -112,7 +113,7 @@ namespace dlib
) const { return true; }
virtual rectangle get_min_size (
const std::string& name,
const ustring& name,
const font& mfont
) const;
......@@ -153,7 +154,7 @@ namespace dlib
const font& mfont,
const long lastx,
const long lasty,
const std::string& name,
const ustring& name,
const bool is_depressed
) const;
......@@ -161,7 +162,7 @@ namespace dlib
) const { return true; }
virtual rectangle get_min_size (
const std::string& name,
const ustring& name,
const font& mfont
) const;
......@@ -235,7 +236,7 @@ namespace dlib
) const { return false; }
virtual rectangle get_min_size (
const std::string& name,
const ustring& name,
const font& mfont
) const = 0;
......@@ -247,7 +248,7 @@ namespace dlib
const font& mfont,
const long lastx,
const long lasty,
const std::string& name,
const ustring& name,
const bool is_depressed,
const bool is_checked
) const = 0;
......@@ -268,13 +269,13 @@ namespace dlib
const font& mfont,
const long lastx,
const long lasty,
const std::string& name,
const ustring& name,
const bool is_depressed,
const bool is_checked
) const;
virtual rectangle get_min_size (
const std::string& name,
const ustring& name,
const font& mfont
) const;
......@@ -301,13 +302,13 @@ namespace dlib
const font& mfont,
const long lastx,
const long lasty,
const std::string& name,
const ustring& name,
const bool is_depressed,
const bool is_checked
) const;
virtual rectangle get_min_size (
const std::string& name,
const ustring& name,
const font& mfont
) const;
......@@ -326,13 +327,13 @@ namespace dlib
const font& mfont,
const long lastx,
const long lasty,
const std::string& name,
const ustring& name,
const bool is_depressed,
const bool is_checked
) const;
virtual rectangle get_min_size (
const std::string& name,
const ustring& name,
const font& mfont
) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment