You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(67) |
Apr
(455) |
May
(202) |
Jun
(136) |
Jul
(203) |
Aug
(60) |
Sep
(88) |
Oct
(64) |
Nov
(56) |
Dec
(78) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(271) |
Feb
(207) |
Mar
|
Apr
|
May
(167) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Foster B. <fos...@us...> - 2006-02-03 18:20:57
|
Update of /cvsroot/adobe-source/adobe-source/adobe/test/modal_dialog_interface/resources In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1031/adobe/test/modal_dialog_interface/resources Added Files: Info.plist PkgInfo app_icon.icns Log Message: asl 1.0.13 --- NEW FILE: Info.plist --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleExecutable</key> <string>modal_dialog_interface</string> <key>CFBundleIconFile</key> <string>app_icon.icns</string> <key>CFBundleIdentifier</key> <string>com.adobe.modal_dialog_interface</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>modal_dialog_interface.app</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> <string>1.0</string> <key>CSResourcesFileMapped</key> <true/> </dict> </plist> --- NEW FILE: PkgInfo --- APPL???? --- NEW FILE: app_icon.icns --- (This appears to be a binary file; contents omitted.) |
From: Foster B. <fos...@us...> - 2006-02-03 18:20:56
|
Update of /cvsroot/adobe-source/adobe-source/adobe/test/cmath In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1031/adobe/test/cmath Added Files: Jamfile.v2 main.cpp Log Message: asl 1.0.13 --- NEW FILE: main.cpp --- /* Copyright 2005-2006 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /*************************************************************************************************/ #include <cassert> #include <iostream> #include <adobe/cmath.hpp> #include <adobe/algorithm.hpp> /*************************************************************************************************/ int main() { bool result(true); // test that the types are visible: std::cout << "adobe::float_t(10.5f) ==" << adobe::float_t(10.5f) << std::endl; std::cout << "adobe::double_t(10.5) ==" << adobe::double_t(10.5) << std::endl; // round will round halfway point towards zero. const std::size_t test_cases(8); const double table[] = { 1.0, 1.2, 1.5, 1.8, -1.0, -1.2, -1.5, -1.8 }; const float tablef[] = { 1.0f, 1.2f, 1.5f, 1.8f, -1.0f, -1.2f, -1.5f, -1.8f }; assert(sizeof(table)/sizeof(double) == test_cases); assert(sizeof(tablef)/sizeof(float) == test_cases); double result_table[test_cases]; float result_tablef[test_cases]; long result_tablel[test_cases]; { const double round_result[] = { 1.0, 1.0, 2.0, 2.0, -1.0, -1.0, -2.0, -2.0 }; adobe::transform(table, &result_table[0], (double(*)(double))(&adobe::round)); result &= adobe::equal(result_table, round_result); } { const long round_result[] = { 1L, 1L, 2L, 2L, -1L, -1L, -2L, -2L }; adobe::transform(table, &result_tablel[0], (long(*)(double))(&adobe::lround)); result &= adobe::equal(result_tablel, round_result); } { const double round_result[] = { 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0 }; adobe::transform(table, &result_table[0], (double(*)(double))(&adobe::trunc)); result &= adobe::equal(result_table, round_result); } { const double round_result[] = { 1.0, 1.0, 2.0, 2.0, -1.0, -1.0, -1.0, -2.0 }; adobe::transform(table, &result_table[0], (double(*)(double))(&adobe::round_half_up)); result &= adobe::equal(result_table, round_result); } { const long round_result[] = { 1L, 1L, 2L, 2L, -1L, -1L, -1L, -2L }; adobe::transform(table, &result_tablel[0], (long(*)(double))(&adobe::lround_half_up)); result &= adobe::equal(result_tablel, round_result); } { const float round_result[] = { 1.0f, 1.0f, 2.0f, 2.0f, -1.0f, -1.0f, -2.0f, -2.0f }; adobe::transform(tablef, &result_tablef[0], (float(*)(float))(&adobe::round)); result &= adobe::equal(result_tablef, round_result); } { const long round_result[] = { 1L, 1L, 2L, 2L, -1L, -1L, -2L, -2L }; adobe::transform(tablef, &result_tablel[0], (long(*)(float))(&adobe::lround)); result &= adobe::equal(result_tablel, round_result); } { const float round_result[] = { 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f }; adobe::transform(tablef, &result_tablef[0], (float(*)(float))(&adobe::trunc)); result &= adobe::equal(result_tablef, round_result); } { const float round_result[] = { 1.0f, 1.0f, 2.0f, 2.0f, -1.0f, -1.0f, -1.0f, -2.0f }; adobe::transform(tablef, &result_tablef[0], (float(*)(float))(&adobe::round_half_up)); result &= adobe::equal(result_tablef, round_result); } { const long round_result[] = { 1L, 1L, 2L, 2L, -1L, -1L, -1L, -2L }; adobe::transform(tablef, &result_tablel[0], (long(*)(float))(&adobe::lround_half_up)); result &= adobe::equal(result_tablel, round_result); } return result ? 0 : 1; } --- NEW FILE: Jamfile.v2 --- # Jamfile for building the cmath smoke test app project adobe/cmath ; run main.cpp ; |
From: Foster B. <fos...@us...> - 2006-02-03 18:20:56
|
Update of /cvsroot/adobe-source/adobe-source/adobe/test/begin/sources/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1031/adobe/test/begin/sources/win32 Added Files: main.cpp Log Message: asl 1.0.13 --- NEW FILE: main.cpp --- /* Copyright 2005 Ralph Thomas Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ #include "express_viewer.hpp" #include "event_dispatcher.hpp" #include "report_exception.hpp" #include "display.hpp" #include "resources.h" #include "wincast.hpp" #include <adobe/xstring.hpp> #include <boost/filesystem/convenience.hpp> #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <Commctrl.h> #include <tchar.h> #include <sstream> #include <ostream> #include <string> /*************************************************************************************************/ #if defined(BOOST_MSVC) && defined(BOOST_THREAD_USE_LIB) extern "C" void tss_cleanup_implemented() { } #endif /****************************************************************************************************/ namespace { /****************************************************************************************************/ enum { ADOBE_ABOUT = 40001, ADOBE_QUIT, ADOBE_REFRESH_VIEW, ADOBE_REFRESH_SHEET, ADOBE_NORMAL_DIALOG_SIZE, ADOBE_SMALL_DIALOG_SIZE, ADOBE_MINI_DIALOG_SIZE, ADOBE_SHOW_WIDGET_FRAMES, ADOBE_CLEAR_WIDGET_FRAMES, ADOBE_SERIALIZE_WIDGETS, ADOBE_RUN_MODAL, ADOBE_LOCALIZATION_ENUS, ADOBE_LOCALIZATION_DEDE, ADOBE_LOCALIZATION_JAJP, ADOBE_LOCALIZATION_KOKR, ADOBE_LOCALIZATION_PGPG }; /****************************************************************************************************/ void clip_quotes(std::string& str) { // // Sometimes GetCommandLine puts double quotes at the beginning and // end of the command line (this doesn't always happen, not if the // program was started from the prompt instead of the GUI). // if( str[0] == '"' ) str = str.substr( 1, str.size() - 2 ); } /****************************************************************************************************/ void open_document(adobe::application_t* app, const std::string& filename) { boost::filesystem::path file( filename, boost::filesystem::native ); std::string extension( boost::filesystem::extension( file ) ); if ( extension == ".eve") app->set_eve_file( file ); else if ( extension == ".adm") app->set_adam_file( file ); } /****************************************************************************************************/ } // namespace /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ // /// Main window event handler /// /// \param window the window associated with the event. /// \param message the Windows event type. /// \param wParam the pointer parameter. /// \param lParam the integer parameter. /// /// \return zero, or whatever the default window handler returns. // LRESULT CALLBACK main_window_proc(HWND window, UINT message, WPARAM wParam, LPARAM lParam) { application_t* app(hackery::cast<application_t*>(::GetWindowLongPtr(window, GWLP_USERDATA))); bool handled(true); if (message == WM_CLOSE) { ::PostQuitMessage(0); } if (message == WM_COMMAND) { //HMENU menu(::GetMenu(window)); WORD command(LOWORD(wParam)); switch(command) { case ADOBE_ABOUT: ::MessageBox(NULL, _T("Adobe Begin Copyright 2005-2006 Adobe Systems Incorporated"), _T("About Adobe Begin"), MB_OK); break; case ADOBE_QUIT: ::PostQuitMessage(0); break; case ADOBE_REFRESH_VIEW: app->display_window(); break; case ADOBE_REFRESH_SHEET: app->load_sheet(); break; case ADOBE_NORMAL_DIALOG_SIZE: app->set_dialog_size( size_normal_s ); app->display_window(); break; case ADOBE_SMALL_DIALOG_SIZE: app->set_dialog_size( size_small_s ); app->display_window(); break; case ADOBE_MINI_DIALOG_SIZE: app->set_dialog_size( size_mini_s ); app->display_window(); break; #ifndef NDEBUG case ADOBE_SHOW_WIDGET_FRAMES: app->frame_window(); break; case ADOBE_CLEAR_WIDGET_FRAMES: app->clear_window_frames(); break; #else case ADOBE_SHOW_WIDGET_FRAMES: case ADOBE_CLEAR_WIDGET_FRAMES: system_beep(); break; #endif case ADOBE_SERIALIZE_WIDGETS: app->serialize_connections(); break; case ADOBE_RUN_MODAL: app->run_current_as_modal(); break; case ADOBE_LOCALIZATION_ENUS: adobe::implementation::top_frame().attribute_set_m.insert( std::make_pair(adobe::static_token_range("lang"), adobe::static_token_range("en-us"))); app->display_window(); break; case ADOBE_LOCALIZATION_DEDE: adobe::implementation::top_frame().attribute_set_m.insert( std::make_pair(adobe::static_token_range("lang"), adobe::static_token_range("de-de"))); app->display_window(); break; case ADOBE_LOCALIZATION_JAJP: adobe::implementation::top_frame().attribute_set_m.insert( std::make_pair(adobe::static_token_range("lang"), adobe::static_token_range("ja-jp"))); app->display_window(); break; case ADOBE_LOCALIZATION_KOKR: adobe::implementation::top_frame().attribute_set_m.insert( std::make_pair(adobe::static_token_range("lang"), adobe::static_token_range("ko-kr"))); app->display_window(); break; case ADOBE_LOCALIZATION_PGPG: adobe::implementation::top_frame().attribute_set_m.insert( std::make_pair(adobe::static_token_range("lang"), adobe::static_token_range("pg-pg"))); app->display_window(); break; default: handled = false; } } else if (message == WM_DROPFILES) { HDROP drop(reinterpret_cast<HDROP>(wParam)); UINT numfiles(::DragQueryFile(drop, 0xFFFFFFFF, NULL, 0)); for (UINT i(0); i < numfiles; ++i) { UINT size_needed(::DragQueryFile(drop, i, NULL, 0)); std::string buffer(size_needed + 1, 0); ::DragQueryFileA(drop, i, &buffer[0], size_needed + 1); std::string temp(&buffer[0]); if (temp.rfind(".adm") == temp.size() - 4) app->set_adam_file(boost::filesystem::path(temp.c_str(), boost::filesystem::native)); else if (temp.rfind(".eve") == temp.size() - 4) app->set_eve_file(boost::filesystem::path(temp.c_str(), boost::filesystem::native)); } ::DragFinish(drop); app->load_sheet(); } else if (message == WM_DESTROY) { } else { handled = false; } // // Pass it to the default window procedure if we haven't handled it. // return handled ? 0 : DefWindowProcW(window, message, wParam, lParam); } /****************************************************************************************************/ void setup_main_window( application_t* app ) { // INIT ONCE all this stuff! INITCOMMONCONTROLSEX control_info = { sizeof(INITCOMMONCONTROLSEX), 0x0000FFFF }; ::InitCommonControlsEx(&control_info); WNDCLASSW wc; const wchar_t* window_class(L"adobe_begin_main_window"); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = main_window_proc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = ::GetModuleHandle(NULL); wc.hIcon = LoadIcon(wc.hInstance, MAKEINTRESOURCE(RES_APP_ICON)); wc.hCursor = LoadCursor(0, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wc.lpszMenuName = window_class; wc.lpszClassName = window_class; RegisterClassW(&wc); HWND root_window = ::CreateWindowExW( WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME | WS_EX_COMPOSITED, window_class, L"Adobe Begin", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU, 10, 10, 640, 100, NULL, ::CreateMenu(), ::GetModuleHandle(NULL), NULL); if (root_window == NULL) throw std::runtime_error("Could not open main window"); ::ShowWindow(root_window, SW_NORMAL); ::DragAcceptFiles(root_window, TRUE); ::SetWindowLongPtrA(root_window, GWLP_USERDATA, hackery::cast<LONG>(app)); // setup the menu system HMENU menu_bar(::GetMenu(root_window)); HMENU app_menu(::CreatePopupMenu()); HMENU view_options_menu(::CreatePopupMenu()); HMENU localization_menu(::CreatePopupMenu()); ::AppendMenu(app_menu, MF_STRING, ADOBE_ABOUT, _T("&About Adobe Begin")); ::AppendMenu(app_menu, MF_SEPARATOR, 0, NULL); ::AppendMenu(app_menu, MF_STRING, ADOBE_QUIT, _T("&Quit Adobe Begin")); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_REFRESH_VIEW, _T("&Refresh View")); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_REFRESH_SHEET, _T("R&efresh Sheet")); ::AppendMenu(view_options_menu, MF_SEPARATOR, 0, NULL); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_NORMAL_DIALOG_SIZE, _T("&Normal Dialog Size")); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_SMALL_DIALOG_SIZE, _T("&Small Dialog Size")); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_MINI_DIALOG_SIZE, _T("&Mini Dialog Size")); ::AppendMenu(view_options_menu, MF_SEPARATOR, 0, NULL); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_SHOW_WIDGET_FRAMES, _T("&Show Widget Frames")); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_CLEAR_WIDGET_FRAMES, _T("&Clear Widget Frames")); ::AppendMenu(view_options_menu, MF_SEPARATOR, 0, NULL); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_SERIALIZE_WIDGETS, _T("&Serialize Widgets")); ::AppendMenu(view_options_menu, MF_SEPARATOR, 0, NULL); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_RUN_MODAL, _T("&Run Modal")); ::AppendMenu(localization_menu, MF_STRING, ADOBE_LOCALIZATION_ENUS, _T("&Standard English (en-us)")); ::AppendMenu(localization_menu, MF_STRING, ADOBE_LOCALIZATION_DEDE, _T("&German (de-de)")); ::AppendMenu(localization_menu, MF_STRING, ADOBE_LOCALIZATION_JAJP, _T("&Japanese (ja-jp)")); ::AppendMenu(localization_menu, MF_STRING, ADOBE_LOCALIZATION_KOKR, _T("&Korean (ko-kr)")); ::AppendMenu(localization_menu, MF_STRING, ADOBE_LOCALIZATION_PGPG, _T("&Pig Latin (pg-pg)")); ::AppendMenu(menu_bar, MF_POPUP, hackery::cast<UINT_PTR>(app_menu), _T("&Adobe Begin")); ::AppendMenu(menu_bar, MF_POPUP, hackery::cast<UINT_PTR>(view_options_menu), _T("&View Options")); ::AppendMenu(menu_bar, MF_POPUP, hackery::cast<UINT_PTR>(localization_menu), _T("&Localization")); ::DrawMenuBar(root_window); // set root in display adobe::get_main_display().set_root(root_window); } /****************************************************************************************************/ namespace hackery { bool LPCWSTR_to_string(const WCHAR* wide_string, std::string& result) { typedef std::vector<char> buffer_t; // we know any utf8 encoded character can't be more than 6 bytes, // so we just allocate an extra-large buffer to begin with instead // of calling WideCharToMultiByte twice. std::size_t wide_string_length(std::wcslen(wide_string)); std::size_t buffer_size(wide_string_length * 6); buffer_t buffer(buffer_size + 1); // // Convert characters. // int result_size(WideCharToMultiByte(CP_UTF8, 0, wide_string, static_cast<int>(wide_string_length), &buffer[0], static_cast<int>(buffer_size), 0, 0)); if (result_size == 0) return false; result.assign(std::string(&buffer[0], &buffer[result_size])); return true; } } // namespace hackery /****************************************************************************************************/ bool os_initialize( application_t* app ) { // // We only need to set the resource path on Windows. There are no // system events to install handlers for, etc. We say that the // resource path is the folder with the executable inside. // LPWSTR *szArglist; int nArgs; szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs); if( NULL == szArglist ) throw std::runtime_error("CommandLineToArgvW failed"); std::string directory_string; if (!hackery::LPCWSTR_to_string(szArglist[0], directory_string)) throw std::runtime_error("Path character conversion failed."); std::string file1; if (nArgs >= 2 && !hackery::LPCWSTR_to_string(szArglist[1], file1)) throw std::runtime_error("Path character conversion failed."); std::string file2; if (nArgs >= 3 && !hackery::LPCWSTR_to_string(szArglist[2], file2)) throw std::runtime_error("Path character conversion failed."); clip_quotes(directory_string); // // Now we need to get a directory from the command line name. // boost::filesystem::path directory( directory_string, boost::filesystem::native ); // // Tell the application... // app->set_resource_directory( directory.branch_path() ); setup_main_window( app ); if (!file1.empty()) { clip_quotes(file1); open_document(app, file1); } if (!file2.empty()) { clip_quotes(file2); open_document(app, file2); } LocalFree(szArglist); return true; } /****************************************************************************************************/ void os_mainloop() { // // This is just the standard Win32 message pump. // MSG msg; while ( GetMessage( &msg, 0, 0, 0 ) ) { try{ // // Push every message through the event_dispatcher, in case it is a keyboard // modifier. // event_dispatcher::keyboard(msg.message, msg.wParam); // // We always pass every message though to the application anyway. // TranslateMessage( &msg ); DispatchMessage( &msg ); } catch ( ... ) { adobe::report_exception(); } } } /****************************************************************************************************/ void os_end_mainloop() { // // This is just the standard Win32 quit message. // ::PostQuitMessage(0); } /****************************************************************************************************/ } /****************************************************************************************************/ int __stdcall WinMain( HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR lpCmdLine, int nCmdShow ) { try { adobe::application_t* theApp = adobe::application_t::getInstance(); if( theApp ) theApp->run(); } catch( ... ) { adobe::report_exception(); } return 0; } |
From: Foster B. <fos...@us...> - 2006-02-03 18:20:55
|
Update of /cvsroot/adobe-source/adobe-source/adobe/test/begin/sources/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1031/adobe/test/begin/sources/win Removed Files: main.cpp Log Message: asl 1.0.13 --- main.cpp DELETED --- |
Update of /cvsroot/adobe-source/adobe-source/adobe/future/widgets/sources/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1031/adobe/future/widgets/sources/win32 Added Files: display.cpp event_dispatcher.cpp metrics.cpp os_utilities.cpp ui_core_implementation.cpp ui_overlay.cpp Log Message: asl 1.0.13 --- NEW FILE: ui_overlay.cpp --- /* Copyright 2005-2006 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ #ifndef NDEBUG #define WINDOWS_LEAN_AND_MEAN 1 #include <windows.h> #include "ui_overlay.hpp" #include <adobe/forest.hpp> #include <boost/bind.hpp> /****************************************************************************************************/ namespace { /****************************************************************************************************/ struct overlay_data_t { adobe::point_2d_t origin_m; adobe::extents_t extents_m; }; typedef adobe::forest<overlay_data_t> overlay_forest_t; typedef POINT coord_t; typedef std::vector<coord_t> coord_set_t; /****************************************************************************************************/ overlay_forest_t::iterator unwrap(adobe::ui_overlay_t::position_t& position) { return boost::any_cast<overlay_forest_t::iterator>(position); } /****************************************************************************************************/ adobe::ui_overlay_t::position_t wrap(overlay_forest_t::iterator view) { return adobe::ui_overlay_t::position_t(view); } /****************************************************************************************************/ RECT get_window_client_offset_rect(HWND window) { assert(window); RECT window_rect; RECT client_rect; ::GetWindowRect(window, &window_rect); ::GetClientRect(window, &client_rect); ::ClientToScreen(window, (LPPOINT) &client_rect.left); ::ClientToScreen(window, (LPPOINT) &client_rect.right); RECT result; result.left = std::abs(window_rect.left - client_rect.left); result.top = std::abs(window_rect.top - client_rect.top); result.right = std::abs(window_rect.right - client_rect.right); result.bottom = std::abs(window_rect.bottom - client_rect.bottom); return result; } /****************************************************************************************************/ void draw_line_path(HDC context, coord_set_t& points) { if (points.size() < 2) return; ::Polyline(context, &points[0], static_cast<int>(points.size())); points.erase(points.begin(), points.end()); } /****************************************************************************************************/ } // namespace /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ struct ui_overlay_t::implementation_t { implementation_t(); ~implementation_t(); struct draw_element_t { enum element_type { element_type_top_left, element_type_top_right, element_type_bottom_left, element_type_bottom_right, element_type_horizontal_poi, element_type_vertical_poi, element_type_count // always be last }; draw_element_t(element_type type, const RECT& rect, const COLORREF& color) : type_m(type), rect_m(rect), color_m(color) { } draw_element_t(const draw_element_t& rhs) : type_m(rhs.type_m), rect_m(rhs.rect_m), color_m(rhs.color_m) { } element_type type_m; RECT rect_m; COLORREF color_m; }; typedef std::vector<draw_element_t> draw_element_set_t; position_t root(HWND& element); position_t insert(position_t parent); void place(position_t node, const point_2d_t& origin, const extents_t& extents); void framing(bool do_framing); overlay_data_t flatten_overlay_data(overlay_forest_t::iterator iter); void tick_extents(const overlay_data_t& overlay_data, HWND main_window, draw_element_set_t& set); void draw_tick(HDC context, const draw_element_set_t::value_type& element); HWND overlay_m; HWND source_m; bool framing_m; overlay_forest_t tree_m; }; /****************************************************************************************************/ ui_overlay_t::ui_overlay_t() : object_m(new implementation_t()) { } ui_overlay_t::~ui_overlay_t() { delete object_m; } template <typename DisplayElement> ui_overlay_t::position_t ui_overlay_t::root(DisplayElement& element) { return ui_overlay_t::position_t(); } template <> ui_overlay_t::position_t ui_overlay_t::root<HWND>(HWND& element) { return object_m->root(element); } ui_overlay_t::position_t ui_overlay_t::insert(position_t parent) { return object_m->insert(parent); } void ui_overlay_t::place(position_t node, const point_2d_t& origin, const extents_t& extents) { return object_m->place(node, origin, extents); } void ui_overlay_t::framing(bool do_framing) { object_m->framing(do_framing); } ui_overlay_t::implementation_t& ui_overlay_t::implementation() { return *object_m; } const ui_overlay_t::implementation_t& ui_overlay_t::implementation() const { return *object_m; } /****************************************************************************************************/ #if 0 #pragma mark - #endif /****************************************************************************************************/ ui_overlay_t::implementation_t::implementation_t() : overlay_m(0), source_m(0), framing_m(false) { } /****************************************************************************************************/ ui_overlay_t::implementation_t::~implementation_t() { if (overlay_m) ::DestroyWindow(overlay_m); overlay_m = 0; } /****************************************************************************************************/ ui_overlay_t::position_t ui_overlay_t::implementation_t::root(HWND& element) { assert(element); source_m = element; return wrap(tree_m.insert(tree_m.begin(), overlay_data_t())); } /****************************************************************************************************/ ui_overlay_t::position_t ui_overlay_t::implementation_t::insert(position_t parent) { overlay_forest_t::iterator position(unwrap(parent)); position.edge() = adobe::forest_trailing_edge; return wrap(tree_m.insert(position, overlay_data_t())); } /****************************************************************************************************/ void ui_overlay_t::implementation_t::place(position_t node, const point_2d_t& origin, const extents_t& extents) { overlay_forest_t::iterator position(unwrap(node)); position->origin_m = origin; position->extents_m = extents; } /****************************************************************************************************/ void ui_overlay_t::implementation_t::framing(bool do_framing) { assert(source_m); framing_m = do_framing; if (!do_framing) { //set_control_invalid(control_m); } else { HWND main_window(source_m);//::GetAncestor(source_m, GA_ROOT)); HDC context(::GetWindowDC(main_window)); draw_element_set_t tick_set; overlay_forest_t::preorder_iterator first(tree_m.begin()); overlay_forest_t::preorder_iterator last(tree_m.end()); ::BringWindowToTop(main_window); for (; first != last; ++first) tick_extents(flatten_overlay_data(first.base()), main_window, tick_set); if (!tick_set.empty()) adobe::for_each(tick_set, boost::bind(&implementation_t::draw_tick, boost::ref(*this), context, _1)); ::ReleaseDC(main_window, context); } } /****************************************************************************************************/ overlay_data_t ui_overlay_t::implementation_t::flatten_overlay_data(overlay_forest_t::iterator iter) { overlay_data_t result; point_2d_t& origin(result.origin_m); overlay_forest_t::iterator last(tree_m.end()); result.extents_m = iter->extents_m; for (; iter != last; iter = find_parent(iter)) { origin.x_m += iter->origin_m.x_m; origin.y_m += iter->origin_m.y_m; } return result; } /****************************************************************************************************/ void ui_overlay_t::implementation_t::tick_extents(const overlay_data_t& overlay_data, HWND main_window, draw_element_set_t& set) { typedef draw_element_t de_t; static const long tick(3); static COLORREF blue(RGB(0, 0, 255)); static COLORREF red(RGB(255, 0, 0)); const point_2d_t& position(overlay_data.origin_m); const extents_t& extents(overlay_data.extents_m); RECT extra(get_window_client_offset_rect(main_window)); long top(position.y_m + extra.top - 1); long left(position.x_m + extra.left); long bottom(top + extents.height() - 1); long right(left + extents.width()); long tick_width(std::min(tick, extents.width())); long tick_height(std::min(tick, extents.height())); long tick_start_right(std::max(right - tick, left)); long tick_start_bottom(std::max(bottom - tick, top)); RECT top_left_rect = { left, top, left + tick_width, top + tick_height }; RECT top_right_rect = { tick_start_right, top, tick_start_right + tick_width, top + tick_height }; RECT bottom_left_rect = { left, tick_start_bottom + 1, left + tick_width + 1, tick_start_bottom + tick_height }; RECT bottom_right_rect = { tick_start_right - 1, tick_start_bottom + 1, tick_start_right + tick_width, tick_start_bottom + tick_height }; set.push_back(de_t(de_t::element_type_top_left, top_left_rect, blue)); set.push_back(de_t(de_t::element_type_top_right, top_right_rect, blue)); set.push_back(de_t(de_t::element_type_bottom_left, bottom_left_rect, blue)); set.push_back(de_t(de_t::element_type_bottom_right, bottom_right_rect, blue)); { guide_set_t::const_iterator iter(extents.horizontal().poi_m.begin()); guide_set_t::const_iterator last(extents.horizontal().poi_m.end()); for (; iter != last; ++iter) { guide_set_t::value_type cur(*iter); long poi(left + cur); RECT top_tick = { poi, top, poi + 1, top + tick_height }; RECT bottom_tick = { poi, bottom - tick_height, poi + 1, bottom }; set.push_back(de_t(de_t::element_type_horizontal_poi, top_tick, red)); set.push_back(de_t(de_t::element_type_horizontal_poi, bottom_tick, red)); } } { guide_set_t::const_iterator iter(extents.vertical().poi_m.begin()); guide_set_t::const_iterator last(extents.vertical().poi_m.end()); for (; iter != last; ++iter) { guide_set_t::value_type cur(*iter); long poi(top + cur); RECT left_tick = { left, poi, left + tick_width, poi + 1 }; RECT right_tick = { right - tick_width, poi, right, poi + 1 }; set.push_back(de_t(de_t::element_type_vertical_poi, left_tick, red)); set.push_back(de_t(de_t::element_type_vertical_poi, right_tick, red)); } } } /****************************************************************************************************/ void ui_overlay_t::implementation_t::draw_tick(HDC context, const draw_element_set_t::value_type& element) { typedef draw_element_set_t::value_type desvt_t; coord_set_t points; long top(element.rect_m.top + 1); long left(element.rect_m.left); long bottom(element.rect_m.bottom + 1); long right(element.rect_m.right - 1); coord_t top_left = { left, top }; coord_t top_right = { right, top }; coord_t bottom_left = { left, bottom }; coord_t bottom_right = { right, bottom }; HPEN pen(::CreatePen(PS_SOLID, 1, element.color_m)); HPEN old_pen((HPEN) SelectObject(context, pen)); if (element.type_m == desvt_t::element_type_top_left) { points.push_back(top_right); points.push_back(top_left); points.push_back(bottom_left); } else if (element.type_m == desvt_t::element_type_top_right) { points.push_back(top_left); points.push_back(top_right); points.push_back(bottom_right); } else if (element.type_m == desvt_t::element_type_bottom_left) { points.push_back(top_left); points.push_back(bottom_left); points.push_back(bottom_right); } else if (element.type_m == desvt_t::element_type_bottom_right) { points.push_back(top_right); points.push_back(bottom_right); points.push_back(bottom_left); } else if (element.type_m == desvt_t::element_type_horizontal_poi) { points.push_back(top_left); points.push_back(bottom_left); } else if (element.type_m == desvt_t::element_type_vertical_poi) { points.push_back(top_left); points.push_back(top_right); } draw_line_path(context, points); // clean up pen work SelectObject(context, old_pen); DeleteObject(pen); } /****************************************************************************************************/ } // namespace adobe /****************************************************************************************************/ #endif /****************************************************************************************************/ --- NEW FILE: ui_core_implementation.cpp --- /* Copyright 2005-2006 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ #include "ui_core_implementation.hpp" #include "ui_core_common.hpp" #include "display.hpp" #include "ui_overlay.hpp" #include "metrics.hpp" #include "wincast.hpp" #include <adobe/value.hpp> #include <adobe/array.hpp> [...4400 lines suppressed...] display_t::position_t result; // if (scroll_ref) result = display.insert<HWND>(parent, scroll_ref); // else result = display.insert<HWND>(parent, ref); if (label_ref) display.insert<HWND>(parent, label_ref); if (static_disable_ref) display.insert<HWND>(parent, static_disable_ref); if (popup_static_disable_ref) display.insert<HWND>(parent, popup_static_disable_ref); if (popup_ref) display.insert<HWND>(parent, popup_ref); return result; } /****************************************************************************************************/ } // namespace adobe /****************************************************************************************************/ --- NEW FILE: display.cpp --- /* Copyright 2005-2006 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ #define WINDOWS_LEAN_AND_MEAN 1 #include <windows.h> #include "display.hpp" #include <cassert> #include <stdexcept> /****************************************************************************************************/ namespace { /****************************************************************************************************/ struct view_wrap { explicit view_wrap(HWND ref) : ref_m(ref) { } HWND ref_m; }; /****************************************************************************************************/ HWND unwrap(adobe::display_t::position_t& position) { return (boost::any_cast<view_wrap>(position)).ref_m; } /****************************************************************************************************/ adobe::display_t::position_t wrap(HWND view) { return adobe::display_t::position_t(view_wrap(view)); } /****************************************************************************************************/ } // namespace /****************************************************************************************************/ #if 0 #pragma mark - #endif /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ display_t& get_main_display() { static display_t display_s; return display_s; } /****************************************************************************************************/ struct display_t::implementation_t { void erase(display_t::position_t& position); HWND root_m; }; /****************************************************************************************************/ template <typename DisplayElement> display_t::position_t insert(display_t& display, display_t::position_t& position, DisplayElement& element) { return display.insert(position, element); } /****************************************************************************************************/ template <> HWND unwrap_display_token<HWND, adobe::display_t::position_t>(adobe::display_t::position_t& position) { return (boost::any_cast<view_wrap>(position)).ref_m; } /****************************************************************************************************/ #if 0 #pragma mark - #endif /****************************************************************************************************/ display_t::display_t() : object_m(new implementation_t()) { } display_t::~display_t() { delete object_m; object_m = 0; } display_t::implementation_t& display_t::implementation() { return *object_m; } const display_t::implementation_t& display_t::implementation() const { return *object_m; } template <typename DisplayElement> void display_t::set_root(DisplayElement&) { } template <> void display_t::set_root<HWND>(HWND& root) { object_m->root_m = root; } display_t::position_t display_t::root() { return wrap(object_m->root_m); } void display_t::erase(position_t& position) { return object_m->erase(position); } template <typename DisplayElement> display_t::position_t display_t::insert(position_t& parent, DisplayElement& element) { return insert(parent, adobe::view_for_element<HWND>(element)); } /****************************************************************************************************/ template <> display_t::position_t display_t::insert<HWND>(position_t& parent, HWND& element) { if (parent.type() == typeid(view_wrap)) { HWND parent_view(unwrap(parent)); if (::SetParent(element, parent_view) == 0) throw std::runtime_error("display_t::insert<HWND>"); // ADOBE_REQUIRE_STATUS(::GetLastError()); assert(::GetParent(element) == parent_view); } return wrap(element); } /****************************************************************************************************/ #if 0 #pragma mark - #endif /****************************************************************************************************/ void display_t::implementation_t::erase(display_t::position_t&) { // REVISIT (fbrereto) : What should we do here? // 1) Call DetachSubView on the position? // 2) Call erase recursively for all children of the position? // 3) Invalidate (wipe) the position data? // 4) Invoke some (currently nonexistent) detach() callback for the client? // 4a) With what parameters, considering questions 1, 2, & 3? } /****************************************************************************************************/ } // namespace adobe /****************************************************************************************************/ --- NEW FILE: metrics.cpp --- /* Copyright 2005 Ralph Thomas Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ // // This is the implementation of the class which looks up widget metrics on // Windows systems. It has two implementations, one uses UxTheme to look up // widget metrics, and the other uses constant values (and is used on systems // where UxTheme is unavailable or Visual Styles are disabled). // /****************************************************************************************************/ #include "metrics.hpp" #include "wincast.hpp" #include <sstream> #include <stdexcept> #include <tchar.h> #include <cstring> #include <boost/static_assert.hpp> #include <uxtheme.h> //Yuck: #include <tmschema.h> #define SCHEME_STRINGS 1 #include <tmschema.h> //End yuck /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ // /// This implementation of metrics_t uses the Win32 library to lookup font attributes. /// It returns constant values for other metrics. // class metrics_win32_t : public metrics_t { // /// Store the class name of the window which we're currently examining. // std::wstring class_name_m; protected: // /// Return the window class which we are currently returing metrics for. /// /// \return the current window class. // std::wstring get_window_class() const { return class_name_m; } public: // // from metrics_t // bool set_window(HWND window) { WCHAR class_name_buf[50]; if (!GetClassNameW(window, class_name_buf, 50)) return false; class_name_m = class_name_buf; return true; } bool get_font(int widget_type, LOGFONTW& out_font) const { // // On plain windows everything uses DEFAULT_GUI_FONT. // HGDIOBJ font = GetStockObject(DEFAULT_GUI_FONT); if (!font) return false; // // Extract a LOGFONTW from the HFONT. // int rv = GetObject(font, sizeof(out_font), reinterpret_cast<LPVOID>(&out_font)); DeleteObject(font); return (rv != 0); } bool get_font_metrics(int widget_type, TEXTMETRIC& out_metrics) const { // // Try to use the font from get_font before we fall back to DEFAULT_GUI_FONT. // LOGFONTW logical_font = { 0 }; HGDIOBJ font = 0; HDC tmp_dc = GetDC(0); if (get_font(widget_type, logical_font)) { font = (HGDIOBJ)CreateFontIndirectW(&logical_font); } if (!font) font = GetStockObject(DEFAULT_GUI_FONT); // // Get the metrics. // HGDIOBJ oldFont = SelectObject(tmp_dc, font); BOOL have_metrics = GetTextMetrics(tmp_dc, &out_metrics); // // Clean up. // DeleteObject(SelectObject(tmp_dc, oldFont)); ReleaseDC(0, tmp_dc); return hackery::cast<bool>(have_metrics); } bool get_text_extents(int widget_type, std::wstring text, RECT& out_extents) const { // // Create the font and select it into a temporary device context. // HDC tmp_dc = GetDC(0); LOGFONTW logical_font = {0}; HGDIOBJ font = 0; // // Try to use get_font, in case there is another font we're meant // to use. Then fallback on DEFAULT_GUI_FONT. // if (get_font(widget_type, logical_font)) { font = (HGDIOBJ)CreateFontIndirectW(&logical_font); } if (!font) font = GetStockObject(DEFAULT_GUI_FONT); // // Extract the extents. // HGDIOBJ original_font = SelectObject(tmp_dc, font); SIZE out_size = {0, 0}; BOOL have_extents = GetTextExtentPoint32W(tmp_dc, text.c_str(), static_cast<int>(text.size()), &out_size); // // Clean up, and convert the size to a rect. // DeleteObject(SelectObject(tmp_dc, original_font)); ReleaseDC(0, tmp_dc); out_extents.left = 0; out_extents.top = 0; out_extents.right = out_size.cx; out_extents.bottom = out_size.cy; return hackery::cast<bool>(have_extents); } bool get_integer(int widget_type, int measurement, int& out_val) const { if ((widget_type == CP_DROPDOWNBUTTON) && (measurement == TMT_BORDERSIZE) && (class_name_m == L"ComboBox")) { out_val = 1; return true; } if ((widget_type == EP_EDITTEXT) && (measurement == TMT_BORDERSIZE)) { out_val = 1; return true; } out_val = 0; return false; } bool get_size(int widget_type, THEMESIZE measurement, SIZE& out_size) const { if (class_name_m == L"Button") { if ((widget_type == BP_CHECKBOX) || (widget_type == BP_RADIOBUTTON)) { // // Strictly the width of the checkbox widget is 13 pixels. // This adds some padding so that letters don't get clipped. // out_size.cx = 23; out_size.cy = 13; return true; } if (widget_type == BP_GROUPBOX) { out_size.cx = 8; out_size.cy = 8; return true; } out_size.cx = 0; out_size.cy = 0; return true; } out_size.cx = 0; out_size.cy = 0; return false; } bool get_margins(int widget_type, MARGINS& out_margins) const { if ((class_name_m == L"Button") && (widget_type == BP_PUSHBUTTON)) { out_margins.cxLeftWidth = 3; out_margins.cxRightWidth = 3; out_margins.cyTopHeight = 3; out_margins.cyBottomHeight = 3; return true; } return false; } bool get_button_text_margins(int widget_type, RECT& out_margins) const { if ((class_name_m == L"Button") && (widget_type == BP_CHECKBOX)) { out_margins.top = 1; out_margins.left = 1; out_margins.bottom = 1; out_margins.right = 1; return true; } return false; } bool using_styles() const { return false; } void draw_parent_background(HWND window, HDC dc) { // // REVISIT (ralpht): This function doesn't actually get called when visual // styles aren't available, so there's no implementation here. That // may not always be the case, however... // throw std::runtime_error("metrics::draw_parent_background not implemented without visual styles enabled"); } }; /****************************************************************************************************/ const int kState = 1; // /// This implementation of metrics_t uses the UxTheme library to obtain widget metrics. /// It inherits from the plain Win32 implementation because it occasionally falls back /// on the font functions. // class metrics_uxtheme_t : public metrics_win32_t { typedef metrics_win32_t _super; // // Handle to the UxTheme.DLL. // HMODULE theme_dll_m; // // Handle to the theme which we are currently using. // HTHEME theme_m; // // Technically all of these calls are supposed to use a state parameter. We are // only obtaining metrics, rather than drawing, so we don't actually need to // specify any particular state (as metrics should be invariant over all states). // // According to the tmschema.h (in the Platform SDK) a state of 1 should always // work. // // const int kState; // // Because we open UxTheme.DLL dynamically we need to keep function pointers into // the library. These are those. // typedef HTHEME (__stdcall *OpenThemeData_t)(HWND hwnd, LPCWSTR pszClassList); typedef HRESULT (__stdcall *CloseThemeData_t)(HTHEME hTheme); typedef HRESULT (__stdcall *GetThemeMargins_t)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, RECT* prc, MARGINS* pMargins); typedef HRESULT (__stdcall *GetThemePartSize_t)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT* pRect, enum THEMESIZE eSize, SIZE* psz); typedef HRESULT (__stdcall *GetThemeInt_t)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, int* piVal); typedef HRESULT (__stdcall *GetThemeTextExtent_t)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, const RECT* pBoundingRect, RECT* pExtentRect); typedef HRESULT (__stdcall *GetThemeTextMetrics_t)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, TEXTMETRIC* ptm); typedef HRESULT (__stdcall *GetThemeFont_t)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, LOGFONTW* pFont); typedef HRESULT (__stdcall *GetThemeSysFont_t)(HTHEME hTheme, int iFontId, LOGFONTW* pFont); typedef HRESULT (__stdcall *DrawThemeParentBackground_t)(HWND window, HDC dc, LPRECT prc); typedef BOOL (__stdcall *IsThemeActive_t)(void); OpenThemeData_t OpenThemeDataPtr; CloseThemeData_t CloseThemeDataPtr; GetThemeMargins_t GetThemeMarginsPtr; GetThemePartSize_t GetThemePartSizePtr; GetThemeInt_t GetThemeIntPtr; GetThemeTextExtent_t GetThemeTextExtentPtr; GetThemeTextMetrics_t GetThemeTextMetricsPtr; GetThemeFont_t GetThemeFontPtr; GetThemeSysFont_t GetThemeSysFontPtr; IsThemeActive_t IsThemeActivePtr; DrawThemeParentBackground_t DrawThemeParentBackgroundPtr; // // We only ever try to load UxTheme.DLL once, this boolean tells us if we were // successful. // bool loaded_m; // /// The HWND we are currently inspecting. // HWND window_m; public: metrics_uxtheme_t() : theme_dll_m(0), theme_m(0), OpenThemeDataPtr(0), CloseThemeDataPtr(0), GetThemeMarginsPtr(0), GetThemePartSizePtr(0), GetThemeIntPtr(0), GetThemeTextExtentPtr(0), GetThemeTextMetricsPtr(0), GetThemeFontPtr(0), GetThemeSysFontPtr(0), IsThemeActivePtr(0), DrawThemeParentBackgroundPtr(0), loaded_m(false), window_m(0) { // // Try to load the UxTheme library, if we can. // theme_dll_m = LoadLibrary(__T("UxTheme.dll")); if (!theme_dll_m) return; // // Load the addresses of the UxTheme functions. // if (!(OpenThemeDataPtr = (OpenThemeData_t)GetProcAddress(theme_dll_m, "OpenThemeData"))) return; if (!(CloseThemeDataPtr = (CloseThemeData_t)GetProcAddress(theme_dll_m, "CloseThemeData"))) return; if (!(GetThemeMarginsPtr = (GetThemeMargins_t)GetProcAddress(theme_dll_m, "GetThemeMargins"))) return; if (!(GetThemePartSizePtr = (GetThemePartSize_t)GetProcAddress(theme_dll_m, "GetThemePartSize"))) return; if (!(GetThemeIntPtr = (GetThemeInt_t)GetProcAddress(theme_dll_m, "GetThemeInt"))) return; if (!(GetThemeTextExtentPtr = (GetThemeTextExtent_t)GetProcAddress(theme_dll_m, "GetThemeTextExtent"))) return; if (!(GetThemeTextMetricsPtr = (GetThemeTextMetrics_t)GetProcAddress(theme_dll_m, "GetThemeTextMetrics"))) return; if (!(GetThemeFontPtr = (GetThemeFont_t)GetProcAddress(theme_dll_m, "GetThemeFont"))) return; if (!(GetThemeSysFontPtr = (GetThemeSysFont_t)GetProcAddress(theme_dll_m, "GetThemeSysFont"))) return; if (!(IsThemeActivePtr = (IsThemeActive_t)GetProcAddress(theme_dll_m, "IsThemeActive"))) return; if (!(DrawThemeParentBackgroundPtr = (DrawThemeParentBackground_t)GetProcAddress(theme_dll_m, "DrawThemeParentBackground"))) return; // // All loaded! // loaded_m = true; } virtual ~metrics_uxtheme_t() { if (theme_dll_m) FreeLibrary(theme_dll_m); } // /// This function returns true if the theme is active. If the theme /// is not active then the plain win32 metrics object should be used. // bool theme_active() const { if (!loaded_m) return false; return hackery::cast<bool>((*IsThemeActivePtr)()); } // // from metrics_t // bool set_window(HWND win) { if (!_super::set_window(win)) return false; // // Keep this window around. // window_m = win; // // Close any already open theme data, and load up the new // data. // if (theme_m) (*CloseThemeDataPtr)(theme_m); // The next section of code tries to account for the fact that the names required // by OpenThemeData are different from the "class name" used by CreateWindowEx // I am having trouble finding definitive documentation on these names, so I am // not going to clean this up and break it out into a reusable conversion function yet. // MM - 11/15/2005 static const wchar_t* class_names[] = { L"ComboBoxEx32", L"SysTabControl32", L"SysTreeView32", L"msctls_progress32", L"msctls_trackbar32", L"msctls_updown32", L"tooltips_class32", //L"Button", //L"ComboBox", //L"Edit", //L"ListBox", //L"NativeFontCtl", //L"ScrollBar", //L"Static", //L"SysAnimate32", //L"SysDateTimePick32", //L"SysIPAddress32", //L"SysListView32", //L"SysMonthCal32", //L"SysPager", //L"msctls_hotkey32", }; static const wchar_t* theme_names[] = { L"ComboBox", L"Tab", L"TreeView", L"Progress", L"Trackbar", L"Spin", L"Tooltip", //L"Button", //L"Edit", //L"Globals", //L"Header", //L"Menu", //L"Rebar", //L"Scrollbar", //L"Status", //L"Toolbar", //L"Window" }; const std::wstring& class_name = get_window_class(); const wchar_t *theme_name = class_name.c_str(); BOOST_STATIC_ASSERT(sizeof(class_names)==sizeof(theme_names)); const ptrdiff_t names_count = sizeof(class_names)/sizeof(wchar_t*); const wchar_t** i = class_names; while(i != &class_names[names_count] && std::wcscmp(*i, theme_name) != 0) ++i; if(i != &class_names[names_count]) theme_name = theme_names[i - class_names]; theme_m = (*OpenThemeDataPtr)(win, theme_name); return (theme_m != 0); } bool get_font(int widget_type, LOGFONTW& out_font) const { // // We need ensure that we have a handle to the theme before // continuing. // if (!theme_m) return false; if (widget_type != -1) { HDC tmp_dc = GetDC(0); HRESULT hr = (*GetThemeFontPtr)(theme_m, tmp_dc, widget_type, kState, TMT_FONT, &out_font); ReleaseDC(0,tmp_dc); if (hr == S_OK) return true; } // // This widget is a text label, most likely. Give it the // standard message box font. // if (S_OK == (*GetThemeSysFontPtr)(theme_m, TMT_MSGBOXFONT, &out_font)) return true; return false; } // // Previously we had implementations of get_font_metrics and get_text_extents // which used the UXTheme API. We were not getting the values back that we // expected, so we now use the Win32 API for getting those measurements (although // note that we still get the actual widget font with UxTheme). // bool get_integer(int widget_type, int measurement, int& out_val) const { // // We don't fallback from this function. // if ((!theme_m) || (widget_type == -1)) return false; return (S_OK == (*GetThemeIntPtr)(theme_m, widget_type, kState, measurement, &out_val)); } bool get_size(int widget_type, THEMESIZE measurement, SIZE& out_size) const { // // We don't fallback from this function. // if ((!theme_m) || (widget_type == -1)) return false; // // Create a temporary device context and call GetThemePartSize. // HDC tmp_dc = GetDC(0); HRESULT hr = (*GetThemePartSizePtr)(theme_m, tmp_dc, widget_type, kState, 0, measurement, &out_size); ReleaseDC(0, tmp_dc); return (hr == S_OK); } bool get_margins(int widget_type, MARGINS& out_margins) const { // // We don't fall back from this function. // if ((!theme_m) || (widget_type == -1)) return false; // // Use GetThemeMargins call to get the margins for this widget. // return (S_OK == (*GetThemeMarginsPtr)(theme_m, 0, widget_type, kState, TMT_CONTENTMARGINS, 0, &out_margins)); } bool get_button_text_margins(int widget_type, RECT& out_margins) const { // // Fallback if we're not using a theme. // if (!theme_m) return _super::get_button_text_margins(widget_type, out_margins); return hackery::cast<bool>(Button_GetTextMargin(window_m, &out_margins)); } bool using_styles() const { return theme_active(); } void draw_parent_background(HWND window, HDC dc) { if (!loaded_m) return; (*DrawThemeParentBackgroundPtr)(window, dc, 0); } }; /****************************************************************************************************/ metrics_t& metrics_t::get_instance() { static metrics_win32_t win32_instance; static metrics_uxtheme_t uxtheme_instance; if (uxtheme_instance.theme_active()) return uxtheme_instance; return win32_instance; } /****************************************************************************************************/ } /****************************************************************************************************/ --- NEW FILE: event_dispatcher.cpp --- /* Copyright 2005 Ralph Thomas Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ #include "event_dispatcher.hpp" #include "ui_core_implementation.hpp" #include "wincast.hpp" #include <adobe/future/enum_ops.hpp> #include <sstream> /****************************************************************************************************/ adobe::modifiers_t convert_modifiers(ULONG os_modifiers) { adobe::modifiers_t result(adobe::modifiers_none_s); #define ADOBE_MAPMOD(osmod, adobemod) if (os_modifiers == (osmod)) result = result | (adobemod) // // Note that VK_MENU is the ALT key. // ADOBE_MAPMOD(VK_CAPITAL, adobe::modifiers_caps_lock_s); ADOBE_MAPMOD(VK_CONTROL, adobe::modifiers_any_control_s); ADOBE_MAPMOD(VK_SHIFT, adobe::modifiers_any_shift_s); ADOBE_MAPMOD(VK_MENU, adobe::modifiers_any_option_s); #undef ADOBE_MAPMOD return result; } /****************************************************************************************************/ int get_child_id(UINT message, WPARAM wParam, LPARAM lParam) { if (message == WM_CTLCOLORSTATIC) return hackery::cast<int>(GetWindowLong(hackery::cast<HWND>(lParam), GWL_ID)); return LOWORD(wParam); } /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ // /// This is the global single instance of the event_dispatcher, and it's /// reference count. // static event_dispatcher* event_singleton_g = 0; static unsigned int event_refcount_g = 0; /****************************************************************************************************/ event_dispatcher::event_dispatcher() : current_id_m(1000) { } /****************************************************************************************************/ LRESULT event_dispatcher::event(UINT message, WPARAM wParam, LPARAM lParam, bool& handled) { handled = false; // // Let's first ensure that we actually have an event_dispatcher to work // on. // if (!event_refcount_g) return 0; // // The child id is usually the low word of the wParam. // control_map_t& cmap(event_singleton_g->control_map_m); control_map_t::iterator control = cmap.find(get_child_id(message, wParam, lParam)); if (control == cmap.end()) return 0; // // We found something to invoke, so we claim that we handled the message // and return the value of the control's event method. // handled = true; return control->second->event(message, wParam, lParam); } /****************************************************************************************************/ void event_dispatcher::keyboard(UINT message, WPARAM wParam) { // // Verify that this is a keyboard message which could contain // modifiers. // if ((message != WM_KEYDOWN) && (message != WM_KEYUP) && (message != WM_SYSKEYDOWN) && (message != WM_SYSKEYUP)) return; // // Ensure that we have an event_dispatcher to work on. // if (!event_refcount_g) return; // // Look up the modifiers which this event translates to. If they // have changed since the last time then we can tell the controls // about it. // static modifiers_t previous_modifiers(modifiers_none_s); // // This is the modifier which corresponds to the key which was // just pressed or released. // modifiers_t the_modifier(convert_modifiers(hackery::cast<ULONG>(wParam))); modifiers_t current_modifiers(previous_modifiers); // // Now we need to either add or remove the current modifier // from the previous modifiers. // if ((message == WM_KEYDOWN) || (message == WM_SYSKEYDOWN)) current_modifiers |= the_modifier; else current_modifiers &= ~the_modifier; // // Only dispatch to all of the children if the currently // pressed modifiers has changed. // if (previous_modifiers != current_modifiers) { // // Iterate through all of the controls and tell them of // the new modifier state. // control_map_t::iterator first = event_singleton_g->control_map_m.begin(); control_map_t::iterator last = event_singleton_g->control_map_m.end(); while (first != last) { first->second->modify(current_modifiers); first++; } } previous_modifiers = current_modifiers; } /****************************************************************************************************/ event_dispatcher::reference::reference() : child_id_m(-1) { // // If the reference count is zero then we have to allocate a new // event dispatcher. // if (!event_refcount_g) event_singleton_g = new event_dispatcher(); event_refcount_g++; } /****************************************************************************************************/ event_dispatcher::reference::~reference() { // // If we subscribed a control then it will be in the map, we // must remove that mapping so that events don't get sent there // any more. // event_dispatcher::control_map_t::iterator us = event_singleton_g->control_map_m.find(child_id_m); if (us != event_singleton_g->control_map_m.end()) event_singleton_g->control_map_m.erase(us); // // Decrease the reference count and delete the event_dispatcher // if there are no remaining references. // event_refcount_g--; if (!event_refcount_g) { delete event_singleton_g; event_singleton_g = 0; } } /****************************************************************************************************/ HMENU event_dispatcher::reference::subscribe(control_t* control) { // // If we're not given a control then we have nothing to subscribe. // if (!control) return 0; // // Store the child ID we're going to use, so that child_id can return it. // child_id_m = event_singleton_g->current_id_m++; event_singleton_g->control_map_m[child_id_m] = control; return child_id(); } /****************************************************************************************************/ HMENU event_dispatcher::reference::child_id() const { return hackery::cast<HMENU>(child_id_m); } /****************************************************************************************************/ } /****************************************************************************************************/ --- NEW FILE: os_utilities.cpp --- /* Copyright 2005-2006 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ // This file intentionally left blank /****************************************************************************************************/ |
From: Foster B. <fos...@us...> - 2006-02-03 18:20:54
|
Update of /cvsroot/adobe-source/adobe-source/adobe/gil/test/image_test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1031/adobe/gil/test/image_test Added Files: gil_test.vssscc Log Message: asl 1.0.13 --- NEW FILE: gil_test.vssscc --- (This appears to be a binary file; contents omitted.) |
From: Foster B. <fos...@us...> - 2006-02-03 18:20:54
|
Update of /cvsroot/adobe-source/adobe-source/adobe/future/widgets/headers/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1031/adobe/future/widgets/headers/win32 Added Files: event_dispatcher.hpp metrics.hpp ui_core_implementation.hpp wincast.hpp Log Message: asl 1.0.13 --- NEW FILE: event_dispatcher.hpp --- /* Copyright 2005 Ralph Thomas Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ // /// This header defines the event_dispatcher, a class which is used to send events /// to the correct control_t. It works by knowing about all control_t's and the /// child IDs of thier windows. When an event comes in, it finds out which child ID /// generated it and forwards the event to the owning control_t. /// /// It is also able to handle keyboard modifier events, before they get translated /// and dispatched by the message pump. When the currently pressed combination of /// modifiers changes all of the controls are informed, in case they need to change /// their titles. // /****************************************************************************************************/ #ifndef ADOBE_EVENT_DISPATCHER_HPP #define ADOBE_EVENT_DISPATCHER_HPP /****************************************************************************************************/ #include <adobe/config.hpp> #include <map> #include <string> #include <windows.h> /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ struct control_t; /****************************************************************************************************/ // /// The event_dispatcher keeps track of all control_t's and the child ids which /// they use. All control_t objects should contain a event_dispatcher::reference /// inside them. // class event_dispatcher { typedef std::map<int, control_t*> control_map_t; control_map_t control_map_m; ///< Mapping Child ID -> control_t* int current_id_m; ///< Child ID to next issue // /// This private constructor maintains the singleton nature of /// this class. // event_dispatcher(); friend class reference; public: // /// This reference class contains a reference to the event_dispatcher, /// and should be used by controls to subscribe and unsubscribe -- all /// controls should have one of these as a member variable. // class reference { int child_id_m; ///< The child ID for the owning control_t. public: // /// This constructor initializes all values to zero, and acquires a /// reference to the event_dispatcher. // reference(); // /// Unsubscribe any control which subscribed to the event_dispatcher /// and release the reference to the event_dispatcher. // ~reference(); // /// Subscribe the given control_t to the event_dispatcher. The returned /// value should be used as the child Id for the window which the given /// control will create. /// /// \param control the control to subscribe to events. /// \return the child id for the control to use. // HMENU subscribe(control_t* control); // /// Return the child ID. /// /// \return the child id to use for windows belonging to the subscribed /// control, or NULL if no control has subscribed through this /// reference. // HMENU child_id() const; }; // /// Dispatch an event through to the control which needs to process it. /// /// \param message The Windows message type. /// \param wParam The pointer parameter of the message. /// \param lParam the long parameter of the message. /// \param handled this reference bool is set to true if the message /// was dispatched to a child, or to false if no child /// could be found. /// \return the result of the event. // static LRESULT event(UINT message, WPARAM wParam, LPARAM lParam, bool& handled); // /// Examine the given keyboard message and send any required modifier events /// to controls. /// /// \param message The Windows message type. /// \param wParam The WPARAM value from the Windows message. // static void keyboard(UINT message, WPARAM wParam); }; /****************************************************************************************************/ } /****************************************************************************************************/ #endif /****************************************************************************************************/ --- NEW FILE: wincast.hpp --- /* Copyright 2005-2006 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ #ifndef ADOBE_WINCAST_HPP #define ADOBE_WINCAST_HPP #include <adobe/config.hpp> /****************************************************************************************************/ namespace { /****************************************************************************************************/ namespace hackery { /****************************************************************************************************/ template <typename T, typename U> inline T cast(U u) { // REVISIT (fbrereto) : This function circumvents an issue where MSVC won't allow for the casting // of a primitive of smaller type to one of larger type. Please use sparingly, // but when this type of cast must be made use this function so it can be // pulled out easily. #pragma warning ( push ) #pragma warning ( disable : 4311 ) // typecast pointer truncation from type to type #pragma warning ( disable : 4312 ) // typecast conversion from type to type of greater size #pragma warning ( disable : 4800 ) // conversion to true/false performance warning return (T)(u); #pragma warning ( pop ) } /****************************************************************************************************/ } // namespace hackery /****************************************************************************************************/ } // namespace /****************************************************************************************************/ #endif /****************************************************************************************************/ --- NEW FILE: ui_core_implementation.hpp --- /* Copyright 2005-2006 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ #ifndef ADOBE_UI_CORE_IMPLEMENTATION_HPP #define ADOBE_UI_CORE_IMPLEMENTATION_HPP /****************************************************************************************************/ #include <adobe/config.hpp> #include <windows.h> #include <Commctrl.h> #include "ui_core.hpp" #include "event_dispatcher.hpp" #include <adobe/future/memory.hpp> #include <adobe/extents.hpp> #include <adobe/dictionary_fwd.hpp> /****************************************************************************************************/ #define ADOBE_DELETE_PTR_SPECIALIZATION(type, func) \ template <> \ struct adobe::delete_ptr<##type> \ { \ void operator()(##type x) const \ { if (x) func(x); } \ } /****************************************************************************************************/ extern const RECT initial_bounds_g; /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ struct control_t : boost::equality_comparable<control_t> { control_t(); control_t(theme_t theme); control_t(const control_t& rhs); virtual ~control_t(); virtual extents_t best_bounds(); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_name(const std::string& name); virtual void set_theme(theme_t theme); void adorn_theme(theme_t theme); void unadorn_theme(theme_t theme); void set_active(bool make_active); void set_visible(bool make_visible); void set_focused(bool make_focused); bool is_focused(); void signal_focus(const implementation::control_focus_proc_t& proc); void trap_window_proc(WNDPROC new_window_proc); // /// This function is invoked when the parent window of this control recieves a message /// generated by the control's window. /// /// \param message Windows message code. /// \param wParam pointer parameter. /// \param lParam long parameter. // virtual LRESULT event(UINT message, WPARAM wParam, LPARAM lParam); // /// This function is invoked when one of the modifier keys is pressed or released. /// /// \param modifiers the modifier keys currently pressed. // virtual void modify(modifiers_t modifiers); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::control_t); virtual dictionary_t essentials() const; virtual void user_hit(); HWND control_m; WNDPROC default_window_proc_m; theme_t theme_m; implementation::control_focus_proc_t focus_proc_m; extents_t geometry_m; // saving set_bounds param for essentials point_2d_t position_m; // saving set_bounds param for widget framing int uxtheme_type_m; static HWND invisible_parent_m; // an invisible window used as the initial parent for all controls. event_dispatcher::reference event_dispatcher_m; // ref. to singleton event dispatcher. HMENU child_id_m; // this control_m's child id. }; /****************************************************************************************************/ struct window_t::implementation_t : boost::equality_comparable<window_t::implementation_t> { implementation_t(); implementation_t(const implementation_t& rhs); virtual ~implementation_t(); void initialize( const std::string& name, const RECT& bounds, window_style_t style, window_attributes_t attributes, window_modality_t modality); void initialize( const std::string& name, const RECT& bounds, DWORD style); extents_t measure(); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_size(const point_2d_t& size); void reposition(window_reposition_t position); void set_visible(bool make_visible); void draw_controls(); void signal_resize_complete(const implementation::window_resize_complete_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::window_t::implementation_t); dictionary_t essentials() const; HWND window_m; extents_t geometry_m; // saving set_bounds param for essentials point_2d_t position_m; implementation::window_resize_complete_proc_t resize_complete_proc_m; bool debounce_m; std::pair<long, long> min_size_m; }; /****************************************************************************************************/ struct number_formatter_t::implementation_t { implementation_t(); implementation_t(const implementation_t& rhs); void initialize(); void set_format(const std::string& format); std::string get_format() const; std::string format(const value_t& x); value_t parse(const std::string& str, value_t the_type); std::string format_m; }; /****************************************************************************************************/ struct group_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT& bounds, const std::string& name); virtual extents_t best_bounds(); virtual void set_theme(theme_t theme); virtual LRESULT event(UINT message, WPARAM wParam, LPARAM lParam); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::group_t::implementation_t); virtual dictionary_t essentials() const; }; /****************************************************************************************************/ struct tab_group_t::implementation_t : control_t { typedef control_t _super; typedef std::vector<tab_group_t::tab_t> tab_set_t; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT& bounds, const tab_group_t::tab_t* first, const tab_group_t::tab_t* last); virtual void set_theme(theme_t theme); virtual extents_t best_bounds(); void set_value(const value_t& new_value); void signal_value_change(const implementation::tab_group_value_proc_t& proc); virtual LRESULT event(UINT msg, WPARAM wParam, LPARAM lParam); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::tab_group_t::implementation_t); virtual dictionary_t essentials() const; implementation::tab_group_value_proc_t value_proc_m; tab_set_t items_m; }; /****************************************************************************************************/ struct panel_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::panel_t::implementation_t); virtual dictionary_t essentials() const; void initialize(const RECT& bounds); }; /****************************************************************************************************/ struct button_t::implementation_t : control_t { typedef control_t _super; typedef std::vector<state_descriptor_t> state_set_t; implementation_t(); implementation_t(const implementation_t& rhs); ~implementation_t(); void initialize( const RECT& bounds, const button_t::state_descriptor_t* first, const button_t::state_descriptor_t* last); void set_default(bool is_default); void set_cancel(bool is_cancel); void set_value(modifiers_t modifiers, const value_t& value); void set_contributing(modifiers_t modifiers, const std::pair<dictionary_t, array_t>& value); virtual void modify(modifiers_t modifiers); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::button_t::implementation_t); virtual dictionary_t essentials() const; virtual void user_hit(); state_set_t state_set_m; modifiers_t modifiers_m; //EventHandlerRef handler_ref_m; }; /****************************************************************************************************/ struct radio_button_t::implementation_t : control_t { typedef control_t _super; implementation_t( const std::string& name, const adobe::value_t& set_value, theme_t theme); implementation_t(const implementation_t& rhs); void initialize(const RECT& bounds, const std::string& name); virtual extents_t measure(); void place(const point_2d_t& position, const extents_t& extents); void enable(bool make_enabled); void set(const adobe::value_t& value); void monitor(const implementation::checkbox_hit_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::radio_button_t::implementation_t); virtual dictionary_t essentials() const; virtual void user_hit(); implementation::radio_button_hit_proc_t hit_proc_m; adobe::value_t last_m; adobe::value_t set_value_m; }; /****************************************************************************************************/ struct checkbox_t::implementation_t : control_t { typedef control_t _super; implementation_t( const std::string& name, const adobe::value_t& true_value, const adobe::value_t& false_value, theme_t theme); implementation_t(const implementation_t& rhs); void initialize(const RECT& bounds, const std::string& name); virtual extents_t measure(); void place(const point_2d_t& position, const extents_t& extents); void enable(bool make_enabled); void set(const adobe::value_t& value); void monitor(const implementation::checkbox_hit_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::checkbox_t::implementation_t); virtual dictionary_t essentials() const; virtual void user_hit(); implementation::checkbox_hit_proc_t hit_proc_m; adobe::value_t true_value_m; adobe::value_t false_value_m; adobe::value_t current_value_m; }; /****************************************************************************************************/ struct link_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize(const RECT& bounds); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_value(bool value); void set_visible(bool make_visible); void set_active(bool make_active); void signal_hit(const implementation::link_hit_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::link_t::implementation_t); virtual dictionary_t essentials() const; implementation::link_hit_proc_t hit_proc_m; guide_set_t prongs_m; bool value_m; bool visible_m; bool active_m; }; /****************************************************************************************************/ struct progress_bar_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT& bounds, pb_style_t bar_style, bool is_vertical); virtual extents_t best_bounds(); void set_min_value(long min_value); void set_max_value(long max_value); void set_value(long value); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::progress_bar_t::implementation_t); virtual dictionary_t essentials() const; bool is_vertical_m; pb_style_t bar_style_m; }; /****************************************************************************************************/ struct separator_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::separator_t::implementation_t); virtual dictionary_t essentials() const; void initialize(const RECT& bounds); }; /****************************************************************************************************/ struct static_text_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize(const RECT& bounds, const std::string& name); long best_height_given_width(long width); void set_name(const std::string& name); void signal_hit(const implementation::static_text_hit_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::static_text_t::implementation_t); virtual dictionary_t essentials() const; implementation::static_text_hit_proc_t hit_proc_m; }; /****************************************************************************************************/ struct edit_text_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); virtual ~implementation_t(); void initialize( const RECT& bounds, const std::string& name, bool scrollable, bool password, long cols, long rows); static_text_t& get_label(); virtual extents_t best_bounds(); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_active(bool active); virtual void set_theme(theme_t theme); void set_name(const std::string& text); void set_field_text(const std::string& text); void set_static_disabled(bool is_static_disabled); void set_selection(long start_char, long end_char); void signal_pre_edit(const implementation::edit_text_pre_edit_proc_t& proc); void signal_post_edit(const implementation::edit_text_post_edit_proc_t& proc); void signal_label_hit(const implementation::edit_text_label_hit_proc_t& proc); // /// Recalculate the style which should be given as the Window style /// of the edit control. /// /// \return the window style which should be applied to control_m. // long get_window_style() const; virtual LRESULT event(UINT msg, WPARAM wParam, LPARAM lParam); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::edit_text_t::implementation_t); virtual dictionary_t essentials() const; static_text_t name_m; std::wstring field_text_m; static_text_t static_disabled_text_m; //HWND scroll_control_m; bool static_disabled_m; bool using_label_m; long rows_m; long cols_m; bool scrollable_m; bool password_m; long edit_baseline_m; long edit_height_m; long static_baseline_m; long static_height_m; implementation::edit_text_pre_edit_proc_t pre_edit_proc_m; implementation::edit_text_post_edit_proc_t post_edit_proc_m; implementation::edit_text_label_hit_proc_t label_hit_proc_m; }; /****************************************************************************************************/ struct popup_t::implementation_t : control_t { typedef control_t _super; typedef std::pair<std::string, value_t> menu_item_t; typedef std::vector<menu_item_t> menu_items_t; implementation_t(); implementation_t(const implementation_t& rhs); void initialize(const RECT& bounds, const std::string& name); static_text_t& get_label(); virtual extents_t best_bounds(); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_active(bool active); virtual void set_theme(theme_t theme); void set_name(const std::string& name); void set_static_disabled(bool is_static_disabled); void add_menu_item(const std::string& name, const value_t& value); void clear_menu_items(); void set_current_menu_item(const value_t& item); void select_with_text(const std::string& text); void signal_value_change(const implementation::popup_value_proc_t& proc); virtual LRESULT event(UINT message, WPARAM wParam, LPARAM lParam); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::popup_t::implementation_t); virtual dictionary_t essentials() const; static_text_t name_m; static_text_t static_disabled_text_m; bool static_disabled_m; long static_baseline_m; long static_height_m; long popup_baseline_m; long popup_height_m; bool using_label_m; implementation::popup_value_proc_t value_proc_m; menu_items_t menu_items_m; }; /****************************************************************************************************/ struct unit_edit_text_t::implementation_t : edit_text_t::implementation_t { typedef edit_text_t::implementation_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT& bounds, const std::string& name, bool using_popup, long cols, long rows); popup_t& get_popup(); virtual extents_t best_bounds(); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_active(bool active); virtual void set_theme(theme_t theme); void set_static_disabled(bool is_static_disabled); void add_popup_menu_item(const std::string& name, const adobe::value_t& value); void select_popup_with_text(const std::string& text); void signal_popup_value_change(implementation::popup_value_proc_t proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::unit_edit_text_t::implementation_t); virtual dictionary_t essentials() const; popup_t popup_m; bool using_popup_m; long popup_height_m; long popup_baseline_m; long edit_height_m; long edit_baseline_m; }; /****************************************************************************************************/ struct slider_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT* bounds, bool is_vertical, slider_style_t style, long num_tick_marks); virtual extents_t best_bounds(); void set_min_value(long min_value); void set_max_value(long max_value); void set_value(long value); void signal_value_change(const implementation::slider_value_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::slider_t::implementation_t); virtual dictionary_t essentials() const; implementation::slider_value_proc_t value_proc_m; bool is_vertical_m; slider_style_t style_m; long num_tick_marks_m; }; /****************************************************************************************************/ ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::window_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::control_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::group_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::tab_group_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::button_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::panel_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::radio_button_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::checkbox_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::link_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::progress_bar_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::separator_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::static_text_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::edit_text_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::popup_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::unit_edit_text_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::slider_t::implementation_t); /****************************************************************************************************/ } // namespace adobe /****************************************************************************************************/ #endif /****************************************************************************************************/ --- NEW FILE: metrics.hpp --- /* Copyright 2005 Ralph Thomas Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ // // This header defines a class which can return various widget metrics // on Windows systems. When available the UXTHEME library is used to // discover metrics. When UXTHEME is not available some reasonable // defaults (precalculated on a system with UXTHEME) are returned. // /****************************************************************************************************/ #ifndef ADOBE_METRICS_HPP #define ADOBE_METRICS_HPP /****************************************************************************************************/ #include <adobe/config.hpp> #include <windows.h> #include <uxtheme.h> #include <tmschema.h> #include <string> /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ // /// The metrics_t class is a singleton which can fetch information /// on ideal widget sizes. There are two possible designs here: /// <ol> /// <li>Provide simple metric and text information.</li> /// <li>Provide ideal sizes for specific widgets.</li> /// </ol> /// It has been chosen to take design (1), the calculation of /// individual widget ideal sizes belongs in the ui_core_implementation /// code. This class is a singleton, a reference to it has to be /// obtained using metrics_t::getInstance . /// /// All of the functions which return metrics require the widget type /// and state of the widget. A table of all the part and state names /// is available here: /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/userex/topics/partsandstates.asp // class metrics_t { public: // /// Return a reference to the single instance of metrics_t. /// /// \return a reference to the single instance of metrics_t. // static metrics_t& get_instance(); // /// Get the correct font to use for the given widget. This font must /// be used for the font metrics to be correct. /// /// \param widget_type the type of the widget. /// \param out_font a reference filled with the requested font. /// /// \return true if the font was returned successfully, false if /// the font could not be returned. // virtual bool get_font(int widget_type, LOGFONTW& out_font) const = 0; // /// Get the metrics for the font which should be used in the given widget. /// /// \param widget_type the type of the widget. /// \param out_metrics a reference filled with the text metrics. /// /// \return true if the font metrics were returned successfully, false /// if the metrics could not be returned. // virtual bool get_font_metrics(int widget_type, TEXTMETRIC& out_metrics) const = 0; // /// Get the extents for the given text string, to be contained in the /// specified widget. /// /// \param widget_type the type of the widget. /// \param text the string to return the extents for. /// \param out_extents a reference filled with the text extents. /// /// \return true if the text extents were returned successfully, false /// if the metrics could not be returned. // virtual bool get_text_extents(int widget_type, std::wstring text, RECT& out_extents) const = 0; // /// Get the specified measurement for the given widget when in the /// given state. /// /// \param widget_type the type of the widget. /// \param measurement the required measurement. /// \param out_val a reference filled with the requested value. /// /// \return true if the value was returned successfully, false /// if the value could not be found. // virtual bool get_integer(int widget_type, int measurement, int& out_val) const = 0; // /// Get the size of the specified widget. /// /// \param widget_type the type of the widget. /// \param measurement the size to get: TS_MIN, TS_TRUE, or TS_DRAW. /// \param out_size a reference filled with the requested rectangle. /// /// \return true if the rectangle was returned successfully, false /// if the rectangle could not be found. // virtual bool get_size(int widget_type, THEMESIZE measurement, SIZE& out_size) const = 0; // /// Get the margins for the specified widget. Typically the margins /// describe space which must be added around the text rectangle for /// controls with a caption. /// /// \param widget_type the type of the widget. /// \param out_margins a reference filled with the margins of the widget. /// /// \return true if the margins were returned successfully, false /// if the margins could not be found. // virtual bool get_margins(int widget_type, MARGINS& out_margins) const = 0; // /// Get the text margins for a button widget. This call is specific /// to a button widget, but is only available with Visual Styles on /// Windows XP (hence is grouped in with the other metrics functions /// of similar availability). /// /// \param widget_type the UXTheme type of button /// \param out_margins a rectangle containing the margins /// /// \return true if the margins were returned successfully, false /// if the margins could not be found. // virtual bool get_button_text_margins(int widget_type, RECT& out_margins) const = 0; // /// Return true if visual styles are currently in use, false if they /// are not being used. /// /// \return true if visual styles are in use, false otherwise. // virtual bool using_styles() const = 0; // /// Use the current style to draw the background of the parent control /// of the given window using the given DC. This function is useful for /// drawing the background of controls which appear on top of tab controls, /// or other places where the color isn't regulation. /// /// \param window the window to draw the parent background of. /// \param dc the DC to draw with. This DC does not have to be /// drawing onto the given window. // virtual void draw_parent_background(HWND window, HDC dc) = 0; // /// Before any of the other functions can be called, the theme data must be /// loaded from the window. This function should also be called any time the /// window recieves a WM_THEMECHANGED message. /// /// \param window the window to get the theme from. Note that it is not /// important which window is used, it does not have to /// be the same window every time. /// /// \return true if the theme was obtained from the window, false if the /// theme could not be obtained from the window. // virtual bool set_window(HWND window) = 0; virtual ~metrics_t() { } }; /****************************************************************************************************/ } // namespace adobe /****************************************************************************************************/ #endif |
From: Foster B. <fos...@us...> - 2006-02-03 18:20:53
|
Update of /cvsroot/adobe-source/adobe-source/adobe/future/widgets/sources/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1031/adobe/future/widgets/sources/win Removed Files: display.cpp event_dispatcher.cpp metrics.cpp ui_core_implementation.cpp ui_overlay.cpp Log Message: asl 1.0.13 --- display.cpp DELETED --- --- metrics.cpp DELETED --- --- ui_overlay.cpp DELETED --- --- event_dispatcher.cpp DELETED --- --- ui_core_implementation.cpp DELETED --- |
From: Foster B. <fos...@us...> - 2006-02-03 18:20:53
|
Update of /cvsroot/adobe-source/adobe-source/adobe/future/widgets/headers/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1031/adobe/future/widgets/headers/win Removed Files: event_dispatcher.hpp metrics.hpp ui_core_implementation.hpp wincast.hpp Log Message: asl 1.0.13 --- event_dispatcher.hpp DELETED --- --- wincast.hpp DELETED --- --- ui_core_implementation.hpp DELETED --- --- metrics.hpp DELETED --- |
From: Foster B. <fos...@us...> - 2006-02-03 18:20:52
|
Update of /cvsroot/adobe-source/adobe-source/adobe/documentation/sources/doxygen_support_files/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1031/adobe/documentation/sources/doxygen_support_files/images Removed Files: stlab.jpg Log Message: asl 1.0.13 --- stlab.jpg DELETED --- |
From: Foster B. <fos...@us...> - 2006-02-03 18:20:52
|
Update of /cvsroot/adobe-source/adobe-source/adobe/documentation/sources/doxygen_support_files/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1031/adobe/documentation/sources/doxygen_support_files/include Added Files: gil_design_guide.pdf gil_tutorial.pdf Log Message: asl 1.0.13 --- NEW FILE: gil_tutorial.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: gil_design_guide.pdf --- (This appears to be a binary file; contents omitted.) |
From: Foster B. <fos...@us...> - 2006-02-03 18:17:34
|
Update of /cvsroot/adobe-source/adobe-source/adobe/test/modal_dialog_interface/resources/modal_dialog_interface.nib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32326/adobe/test/modal_dialog_interface/resources/modal_dialog_interface.nib Log Message: Directory /cvsroot/adobe-source/adobe-source/adobe/test/modal_dialog_interface/resources/modal_dialog_interface.nib added to the repository |
From: Foster B. <fos...@us...> - 2006-02-03 18:16:52
|
Update of /cvsroot/adobe-source/adobe-source/adobe/test/modal_dialog_interface/resources In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32046/adobe/test/modal_dialog_interface/resources Log Message: Directory /cvsroot/adobe-source/adobe-source/adobe/test/modal_dialog_interface/resources added to the repository |
From: Foster B. <fos...@us...> - 2006-02-03 18:16:52
|
Update of /cvsroot/adobe-source/adobe-source/adobe/gil/test/image_test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32046/adobe/gil/test/image_test Log Message: Directory /cvsroot/adobe-source/adobe-source/adobe/gil/test/image_test added to the repository |
From: Foster B. <fos...@us...> - 2006-02-03 18:14:11
|
Update of /cvsroot/adobe-source/adobe-source/adobe/test/begin/sources/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30781/adobe/test/begin/sources/win32 Log Message: Directory /cvsroot/adobe-source/adobe-source/adobe/test/begin/sources/win32 added to the repository |
From: Foster B. <fos...@us...> - 2006-02-03 18:13:48
|
Update of /cvsroot/adobe-source/adobe-source/adobe/future/widgets/sources/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30593/adobe/future/widgets/sources/win32 Log Message: Directory /cvsroot/adobe-source/adobe-source/adobe/future/widgets/sources/win32 added to the repository |
From: Foster B. <fos...@us...> - 2006-02-03 18:13:47
|
Update of /cvsroot/adobe-source/adobe-source/adobe/test/modal_dialog_interface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30593/adobe/test/modal_dialog_interface Log Message: Directory /cvsroot/adobe-source/adobe-source/adobe/test/modal_dialog_interface added to the repository |
From: Foster B. <fos...@us...> - 2006-02-03 18:13:47
|
Update of /cvsroot/adobe-source/adobe-source/adobe/gil/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30593/adobe/gil/test Log Message: Directory /cvsroot/adobe-source/adobe-source/adobe/gil/test added to the repository |
From: Foster B. <fos...@us...> - 2006-02-03 18:13:47
|
Update of /cvsroot/adobe-source/adobe-source/adobe/test/cmath In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30593/adobe/test/cmath Log Message: Directory /cvsroot/adobe-source/adobe-source/adobe/test/cmath added to the repository |
From: Foster B. <fos...@us...> - 2006-02-03 18:13:32
|
Update of /cvsroot/adobe-source/adobe-source/adobe/future/widgets/headers/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30499/adobe/future/widgets/headers/win32 Log Message: Directory /cvsroot/adobe-source/adobe-source/adobe/future/widgets/headers/win32 added to the repository |
From: Foster B. <fos...@us...> - 2006-02-03 18:13:32
|
Update of /cvsroot/adobe-source/adobe-source/adobe/documentation/sources/doxygen_support_files/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30499/adobe/documentation/sources/doxygen_support_files/include Log Message: Directory /cvsroot/adobe-source/adobe-source/adobe/documentation/sources/doxygen_support_files/include added to the repository |
From: Ralph T. <ra...@us...> - 2006-02-02 09:10:44
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/sources/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11381/adobe-source/adobe/future/widgets/sources/win32 Modified Files: event_dispatcher.cpp ui_core_implementation.cpp Log Message: This commit partially addresses the Win32 nested group issue. There is more information on the fix in the comments of ui_core_implementation.cpp. Inner groups labels are struck through by the group line; there may be another message that we can catch to fix this... dialogs now look better, but still not perfect :(. Index: event_dispatcher.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/sources/win32/event_dispatcher.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** event_dispatcher.cpp 24 Jan 2006 19:38:49 -0000 1.1 --- event_dispatcher.cpp 2 Feb 2006 09:10:30 -0000 1.2 *************** *** 37,40 **** --- 37,49 ---- /****************************************************************************************************/ + int get_child_id(UINT message, WPARAM wParam, LPARAM lParam) + { + if (message == WM_CTLCOLORSTATIC) + return hackery::cast<int>(GetWindowLong(hackery::cast<HWND>(lParam), GWL_ID)); + return LOWORD(wParam); + } + + /****************************************************************************************************/ + namespace adobe { *************** *** 67,71 **** // control_map_t& cmap(event_singleton_g->control_map_m); ! control_map_t::iterator control = cmap.find(LOWORD(wParam)); if (control == cmap.end()) return 0; // --- 76,80 ---- // control_map_t& cmap(event_singleton_g->control_map_m); ! control_map_t::iterator control = cmap.find(get_child_id(message, wParam, lParam)); if (control == cmap.end()) return 0; // Index: ui_core_implementation.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/sources/win32/ui_core_implementation.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ui_core_implementation.cpp 24 Jan 2006 19:38:49 -0000 1.1 --- ui_core_implementation.cpp 2 Feb 2006 09:10:30 -0000 1.2 *************** *** 795,799 **** // that this event is suitable for controls. // ! if ((message == WM_COMMAND) || (message == WM_NOTIFY)) return event_dispatcher::event(message, wParam, lParam, handled); return 0; --- 795,799 ---- // that this event is suitable for controls. // ! if (message == WM_COMMAND || message == WM_NOTIFY || message == WM_CTLCOLORSTATIC) return event_dispatcher::event(message, wParam, lParam, handled); return 0; *************** *** 1668,1672 **** { if ((message == WM_COMMAND) && (HIWORD(wParam) == BN_CLICKED)) user_hit(); ! return 0; } --- 1668,1672 ---- { if ((message == WM_COMMAND) && (HIWORD(wParam) == BN_CLICKED)) user_hit(); ! return DefWindowProc(control_m, message, wParam, lParam); } *************** *** 1776,1779 **** --- 1776,1810 ---- /****************************************************************************************************/ + void group_t::implementation_t::set_theme(theme_t theme) + { + theme_m = theme; + } + + /****************************************************************************************************/ + + LRESULT group_t::implementation_t::event(UINT message, WPARAM wParam, LPARAM lParam) + { + // + // Why does group_t have an empty set_theme and a funny event handler? + // There seems to be a bug in Win32 with visual styles enabled where a + // group box nested inside another group box has the wrong font if it + // has ever been sent a WM_SETFONT message; at least, if it has been + // sent a WM_SETFONT then it ignores the font selected into the DC in + // the WM_CTLCOLORSTATIC handler. + // + // So: we don't send a WM_SETFONT by not implementing a proper set_theme. + // We implement a WM_CTLCOLORSTATIC that selects a suitable font into the + // group's HDC. + // + // Note that we probably *should* get the font using the metrics interface + // rather than using the DEFAULT_GUI_FONT (as control_t::set_theme does). + // + if (message == WM_CTLCOLORSTATIC) + SelectObject((HDC)wParam, GetStockObject(DEFAULT_GUI_FONT)); + return _super::event(message, wParam, lParam); + } + + /****************************************************************************************************/ + dictionary_t group_t::implementation_t::essentials() const { |
From: Ralph T. <ra...@us...> - 2006-02-02 09:10:43
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/headers/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11381/adobe-source/adobe/future/widgets/headers/win32 Modified Files: ui_core_implementation.hpp Log Message: This commit partially addresses the Win32 nested group issue. There is more information on the fix in the comments of ui_core_implementation.cpp. Inner groups labels are struck through by the group line; there may be another message that we can catch to fix this... dialogs now look better, but still not perfect :(. Index: ui_core_implementation.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/headers/win32/ui_core_implementation.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ui_core_implementation.hpp 24 Jan 2006 19:38:47 -0000 1.1 --- ui_core_implementation.hpp 2 Feb 2006 09:10:30 -0000 1.2 *************** *** 165,168 **** --- 165,170 ---- const std::string& name); virtual extents_t best_bounds(); + virtual void set_theme(theme_t theme); + virtual LRESULT event(UINT message, WPARAM wParam, LPARAM lParam); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::group_t::implementation_t); |
From: Ralph T. <ra...@us...> - 2006-02-02 03:25:18
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/begin/examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18908/adobe-source/adobe/test/begin/examples Added Files: nested_group.adm nested_group.eve Log Message: These files exhibit a bug Mat and Foster described regarding groups within groups on Windows. The label of the inner groups has the wrong font and appears in the wrong place. This only occurs with visual styles enabled. --- NEW FILE: nested_group.eve --- /* Copyright 2006 Ralph Thomas Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ dialog(name: "nested group test", placement: place_column) { group(name: "group a") { button(name: "button one"); group(name: "group b") { button(name: "button two"); group(name: "group c") { button(name: "button three"); edit_text(name: "text", characters: 10); } } } button(name: "Dismiss", action: @cancel, horizontal: align_right); } --- NEW FILE: nested_group.adm --- /* Copyright 2006 Ralph Thomas Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ sheet pretend { interface: foo : "" ; } |
From: Foster B. <fos...@us...> - 2006-01-24 19:39:45
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/headers/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12473/adobe-source/adobe/future/widgets/headers/win32 Added Files: event_dispatcher.hpp metrics.hpp ui_core_implementation.hpp wincast.hpp Log Message: moved win/ directories to win32/ to anticipate a possible widgets port for WPF; added a 'mini-sheet' to Eve so you can save UI state information (what tab is currently selected) without mucking up your Adam model; started the modal_dialog_interface, an API that'll be used to direct a modal dialog interaction between the user and the application (it's still in its infancy); other misc bug fixes --- NEW FILE: event_dispatcher.hpp --- /* Copyright 2005 Ralph Thomas Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ // /// This header defines the event_dispatcher, a class which is used to send events /// to the correct control_t. It works by knowing about all control_t's and the /// child IDs of thier windows. When an event comes in, it finds out which child ID /// generated it and forwards the event to the owning control_t. /// /// It is also able to handle keyboard modifier events, before they get translated /// and dispatched by the message pump. When the currently pressed combination of /// modifiers changes all of the controls are informed, in case they need to change /// their titles. // /****************************************************************************************************/ #ifndef ADOBE_EVENT_DISPATCHER_HPP #define ADOBE_EVENT_DISPATCHER_HPP /****************************************************************************************************/ #include <adobe/config.hpp> #include <map> #include <string> #include <windows.h> /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ struct control_t; /****************************************************************************************************/ // /// The event_dispatcher keeps track of all control_t's and the child ids which /// they use. All control_t objects should contain a event_dispatcher::reference /// inside them. // class event_dispatcher { typedef std::map<int, control_t*> control_map_t; control_map_t control_map_m; ///< Mapping Child ID -> control_t* int current_id_m; ///< Child ID to next issue // /// This private constructor maintains the singleton nature of /// this class. // event_dispatcher(); friend class reference; public: // /// This reference class contains a reference to the event_dispatcher, /// and should be used by controls to subscribe and unsubscribe -- all /// controls should have one of these as a member variable. // class reference { int child_id_m; ///< The child ID for the owning control_t. public: // /// This constructor initializes all values to zero, and acquires a /// reference to the event_dispatcher. // reference(); // /// Unsubscribe any control which subscribed to the event_dispatcher /// and release the reference to the event_dispatcher. // ~reference(); // /// Subscribe the given control_t to the event_dispatcher. The returned /// value should be used as the child Id for the window which the given /// control will create. /// /// \param control the control to subscribe to events. /// \return the child id for the control to use. // HMENU subscribe(control_t* control); // /// Return the child ID. /// /// \return the child id to use for windows belonging to the subscribed /// control, or NULL if no control has subscribed through this /// reference. // HMENU child_id() const; }; // /// Dispatch an event through to the control which needs to process it. /// /// \param message The Windows message type. /// \param wParam The pointer parameter of the message. /// \param lParam the long parameter of the message. /// \param handled this reference bool is set to true if the message /// was dispatched to a child, or to false if no child /// could be found. /// \return the result of the event. // static LRESULT event(UINT message, WPARAM wParam, LPARAM lParam, bool& handled); // /// Examine the given keyboard message and send any required modifier events /// to controls. /// /// \param message The Windows message type. /// \param wParam The WPARAM value from the Windows message. // static void keyboard(UINT message, WPARAM wParam); }; /****************************************************************************************************/ } /****************************************************************************************************/ #endif /****************************************************************************************************/ --- NEW FILE: wincast.hpp --- /* Copyright 2005-2006 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ #ifndef ADOBE_WINCAST_HPP #define ADOBE_WINCAST_HPP #include <adobe/config.hpp> /****************************************************************************************************/ namespace { /****************************************************************************************************/ namespace hackery { /****************************************************************************************************/ template <typename T, typename U> inline T cast(U u) { // REVISIT (fbrereto) : This function circumvents an issue where MSVC won't allow for the casting // of a primitive of smaller type to one of larger type. Please use sparingly, // but when this type of cast must be made use this function so it can be // pulled out easily. #pragma warning ( push ) #pragma warning ( disable : 4311 ) // typecast pointer truncation from type to type #pragma warning ( disable : 4312 ) // typecast conversion from type to type of greater size #pragma warning ( disable : 4800 ) // conversion to true/false performance warning return (T)(u); #pragma warning ( pop ) } /****************************************************************************************************/ } // namespace hackery /****************************************************************************************************/ } // namespace /****************************************************************************************************/ #endif /****************************************************************************************************/ --- NEW FILE: ui_core_implementation.hpp --- /* Copyright 2005-2006 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ #ifndef ADOBE_UI_CORE_IMPLEMENTATION_HPP #define ADOBE_UI_CORE_IMPLEMENTATION_HPP /****************************************************************************************************/ #include <adobe/config.hpp> #include <windows.h> #include <Commctrl.h> #include "ui_core.hpp" #include "event_dispatcher.hpp" #include <adobe/future/memory.hpp> #include <adobe/extents.hpp> #include <adobe/dictionary_fwd.hpp> /****************************************************************************************************/ #define ADOBE_DELETE_PTR_SPECIALIZATION(type, func) \ template <> \ struct adobe::delete_ptr<##type> \ { \ void operator()(##type x) const \ { if (x) func(x); } \ } /****************************************************************************************************/ extern const RECT initial_bounds_g; /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ struct control_t : boost::equality_comparable<control_t> { control_t(); control_t(theme_t theme); control_t(const control_t& rhs); virtual ~control_t(); virtual extents_t best_bounds(); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_name(const std::string& name); virtual void set_theme(theme_t theme); void adorn_theme(theme_t theme); void unadorn_theme(theme_t theme); void set_active(bool make_active); void set_visible(bool make_visible); void set_focused(bool make_focused); bool is_focused(); void signal_focus(const implementation::control_focus_proc_t& proc); void trap_window_proc(WNDPROC new_window_proc); // /// This function is invoked when the parent window of this control recieves a message /// generated by the control's window. /// /// \param message Windows message code. /// \param wParam pointer parameter. /// \param lParam long parameter. // virtual LRESULT event(UINT message, WPARAM wParam, LPARAM lParam); // /// This function is invoked when one of the modifier keys is pressed or released. /// /// \param modifiers the modifier keys currently pressed. // virtual void modify(modifiers_t modifiers); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::control_t); virtual dictionary_t essentials() const; virtual void user_hit(); HWND control_m; WNDPROC default_window_proc_m; theme_t theme_m; implementation::control_focus_proc_t focus_proc_m; extents_t geometry_m; // saving set_bounds param for essentials point_2d_t position_m; // saving set_bounds param for widget framing int uxtheme_type_m; static HWND invisible_parent_m; // an invisible window used as the initial parent for all controls. event_dispatcher::reference event_dispatcher_m; // ref. to singleton event dispatcher. HMENU child_id_m; // this control_m's child id. }; /****************************************************************************************************/ struct window_t::implementation_t : boost::equality_comparable<window_t::implementation_t> { implementation_t(); implementation_t(const implementation_t& rhs); virtual ~implementation_t(); void initialize( const std::string& name, const RECT& bounds, window_style_t style, window_attributes_t attributes, window_modality_t modality); void initialize( const std::string& name, const RECT& bounds, DWORD style); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_size(const point_2d_t& size); void reposition(window_reposition_t position); void set_visible(bool make_visible); void draw_controls(); void signal_resize_complete(const implementation::window_resize_complete_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::window_t::implementation_t); dictionary_t essentials() const; HWND window_m; extents_t geometry_m; // saving set_bounds param for essentials point_2d_t position_m; implementation::window_resize_complete_proc_t resize_complete_proc_m; bool debounce_m; std::pair<long, long> min_size_m; }; /****************************************************************************************************/ struct number_formatter_t::implementation_t { implementation_t(); implementation_t(const implementation_t& rhs); void initialize(); void set_format(const std::string& format); std::string get_format() const; std::string format(const value_t& x); value_t parse(const std::string& str, value_t the_type); std::string format_m; }; /****************************************************************************************************/ struct group_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT& bounds, const std::string& name); virtual extents_t best_bounds(); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::group_t::implementation_t); virtual dictionary_t essentials() const; }; /****************************************************************************************************/ struct tab_group_t::implementation_t : control_t { typedef control_t _super; typedef std::vector<tab_group_t::tab_t> tab_set_t; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT& bounds, const tab_group_t::tab_t* first, const tab_group_t::tab_t* last); virtual void set_theme(theme_t theme); virtual extents_t best_bounds(); void set_value(const value_t& new_value); void signal_value_change(const implementation::tab_group_value_proc_t& proc); virtual LRESULT event(UINT msg, WPARAM wParam, LPARAM lParam); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::tab_group_t::implementation_t); virtual dictionary_t essentials() const; implementation::tab_group_value_proc_t value_proc_m; tab_set_t items_m; }; /****************************************************************************************************/ struct panel_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::panel_t::implementation_t); virtual dictionary_t essentials() const; void initialize(const RECT& bounds); }; /****************************************************************************************************/ struct button_t::implementation_t : control_t { typedef control_t _super; typedef std::vector<state_descriptor_t> state_set_t; implementation_t(); implementation_t(const implementation_t& rhs); ~implementation_t(); void initialize( const RECT& bounds, const button_t::state_descriptor_t* first, const button_t::state_descriptor_t* last); void set_default(bool is_default); void set_cancel(bool is_cancel); void set_value(modifiers_t modifiers, const value_t& value); void set_contributing(modifiers_t modifiers, const std::pair<dictionary_t, array_t>& value); virtual void modify(modifiers_t modifiers); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::button_t::implementation_t); virtual dictionary_t essentials() const; virtual void user_hit(); state_set_t state_set_m; modifiers_t modifiers_m; //EventHandlerRef handler_ref_m; }; /****************************************************************************************************/ struct radio_button_t::implementation_t : control_t { typedef control_t _super; implementation_t( const std::string& name, const adobe::value_t& set_value, theme_t theme); implementation_t(const implementation_t& rhs); void initialize(const RECT& bounds, const std::string& name); virtual extents_t measure(); void place(const point_2d_t& position, const extents_t& extents); void enable(bool make_enabled); void set(const adobe::value_t& value); void monitor(const implementation::checkbox_hit_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::radio_button_t::implementation_t); virtual dictionary_t essentials() const; virtual void user_hit(); implementation::radio_button_hit_proc_t hit_proc_m; adobe::value_t last_m; adobe::value_t set_value_m; }; /****************************************************************************************************/ struct checkbox_t::implementation_t : control_t { typedef control_t _super; implementation_t( const std::string& name, const adobe::value_t& true_value, const adobe::value_t& false_value, theme_t theme); implementation_t(const implementation_t& rhs); void initialize(const RECT& bounds, const std::string& name); virtual extents_t measure(); void place(const point_2d_t& position, const extents_t& extents); void enable(bool make_enabled); void set(const adobe::value_t& value); void monitor(const implementation::checkbox_hit_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::checkbox_t::implementation_t); virtual dictionary_t essentials() const; virtual void user_hit(); implementation::checkbox_hit_proc_t hit_proc_m; adobe::value_t true_value_m; adobe::value_t false_value_m; adobe::value_t current_value_m; }; /****************************************************************************************************/ struct link_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize(const RECT& bounds); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_value(bool value); void set_visible(bool make_visible); void set_active(bool make_active); void signal_hit(const implementation::link_hit_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::link_t::implementation_t); virtual dictionary_t essentials() const; implementation::link_hit_proc_t hit_proc_m; guide_set_t prongs_m; bool value_m; bool visible_m; bool active_m; }; /****************************************************************************************************/ struct progress_bar_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT& bounds, pb_style_t bar_style, bool is_vertical); virtual extents_t best_bounds(); void set_min_value(long min_value); void set_max_value(long max_value); void set_value(long value); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::progress_bar_t::implementation_t); virtual dictionary_t essentials() const; bool is_vertical_m; pb_style_t bar_style_m; }; /****************************************************************************************************/ struct separator_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::separator_t::implementation_t); virtual dictionary_t essentials() const; void initialize(const RECT& bounds); }; /****************************************************************************************************/ struct static_text_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize(const RECT& bounds, const std::string& name); long best_height_given_width(long width); void set_name(const std::string& name); void signal_hit(const implementation::static_text_hit_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::static_text_t::implementation_t); virtual dictionary_t essentials() const; implementation::static_text_hit_proc_t hit_proc_m; }; /****************************************************************************************************/ struct edit_text_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); virtual ~implementation_t(); void initialize( const RECT& bounds, const std::string& name, bool scrollable, bool password, long cols, long rows); static_text_t& get_label(); virtual extents_t best_bounds(); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_active(bool active); virtual void set_theme(theme_t theme); void set_name(const std::string& text); void set_field_text(const std::string& text); void set_static_disabled(bool is_static_disabled); void set_selection(long start_char, long end_char); void signal_pre_edit(const implementation::edit_text_pre_edit_proc_t& proc); void signal_post_edit(const implementation::edit_text_post_edit_proc_t& proc); void signal_label_hit(const implementation::edit_text_label_hit_proc_t& proc); // /// Recalculate the style which should be given as the Window style /// of the edit control. /// /// \return the window style which should be applied to control_m. // long get_window_style() const; virtual LRESULT event(UINT msg, WPARAM wParam, LPARAM lParam); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::edit_text_t::implementation_t); virtual dictionary_t essentials() const; static_text_t name_m; std::wstring field_text_m; static_text_t static_disabled_text_m; //HWND scroll_control_m; bool static_disabled_m; bool using_label_m; long rows_m; long cols_m; bool scrollable_m; bool password_m; long edit_baseline_m; long edit_height_m; long static_baseline_m; long static_height_m; implementation::edit_text_pre_edit_proc_t pre_edit_proc_m; implementation::edit_text_post_edit_proc_t post_edit_proc_m; implementation::edit_text_label_hit_proc_t label_hit_proc_m; }; /****************************************************************************************************/ struct popup_t::implementation_t : control_t { typedef control_t _super; typedef std::pair<std::string, value_t> menu_item_t; typedef std::vector<menu_item_t> menu_items_t; implementation_t(); implementation_t(const implementation_t& rhs); void initialize(const RECT& bounds, const std::string& name); static_text_t& get_label(); virtual extents_t best_bounds(); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_active(bool active); virtual void set_theme(theme_t theme); void set_name(const std::string& name); void set_static_disabled(bool is_static_disabled); void add_menu_item(const std::string& name, const value_t& value); void clear_menu_items(); void set_current_menu_item(const value_t& item); void select_with_text(const std::string& text); void signal_value_change(const implementation::popup_value_proc_t& proc); virtual LRESULT event(UINT message, WPARAM wParam, LPARAM lParam); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::popup_t::implementation_t); virtual dictionary_t essentials() const; static_text_t name_m; static_text_t static_disabled_text_m; bool static_disabled_m; long static_baseline_m; long static_height_m; long popup_baseline_m; long popup_height_m; bool using_label_m; implementation::popup_value_proc_t value_proc_m; menu_items_t menu_items_m; }; /****************************************************************************************************/ struct unit_edit_text_t::implementation_t : edit_text_t::implementation_t { typedef edit_text_t::implementation_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT& bounds, const std::string& name, bool using_popup, long cols, long rows); popup_t& get_popup(); virtual extents_t best_bounds(); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_active(bool active); virtual void set_theme(theme_t theme); void set_static_disabled(bool is_static_disabled); void add_popup_menu_item(const std::string& name, const adobe::value_t& value); void select_popup_with_text(const std::string& text); void signal_popup_value_change(implementation::popup_value_proc_t proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::unit_edit_text_t::implementation_t); virtual dictionary_t essentials() const; popup_t popup_m; bool using_popup_m; long popup_height_m; long popup_baseline_m; long edit_height_m; long edit_baseline_m; }; /****************************************************************************************************/ struct slider_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT* bounds, bool is_vertical, slider_style_t style, long num_tick_marks); virtual extents_t best_bounds(); void set_min_value(long min_value); void set_max_value(long max_value); void set_value(long value); void signal_value_change(const implementation::slider_value_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::slider_t::implementation_t); virtual dictionary_t essentials() const; implementation::slider_value_proc_t value_proc_m; bool is_vertical_m; slider_style_t style_m; long num_tick_marks_m; }; /****************************************************************************************************/ struct bevel_button_t::implementation_t : control_t { typedef control_t _super; typedef std::pair<std::string, value_t> menu_item_t; typedef std::vector<menu_item_t> menu_items_t; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT& bounds, const std::string& name, bool offset_contents, bool menu_points_right); void add_menu_item(const std::string& name, const value_t& value); void clear_menu_items(); void set_bevel_amount(bevel_button_bevel_amount_t amount); void set_current_menu_item(const value_t& item); void set_value(bool) { /* stubbed out */ } void signal_hit(const implementation::bevel_button_hit_proc_t& proc); void signal_value_change(const implementation::bevel_button_popup_value_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::bevel_button_t::implementation_t); virtual dictionary_t essentials() const; implementation::bevel_button_hit_proc_t hit_proc_m; implementation::bevel_button_popup_value_proc_t value_proc_m; menu_items_t menu_items_m; bool offset_contents_m; bool menu_points_right_m; }; /****************************************************************************************************/ ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::window_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::control_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::group_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::tab_group_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::button_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::panel_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::radio_button_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::checkbox_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::link_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::progress_bar_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::separator_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::static_text_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::edit_text_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::popup_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::unit_edit_text_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::slider_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::bevel_button_t::implementation_t); /****************************************************************************************************/ } // namespace adobe /****************************************************************************************************/ #endif /****************************************************************************************************/ --- NEW FILE: metrics.hpp --- /* Copyright 2005 Ralph Thomas Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ // // This header defines a class which can return various widget metrics // on Windows systems. When available the UXTHEME library is used to // discover metrics. When UXTHEME is not available some reasonable // defaults (precalculated on a system with UXTHEME) are returned. // /****************************************************************************************************/ #ifndef ADOBE_METRICS_HPP #define ADOBE_METRICS_HPP /****************************************************************************************************/ #include <adobe/config.hpp> #include <windows.h> #include <uxtheme.h> #include <tmschema.h> #include <string> /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ // /// The metrics_t class is a singleton which can fetch information /// on ideal widget sizes. There are two possible designs here: /// <ol> /// <li>Provide simple metric and text information.</li> /// <li>Provide ideal sizes for specific widgets.</li> /// </ol> /// It has been chosen to take design (1), the calculation of /// individual widget ideal sizes belongs in the ui_core_implementation /// code. This class is a singleton, a reference to it has to be /// obtained using metrics_t::getInstance . /// /// All of the functions which return metrics require the widget type /// and state of the widget. A table of all the part and state names /// is available here: /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/userex/topics/partsandstates.asp // class metrics_t { public: // /// Return a reference to the single instance of metrics_t. /// /// \return a reference to the single instance of metrics_t. // static metrics_t& get_instance(); // /// Get the correct font to use for the given widget. This font must /// be used for the font metrics to be correct. /// /// \param widget_type the type of the widget. /// \param out_font a reference filled with the requested font. /// /// \return true if the font was returned successfully, false if /// the font could not be returned. // virtual bool get_font(int widget_type, LOGFONTW& out_font) const = 0; // /// Get the metrics for the font which should be used in the given widget. /// /// \param widget_type the type of the widget. /// \param out_metrics a reference filled with the text metrics. /// /// \return true if the font metrics were returned successfully, false /// if the metrics could not be returned. // virtual bool get_font_metrics(int widget_type, TEXTMETRIC& out_metrics) const = 0; // /// Get the extents for the given text string, to be contained in the /// specified widget. /// /// \param widget_type the type of the widget. /// \param text the string to return the extents for. /// \param out_extents a reference filled with the text extents. /// /// \return true if the text extents were returned successfully, false /// if the metrics could not be returned. // virtual bool get_text_extents(int widget_type, std::wstring text, RECT& out_extents) const = 0; // /// Get the specified measurement for the given widget when in the /// given state. /// /// \param widget_type the type of the widget. /// \param measurement the required measurement. /// \param out_val a reference filled with the requested value. /// /// \return true if the value was returned successfully, false /// if the value could not be found. // virtual bool get_integer(int widget_type, int measurement, int& out_val) const = 0; // /// Get the size of the specified widget. /// /// \param widget_type the type of the widget. /// \param measurement the size to get: TS_MIN, TS_TRUE, or TS_DRAW. /// \param out_size a reference filled with the requested rectangle. /// /// \return true if the rectangle was returned successfully, false /// if the rectangle could not be found. // virtual bool get_size(int widget_type, THEMESIZE measurement, SIZE& out_size) const = 0; // /// Get the margins for the specified widget. Typically the margins /// describe space which must be added around the text rectangle for /// controls with a caption. /// /// \param widget_type the type of the widget. /// \param out_margins a reference filled with the margins of the widget. /// /// \return true if the margins were returned successfully, false /// if the margins could not be found. // virtual bool get_margins(int widget_type, MARGINS& out_margins) const = 0; // /// Get the text margins for a button widget. This call is specific /// to a button widget, but is only available with Visual Styles on /// Windows XP (hence is grouped in with the other metrics functions /// of similar availability). /// /// \param widget_type the UXTheme type of button /// \param out_margins a rectangle containing the margins /// /// \return true if the margins were returned successfully, false /// if the margins could not be found. // virtual bool get_button_text_margins(int widget_type, RECT& out_margins) const = 0; // /// Return true if visual styles are currently in use, false if they /// are not being used. /// /// \return true if visual styles are in use, false otherwise. // virtual bool using_styles() const = 0; // /// Use the current style to draw the background of the parent control /// of the given window using the given DC. This function is useful for /// drawing the background of controls which appear on top of tab controls, /// or other places where the color isn't regulation. /// /// \param window the window to draw the parent background of. /// \param dc the DC to draw with. This DC does not have to be /// drawing onto the given window. // virtual void draw_parent_background(HWND window, HDC dc) = 0; // /// Before any of the other functions can be called, the theme data must be /// loaded from the window. This function should also be called any time the /// window recieves a WM_THEMECHANGED message. /// /// \param window the window to get the theme from. Note that it is not /// important which window is used, it does not have to /// be the same window every time. /// /// \return true if the theme was obtained from the window, false if the /// theme could not be obtained from the window. // virtual bool set_window(HWND window) = 0; virtual ~metrics_t() { } }; /****************************************************************************************************/ } // namespace adobe /****************************************************************************************************/ #endif |