cppAdaptive1
view release on metacpan or search on metacpan
src/dlib/gui_core/gui_core_kernel_2.h view on Meta::CPAN
// Copyright (C) 2005 Davis E. King (davis@dlib.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_
#ifdef DLIB_ISO_CPP_ONLY
#error "DLIB_ISO_CPP_ONLY is defined so you can't use this OS dependent code. Turn DLIB_ISO_CPP_ONLY off if you want to use it."
#endif
#ifdef DLIB_NO_GUI_SUPPORT
#error "DLIB_NO_GUI_SUPPORT is defined so you can't use the GUI code. Turn DLIB_NO_GUI_SUPPORT off if you want to use it."
#error "Also make sure you have libx11-dev installed on your system"
#endif
#include <string>
#include "gui_core_kernel_abstract.h"
#include "../algs.h"
#include "../threads.h"
#include "../geometry/rectangle.h"
#include "../binary_search_tree.h"
#include <string.h>
#include "../pixel.h"
#include "../unicode.h"
namespace dlib
{
// ----------------------------------------------------------------------------------------
namespace gui_core_kernel_2_globals
{
class event_handler_thread;
void trigger_user_event_threadproc (void*);
// This is a forward declaration for a struct that contains any
// X11 variables. This allows me to avoid having any dlib header files
// include the X11 headers. Which in turn speeds build times and simplifies
// build setups.
struct x11_base_windowstuff;
}
// ----------------------------------------------------------------------------------------
void put_on_clipboard (
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
{
public:
struct pixel
{
unsigned char blue;
unsigned char green;
unsigned char red;
private:
friend class canvas;
unsigned char _padding;
};
~canvas() {}
inline pixel* operator[] (
unsigned long row
) const
{
DLIB_ASSERT(row < height(),
"\tpixel* canvas::operator[]"
<< "\n\tyou have to give a row that is less than the height()"
<< "\n\tthis: " << this
<< "\n\trow: " << row
<< "\n\theight(): " << height()
);
unsigned char* temp = bits + row_width*row;
return reinterpret_cast<pixel*>(temp);
}
void fill (
unsigned char red_,
unsigned char green_,
unsigned char blue_
) const;
private:
friend class gui_core_kernel_2_globals::event_handler_thread;
canvas (
unsigned char* bits_,
unsigned long left_,
unsigned long top_,
unsigned long right_,
unsigned long bottom_
) :
rectangle(left_,top_,right_,bottom_),
bits(bits_),
width_(width()),
height_(height()),
row_width(width_*4)
{}
( run in 0.615 second using v1.01-cache-2.11-cpan-81fc1098f69 )