Ejemplo n.º 1
0
void t_list_view::create_tooltip(/*t_size index, t_size column, */const char * str)
{
	destroy_tooltip();

	bool b_comctl_6 = true;

	m_wnd_tooltip = CreateWindowEx(b_comctl_6?WS_EX_TRANSPARENT:0, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP | TTS_NOPREFIX ,		
		CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, get_wnd(), 0, core_api::get_my_instance(), NULL);

	SendMessage(m_wnd_tooltip, WM_SETFONT, (WPARAM)m_font.get(), MAKELPARAM(FALSE,0));

	RECT rect;
	GetClientRect (get_wnd(), &rect);

	uTOOLINFO ti;
	memset(&ti,0,sizeof(ti));

	ti.cbSize = sizeof(uTOOLINFO);
	ti.uFlags = TTF_TRANSPARENT|TTF_SUBCLASS;
	ti.hwnd = get_wnd();
	ti.hinst = core_api::get_my_instance();
	ti.uId = IDC_TOOLTIP;
	ti.lpszText = const_cast<char *>(str);
	ti.rect = rect;

	uToolTip_AddTool(m_wnd_tooltip, &ti);
}
Ejemplo n.º 2
0
BOOL track_bar::create_tooltip(const TCHAR * text, POINT pt)
{
	destroy_tooltip();

	DLLVERSIONINFO2 dvi;
	bool b_comctl_6 = SUCCEEDED(uih::GetComCtl32Version(dvi)) && dvi.info1.dwMajorVersion >= 6;

	m_wnd_tooltip = CreateWindowEx(WS_EX_TOPMOST|(b_comctl_6?WS_EX_TRANSPARENT:0), TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
		CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, get_wnd(), 0, core_api::get_my_instance(), NULL);

	SetWindowPos(m_wnd_tooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);

	TOOLINFO ti;

	memset(&ti,0,sizeof(ti));

	ti.cbSize = TTTOOLINFO_V1_SIZE;
	ti.uFlags = TTF_SUBCLASS|TTF_TRANSPARENT|TTF_TRACK|TTF_ABSOLUTE;
	ti.hwnd = get_wnd();
	ti.hinst = core_api::get_my_instance();
	ti.lpszText = const_cast<TCHAR *>(text);

	win32_helpers::tooltip_add_tool(m_wnd_tooltip, &ti);

	SendMessage(m_wnd_tooltip, TTM_TRACKPOSITION, 0, MAKELONG(pt.x, pt.y+21));
	SendMessage(m_wnd_tooltip, TTM_TRACKACTIVATE, TRUE, (LPARAM)  &ti);	

	return TRUE;
}
Ejemplo n.º 3
0
void threaded_process_v2_t::resize()
{
	t_size height = 11 + 11;
	if (m_flags & flag_show_text)
		height += m_titlefont_height + 7;
	if (1)
		height += 15;
	if (m_flags & flag_show_button)
		height += m_textfont_height + 10 + 11 + 11;//23;
	{
		insync(m_sync);
		if (m_detail_entries.get_count())
			height += m_textfont_height*m_detail_entries.get_count() + 5;
	}
	RECT rc = { 0, 0, 450, height };
	AdjustWindowRectEx(&rc, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE | WS_CAPTION | WS_SYSMENU, false, NULL);
	int cx = progress_width + 11 * 2 + 11 * 2 + RECT_CX(rc) - 450;
	int cy = RECT_CY(rc);
	RECT rc_current = { 0 };
	GetWindowRect(get_wnd(), &rc_current);
	if (RECT_CX(rc_current) != cx || RECT_CY(rc_current) != cy)
	{
		m_window_cx = cx;
		m_window_cy = cy;
		//SendMessage(get_wnd(), WM_CANCELMODE, NULL, NULL);
		SetWindowPos(get_wnd(), NULL, NULL, NULL, cx, cy, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
	}
}
Ejemplo n.º 4
0
void track_bar_impl::draw_background (HDC dc, const RECT * rc) const
{
    HWND wnd_parent = GetParent(get_wnd());
    POINT pt = {0, 0}, pt_old = {0,0};
    MapWindowPoints(get_wnd(), wnd_parent, &pt, 1);
    OffsetWindowOrgEx(dc, pt.x, pt.y, &pt_old);
    if (SendMessage(wnd_parent, WM_ERASEBKGND,(WPARAM)dc, 0) == FALSE)
        SendMessage(wnd_parent, WM_PRINTCLIENT,(WPARAM)dc, PRF_ERASEBKGND);
    SetWindowOrgEx(dc, pt_old.x, pt_old.y, 0);
}
Ejemplo n.º 5
0
void window_visualisation::set_frame_style(unsigned p_type)
{
	m_frame = p_type;
	if (m_wnd)
	{
		long flags = WS_EX_CONTROLPARENT;
		if (m_frame == 1) flags |= WS_EX_CLIENTEDGE;
		if (m_frame == 2) flags |= WS_EX_STATICEDGE;

		SetWindowLongPtr(get_wnd(), GWL_EXSTYLE, flags);
		SetWindowPos(get_wnd(),0,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED);
	}
}
Ejemplo n.º 6
0
void splitter_window_impl::replace_panel(unsigned index, const uie::splitter_item_t *  p_item)
{
	if (index <= m_panels.get_count())
	{
		if (get_wnd())
			m_panels[index]->destroy();
		pfc::refcounted_object_ptr_t<panel> temp;
		temp = new panel;
		temp->set_from_splitter_item(p_item);
		m_panels.replace_item(index, temp);

		if (get_wnd())
			refresh_children();
	}
};
Ejemplo n.º 7
0
int CMidiRouterDlg::select_device(int dev_)
{
	CKXDialog::select_device(dev_);

        // re-instantiate device-dependent GUI elements; redraw then
        device_init("midi");

        // create any custom controls here...
        if(::IsWindow(get_wnd()) && get_wnd())
			SetWindowText(mf.get_profile("lang","automation.name")+" - "+ikx_t->get_device_name());

	BuildPluginsList();

        return 0;
}
Ejemplo n.º 8
0
bool app_viewer::on_key(int key) {
	switch (key) {
	case Qt::Key_Escape:
		get_wnd()->close();
		break;
	case Qt::Key_Space:
		if (!is_polygon_draw_state)
			return on_polygon_drawing_start();
		else
			return on_polygon_drawing_stop();
	case Qt::Key_H:
		if (!is_hole_draw_state)
			return on_hole_drawing_start();
		else
			return on_hole_drawing_stop();
	case Qt::Key_Return:
		return on_triangulate();
		break;
	case Qt::Key_S:
		return save_state();

	case Qt::Key_L:
		return load_state();
	}
	return false;
}
Ejemplo n.º 9
0
unsigned track_bar::calculate_position_from_point(const POINT & pt_client) const
{
    RECT rc_channel, rc_client;
    GetClientRect(get_wnd(), &rc_client);
    get_channel_rect(&rc_channel);
    POINT pt = pt_client;

    if (get_orientation())
    {
        pfc::swap_t(pt.x, pt.y);
        pfc::swap_t(rc_channel.left, rc_channel.top);
        pfc::swap_t(rc_channel.bottom, rc_channel.right);
        pfc::swap_t(rc_client.left, rc_client.top);
        pfc::swap_t(rc_client.bottom, rc_client.right);
    }

    int cx = pt.x;

    if (cx < rc_channel.left)
        cx = rc_channel.left;
    else if (cx > rc_channel.right)
        cx = rc_channel.right;

    return rc_channel.right-rc_channel.left ? MulDiv(m_reversed ? rc_channel.right - cx: cx - rc_channel.left, m_range, rc_channel.right-rc_channel.left) : 0;
}
Ejemplo n.º 10
0
bool selection_properties_t::show_config_popup(HWND wnd_parent)
{
	selection_properties_config_t dialog(m_fields, m_edge_style, m_info_sections_mask, m_show_column_titles, m_show_group_titles);
	if (dialog.run_modal(wnd_parent))
	{
		m_fields = dialog.m_fields;
		if (get_wnd())
		{
			m_info_sections_mask = dialog.m_info_sections_mask;
			cfg_selection_properties_info_sections = dialog.m_info_sections_mask;

			m_show_column_titles = dialog.m_show_columns;
			cfg_selection_poperties_show_column_titles = m_show_column_titles;
			set_show_header(m_show_column_titles);

			if (m_show_group_titles != dialog.m_show_groups)
			{
				m_show_group_titles = dialog.m_show_groups;
				cfg_selection_poperties_show_group_titles = m_show_group_titles;

				remove_items(bit_array_true(), false);
				set_group_count(m_show_group_titles ? 1 : 0);
			}


			refresh_contents();
			m_edge_style = dialog.m_edge_style;
			cfg_selection_properties_edge_style = m_edge_style;
			set_edge_style(m_edge_style);
		}
		return true;
	}
	return false;
}
Ejemplo n.º 11
0
void threaded_process_v2_t::refresh_title_font()
{
	LOGFONT lf;
	memset(&lf, 0, sizeof(LOGFONT));
	m_titlecolour = GetSysColor(COLOR_WINDOWTEXT);

	HTHEME thm_textstyle = IsThemeActive() && IsAppThemed() ? OpenThemeData(get_wnd(), L"TextStyle") : NULL;
	if (thm_textstyle)
	{
		if (SUCCEEDED(GetThemeFont(thm_textstyle, NULL, TEXT_MAININSTRUCTION, 0, TMT_FONT, &lf)))
		{
			m_titlefont = CreateFontIndirect(&lf);
			GetThemeColor(thm_textstyle, TEXT_MAININSTRUCTION, NULL, TMT_TEXTCOLOR, &m_titlecolour);
		}
		CloseThemeData(thm_textstyle);
	}

	if (!m_titlefont.is_valid())
	{
		uGetIconFont(&lf);
		lf.lfWeight = FW_BOLD;
		m_titlefont = CreateFontIndirect(&lf);
	}

	m_titlefont_height = uGetFontHeight(m_titlefont);
}
Ejemplo n.º 12
0
bool app_viewer::load_state() {
	std::string filename = QFileDialog::getOpenFileName(get_wnd(),
			"Load Points").toStdString();
	if (filename == "")
		return false;
	std::ifstream in(filename.c_str());

	int curI = 0;
	while (true) {
		int n;
		in >> n;
		if (in.eof())
			break;
		point_type p;
		if (curI == 0) {
			on_polygon_drawing_start();
		} else {
			on_hole_drawing_start();
		}
		for (int i = 0; i < n; i++) {
			in >> p;
			cur_drawing_pts.push_back(p);
		}
		if (curI == 0) {
			on_polygon_drawing_stop();
		} else {
			on_hole_drawing_stop();
		}
		curI++;
	}
	return true;
}
Ejemplo n.º 13
0
void t_list_view::replace_items(t_size index_start, const pfc::list_base_const_t<t_item_insert> & items, bool b_update_display)
{
	__replace_items_v2(index_start, items);
	__calculate_item_positions(index_start);
	update_scroll_info();
	if (b_update_display)
		RedrawWindow(get_wnd(), NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW);
}
Ejemplo n.º 14
0
void t_list_view::insert_items(t_size index_start, t_size count, const t_item_insert * items, bool b_update_display)
{
	__insert_items_v3(index_start, count, items);
	__calculate_item_positions(index_start);
		//profiler(pvt_render);
	update_scroll_info();
	if (b_update_display)
		RedrawWindow(get_wnd(), NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW);
}
Ejemplo n.º 15
0
void t_list_view::remove_item(t_size index)
{
	if (m_timer_inline_edit)
		exit_inline_edit();
	__remove_item(index);
	__calculate_item_positions();
	update_scroll_info();
	RedrawWindow(get_wnd(), NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW);
}
Ejemplo n.º 16
0
bool splitter_window_impl::is_point_ours(HWND wnd_point, const POINT & pt_screen, pfc::list_base_t<uie::window::ptr> & p_hierarchy)
{
	if (wnd_point == get_wnd() || IsChild(get_wnd(), wnd_point))
	{
		if (wnd_point == get_wnd())
		{
			p_hierarchy.add_item(this);
			return true;
		}
		else
		{
			t_size i, count = m_panels.get_count();
			for (i = 0; i<count; i++)
			{
				uie::splitter_window_v2_ptr sptr;
				if (m_panels[i]->m_child.is_valid())
				{
					if (m_panels[i]->m_child->service_query_t(sptr))
					{
						pfc::list_t<uie::window::ptr> temp;
						temp.add_item(this);
						if (sptr->is_point_ours(wnd_point, pt_screen, temp))
						{
							p_hierarchy.add_items(temp);
							return true;
						}
					}
					else if (wnd_point == m_panels[i]->m_wnd_child || IsChild(m_panels[i]->m_wnd_child, wnd_point))
					{
						p_hierarchy.add_item(this);
						p_hierarchy.add_item(m_panels[i]->m_child);
						return true;
					}
					else if (wnd_point == m_panels[i]->m_wnd)
					{
						p_hierarchy.add_item(this);
						return true;
					}
				}
			}
		}
	}
	return false;
};
Ejemplo n.º 17
0
void splitter_window_impl::remove_panel(unsigned index)
{
	if (index < m_panels.get_count())
	{
		m_panels[index]->destroy();
		m_panels.remove_by_idx(index);

		if (get_wnd())
			refresh_children();
	}
}
Ejemplo n.º 18
0
int kCombo::add_string(LPCTSTR str)
{
 // Windows 7 needs a workaround
 // string might be stored in code segment, or in read-only memory
 // need to make a copy
 // 3551 change

 CString s=str;

 return (int)::SendMessage(get_wnd(), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)s);
}
Ejemplo n.º 19
0
void track_bar_impl::get_channel_rect(RECT * rc) const
{
    RECT rc_client;
    GetClientRect(get_wnd(), &rc_client);
    unsigned cx = calculate_thumb_size();

    rc->left = get_orientation() ? rc_client.right/2-2 : rc_client.left + cx/2;
    rc->right = get_orientation() ? rc_client.right/2+2 : rc_client.right - cx + cx/2;
    rc->top = get_orientation() ? rc_client.top + cx/2 : rc_client.bottom/2-2;
    rc->bottom = get_orientation() ? rc_client.bottom - cx + cx/2 : rc_client.bottom/2+2;
}
Ejemplo n.º 20
0
void selection_properties_t::on_app_activate(bool b_activated)
{
	if (b_activated)
	{
		if (GetFocus() != get_wnd())
			register_callback();
	}
	else
	{
		deregister_callback();
	}
}
Ejemplo n.º 21
0
bool menu_extension::on_menuchar(unsigned short chr)
{
	{
		UINT id;
		if (SendMessage(wnd_menu,TB_MAPACCELERATOR,chr,(LPARAM)&id))
		{
			uPostMessage(get_wnd(),MSG_CREATE_MENU,id,TRUE);
			return true;
		}
	}
	return false;
}
Ejemplo n.º 22
0
	void playlist_switcher_t::notify_on_destroy()
	{
		m_selection_holder.release();

		g_windows.remove_item(this);

		RevokeDragDrop(get_wnd());

		standard_api_create_t<play_callback_manager>()->unregister_callback(this);
		m_playlist_api->unregister_callback(this);
		m_playlist_api.release();
		m_playback_api.release();
	}
Ejemplo n.º 23
0
void track_bar::set_range(unsigned range)
{
    RECT rc;
    get_thumb_rect(&rc);
    HRGN rgn_old = CreateRectRgnIndirect(&rc);
    get_thumb_rect(m_display_position, range, &rc);
    HRGN rgn_new = CreateRectRgnIndirect(&rc);
    CombineRgn(rgn_new, rgn_old, rgn_new, RGN_OR);
    DeleteObject(rgn_old);
    m_range = range;
    RedrawWindow(get_wnd(), 0, rgn_new, RDW_INVALIDATE|RDW_ERASE|RDW_UPDATENOW|RDW_ERASENOW);
    DeleteObject(rgn_new);
}
Ejemplo n.º 24
0
void track_bar::update_hot_status(POINT pt)
{
    RECT rc;
    get_thumb_rect(&rc);
    bool in_rect = PtInRect(&rc, pt) !=0;

    POINT pts = pt;
    MapWindowPoints(get_wnd(), HWND_DESKTOP, &pts, 1);

    bool b_in_wnd = WindowFromPoint(pts) == get_wnd();
    bool b_new_hot = in_rect && b_in_wnd;

    if (m_thumb_hot != b_new_hot)
    {
        m_thumb_hot = b_new_hot;
        if (m_thumb_hot)
            SetCapture(get_wnd());
        else if (GetCapture() == get_wnd() && !m_dragging)
            ReleaseCapture();
        RedrawWindow(get_wnd(), &rc, 0, RDW_INVALIDATE|/*RDW_ERASE|*/RDW_UPDATENOW/*|RDW_ERASENOW*/);
    }
}
Ejemplo n.º 25
0
void track_bar::set_position_internal(unsigned pos)
{
    if (!m_dragging)
    {
        POINT pt;
        GetCursorPos(&pt);
        ScreenToClient(get_wnd(), &pt);
        update_hot_status(pt);
    }

    RECT rc;
    get_thumb_rect(&rc);
    HRGN rgn_old = CreateRectRgnIndirect(&rc);
    get_thumb_rect(pos, m_range, &rc);
    HRGN rgn_new = CreateRectRgnIndirect(&rc);
    CombineRgn(rgn_new, rgn_old, rgn_new, RGN_OR);
    DeleteObject(rgn_old);
    m_display_position = pos;
    //InvalidateRgn(m_wnd, rgn_new, TRUE);
    RedrawWindow(get_wnd(), 0, rgn_new, RDW_INVALIDATE|RDW_ERASE|RDW_UPDATENOW|RDW_ERASENOW);
    DeleteObject(rgn_new);
}
Ejemplo n.º 26
0
void splitter_window_impl::on_size_changed(unsigned width, unsigned height)
{
	pfc::list_t<unsigned> sizes;
	get_panels_sizes(width, height, sizes);
	unsigned count = m_panels.get_count();

	RedrawWindow(get_wnd(), NULL, NULL, RDW_INVALIDATE);

	HDWP dwp = BeginDeferWindowPos(m_panels.get_count());
	if (dwp)
	{
		unsigned size_cumulative = 0, n;
		for (n = 0; n<count; n++)
		{
			if (m_panels[n]->m_child.is_valid() && m_panels[n]->m_wnd)
			{
				unsigned size = sizes[n];

				unsigned x = get_orientation() == horizontal ? size_cumulative : 0;
				unsigned y = get_orientation() == horizontal ? 0 : size_cumulative;
				unsigned cx = get_orientation() == horizontal ? size - get_panel_divider_size(n) : width;
				unsigned cy = get_orientation() == horizontal ? height : size - get_panel_divider_size(n);

				dwp = DeferWindowPos(dwp, m_panels[n]->m_wnd,
					0,
					x,
					y,
					cx,
					cy,
					SWP_NOZORDER);

				size_cumulative += size;
			}
		}
		EndDeferWindowPos(dwp);
	}
	RedrawWindow(get_wnd(), NULL, NULL, RDW_UPDATENOW);
}
Ejemplo n.º 27
0
void splitter_window_impl::insert_panel(unsigned index, const uie::splitter_item_t *  p_item)
{
	if (index <= m_panels.get_count())
	{
		pfc::refcounted_object_ptr_t<panel> temp;
		temp = new panel;
		temp->set_from_splitter_item(p_item);
		m_panels.insert_item(temp, index);

		if (get_wnd())
		{
			refresh_children();
		}
	}
};
Ejemplo n.º 28
0
void t_list_view::remove_items(const bit_array & p_mask, bool b_update_display)
{
	if (m_timer_inline_edit)
		exit_inline_edit();
	t_size i = m_items.get_count();
	for (; i; i--)
	{
		if (p_mask[i-1])
			__remove_item(i-1);
	}
	__calculate_item_positions();
	update_scroll_info();
	if (b_update_display)
		RedrawWindow(get_wnd(), NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW);
}
Ejemplo n.º 29
0
bool track_bar::on_hooked_message(message_hook_manager::t_message_hook_type p_type, int code, WPARAM wp, LPARAM lp)
{
    win32_keyboard_lparam & lpkeyb = get_keyboard_lparam(lp);
    if (wp == VK_ESCAPE && !lpkeyb.transition_code && !lpkeyb.previous_key_state)
    {
        destroy_tooltip();
        if (GetCapture() == get_wnd())
            ReleaseCapture();
        m_dragging = false;
        set_position_internal(m_position);
        message_hook_manager::deregister_hook(message_hook_manager::type_keyboard, this);
        m_hook_registered=false;
        return true;
    }
    return false;
}
Ejemplo n.º 30
0
void threaded_process_v2_t::on_size(t_size cx, t_size cy)
{
	RedrawWindow(get_wnd(), NULL, NULL, RDW_INVALIDATE);
	HDWP dwp = BeginDeferWindowPos(2);
	t_size y_progress = 11;
	if (m_flags & flag_show_text)
		y_progress += 7 + m_titlefont_height;
	{
		insync(m_sync);
		if (m_detail_entries.get_count())
			y_progress += m_textfont_height*m_detail_entries.get_count() + 5;
	}
	dwp = DeferWindowPos(dwp, m_wnd_progress, NULL, 11 * 2, y_progress, cx - 11 * 2 - 11 * 2, 15, SWP_NOZORDER);
	if (m_wnd_button)
		dwp = DeferWindowPos(dwp, m_wnd_button, NULL, cx - 11 * 2 - 73, y_progress + 15 + 11 + 11, 73, m_textfont_height + 10, SWP_NOZORDER);
	EndDeferWindowPos(dwp);
}