winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
May 2011
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
945 discussions
Start a n
N
ew thread
David Hedberg : comdlg32: Take linebreaks into account when resizing custom controls.
by Alexandre Julliard
27 May '11
27 May '11
Module: wine Branch: master Commit: d5a1014ed53ccdce63e99ea5ea9c2637ef72c84a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d5a1014ed53ccdce63e99ea5e…
Author: David Hedberg <david.hedberg(a)gmail.com> Date: Fri May 27 04:05:56 2011 +0200 comdlg32: Take linebreaks into account when resizing custom controls. --- dlls/comdlg32/itemdlg.c | 29 ++++++++++++++++++++++------- 1 files changed, 22 insertions(+), 7 deletions(-) diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c index f8324f9..7e9d0a1 100644 --- a/dlls/comdlg32/itemdlg.c +++ b/dlls/comdlg32/itemdlg.c @@ -591,13 +591,15 @@ static inline customctrl *get_cctrl(FileDialogImpl *This, DWORD ctlid) return NULL; } -static void ctrl_resize(HWND hctrl, UINT min_width, UINT max_width) +static void ctrl_resize(HWND hctrl, UINT min_width, UINT max_width, BOOL multiline) { LPWSTR text; UINT len, final_width; + UINT lines, final_height; SIZE size; RECT rc; HDC hdc; + WCHAR *c; TRACE("\n"); @@ -610,9 +612,22 @@ static void ctrl_resize(HWND hctrl, UINT min_width, UINT max_width) GetTextExtentPoint32W(hdc, text, lstrlenW(text), &size); ReleaseDC(hctrl, hdc); - GetWindowRect(hctrl, &rc); + if(len && multiline) + { + /* FIXME: line-wrap */ + for(lines = 1, c = text; *c != '\0'; c++) + if(*c == '\n') lines++; + + final_height = size.cy*lines + 2*4; + } + else + { + GetWindowRect(hctrl, &rc); + final_height = rc.bottom - rc.top; + } + final_width = min(max(size.cx, min_width) + 4, max_width); - SetWindowPos(hctrl, NULL, 0, 0, final_width, rc.bottom - rc.top, + SetWindowPos(hctrl, NULL, 0, 0, final_width, final_height, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); HeapFree(GetProcessHeap(), 0, text); @@ -628,7 +643,7 @@ static void customctrl_resize(FileDialogImpl *This, customctrl *ctrl) case IDLG_CCTRL_COMBOBOX: case IDLG_CCTRL_CHECKBUTTON: case IDLG_CCTRL_TEXT: - ctrl_resize(ctrl->hwnd, 160, 160); + ctrl_resize(ctrl->hwnd, 160, 160, TRUE); GetWindowRect(ctrl->hwnd, &rc); SetWindowPos(ctrl->wrapper_hwnd, NULL, 0, 0, rc.right-rc.left, rc.bottom-rc.top, SWP_NOZORDER|SWP_NOMOVE|SWP_NOZORDER); @@ -1349,21 +1364,21 @@ static void update_control_text(FileDialogImpl *This) (hitem = GetDlgItem(This->dlg_hwnd, IDOK))) { SetWindowTextW(hitem, This->custom_okbutton); - ctrl_resize(hitem, 50, 250); + ctrl_resize(hitem, 50, 250, FALSE); } if(This->custom_cancelbutton && (hitem = GetDlgItem(This->dlg_hwnd, IDCANCEL))) { SetWindowTextW(hitem, This->custom_cancelbutton); - ctrl_resize(hitem, 50, 250); + ctrl_resize(hitem, 50, 250, FALSE); } if(This->custom_filenamelabel && (hitem = GetDlgItem(This->dlg_hwnd, IDC_FILENAMESTATIC))) { SetWindowTextW(hitem, This->custom_filenamelabel); - ctrl_resize(hitem, 50, 250); + ctrl_resize(hitem, 50, 250, FALSE); } }
1
0
0
0
David Hedberg : comdlg32: Add support for custom control events.
by Alexandre Julliard
27 May '11
27 May '11
Module: wine Branch: master Commit: 2a863985e06761228e403e50abc04f81e78953f9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2a863985e06761228e403e50a…
Author: David Hedberg <david.hedberg(a)gmail.com> Date: Fri May 27 04:05:55 2011 +0200 comdlg32: Add support for custom control events. --- dlls/comdlg32/itemdlg.c | 167 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 167 insertions(+), 0 deletions(-) diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c index 78d6608..f8324f9 100644 --- a/dlls/comdlg32/itemdlg.c +++ b/dlls/comdlg32/itemdlg.c @@ -194,6 +194,88 @@ static void events_OnSelectionChange(FileDialogImpl *This) } } +static inline HRESULT get_cctrl_event(IFileDialogEvents *pfde, IFileDialogControlEvents **pfdce) +{ + return IFileDialogEvents_QueryInterface(pfde, &IID_IFileDialogControlEvents, (void**)pfdce); +} + +static HRESULT cctrl_event_OnButtonClicked(FileDialogImpl *This, DWORD ctl_id) +{ + events_client *cursor; + TRACE("%p\n", This); + + LIST_FOR_EACH_ENTRY(cursor, &This->events_clients, events_client, entry) + { + IFileDialogControlEvents *pfdce; + if(SUCCEEDED(get_cctrl_event(cursor->pfde, &pfdce))) + { + TRACE("Notifying %p\n", cursor); + IFileDialogControlEvents_OnButtonClicked(pfdce, &This->IFileDialogCustomize_iface, ctl_id); + IFileDialogControlEvents_Release(pfdce); + } + } + + return S_OK; +} + +static HRESULT cctrl_event_OnItemSelected(FileDialogImpl *This, DWORD ctl_id, DWORD item_id) +{ + events_client *cursor; + TRACE("%p\n", This); + + LIST_FOR_EACH_ENTRY(cursor, &This->events_clients, events_client, entry) + { + IFileDialogControlEvents *pfdce; + if(SUCCEEDED(get_cctrl_event(cursor->pfde, &pfdce))) + { + TRACE("Notifying %p\n", cursor); + IFileDialogControlEvents_OnItemSelected(pfdce, &This->IFileDialogCustomize_iface, ctl_id, item_id); + IFileDialogControlEvents_Release(pfdce); + } + } + + return S_OK; +} + +static HRESULT cctrl_event_OnCheckButtonToggled(FileDialogImpl *This, DWORD ctl_id, BOOL checked) +{ + events_client *cursor; + TRACE("%p\n", This); + + LIST_FOR_EACH_ENTRY(cursor, &This->events_clients, events_client, entry) + { + IFileDialogControlEvents *pfdce; + if(SUCCEEDED(get_cctrl_event(cursor->pfde, &pfdce))) + { + TRACE("Notifying %p\n", cursor); + IFileDialogControlEvents_OnCheckButtonToggled(pfdce, &This->IFileDialogCustomize_iface, ctl_id, checked); + IFileDialogControlEvents_Release(pfdce); + } + } + + return S_OK; +} + +static HRESULT cctrl_event_OnControlActivating(FileDialogImpl *This, + DWORD ctl_id) +{ + events_client *cursor; + TRACE("%p\n", This); + + LIST_FOR_EACH_ENTRY(cursor, &This->events_clients, events_client, entry) + { + IFileDialogControlEvents *pfdce; + if(SUCCEEDED(get_cctrl_event(cursor->pfde, &pfdce))) + { + TRACE("Notifying %p\n", cursor); + IFileDialogControlEvents_OnControlActivating(pfdce, &This->IFileDialogCustomize_iface, ctl_id); + IFileDialogControlEvents_Release(pfdce); + } + } + + return S_OK; +} + /************************************************************************** * Helper functions. */ @@ -568,14 +650,99 @@ static LRESULT notifysink_on_create(HWND hwnd, CREATESTRUCTW *crs) return TRUE; } +static LRESULT notifysink_on_bn_clicked(FileDialogImpl *This, HWND hwnd, WPARAM wparam) +{ + customctrl *ctrl = get_cctrl_from_dlgid(This, LOWORD(wparam)); + + TRACE("%p, %lx\n", This, wparam); + + if(ctrl) + { + if(ctrl->type == IDLG_CCTRL_CHECKBUTTON) + { + BOOL checked = (SendMessageW(ctrl->hwnd, BM_GETCHECK, 0, 0) == BST_CHECKED); + cctrl_event_OnCheckButtonToggled(This, ctrl->id, checked); + } + else + cctrl_event_OnButtonClicked(This, ctrl->id); + } + + return TRUE; +} + +static LRESULT notifysink_on_cbn_selchange(FileDialogImpl *This, HWND hwnd, WPARAM wparam) +{ + customctrl *ctrl = get_cctrl_from_dlgid(This, LOWORD(wparam)); + TRACE("%p, %p (%lx)\n", This, ctrl, wparam); + + if(ctrl) + { + UINT index = SendMessageW(ctrl->hwnd, CB_GETCURSEL, 0, 0); + UINT selid = SendMessageW(ctrl->hwnd, CB_GETITEMDATA, index, 0); + + cctrl_event_OnItemSelected(This, ctrl->id, selid); + } + return TRUE; +} + +static LRESULT notifysink_on_tvn_dropdown(FileDialogImpl *This, LPARAM lparam) +{ + NMTOOLBARW *nmtb = (NMTOOLBARW*)lparam; + customctrl *ctrl = get_cctrl_from_dlgid(This, GetDlgCtrlID(nmtb->hdr.hwndFrom)); + POINT pt = { 0, nmtb->rcButton.bottom }; + TBBUTTON tbb; + UINT idcmd; + + TRACE("%p, %p (%lx)\n", This, ctrl, lparam); + + if(ctrl) + { + cctrl_event_OnControlActivating(This,ctrl->id); + + SendMessageW(ctrl->hwnd, TB_GETBUTTON, 0, (LPARAM)&tbb); + ClientToScreen(ctrl->hwnd, &pt); + idcmd = TrackPopupMenu((HMENU)tbb.dwData, TPM_RETURNCMD, pt.x, pt.y, 0, This->dlg_hwnd, NULL); + if(idcmd) + cctrl_event_OnItemSelected(This, ctrl->id, idcmd); + } + + return TBDDRET_DEFAULT; +} + +static LRESULT notifysink_on_wm_command(FileDialogImpl *This, HWND hwnd, WPARAM wparam, LPARAM lparam) +{ + switch(HIWORD(wparam)) + { + case BN_CLICKED: return notifysink_on_bn_clicked(This, hwnd, wparam); + case CBN_SELCHANGE: return notifysink_on_cbn_selchange(This, hwnd, wparam); + } + + return FALSE; +} + +static LRESULT notifysink_on_wm_notify(FileDialogImpl *This, HWND hwnd, WPARAM wparam, LPARAM lparam) +{ + NMHDR *nmhdr = (NMHDR*)lparam; + + switch(nmhdr->code) + { + case TBN_DROPDOWN: return notifysink_on_tvn_dropdown(This, lparam); + } + + return FALSE; +} + static LRESULT CALLBACK notifysink_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { + FileDialogImpl *This = (FileDialogImpl*)GetWindowLongPtrW(hwnd, GWLP_USERDATA); HWND hwnd_child; RECT rc; switch(message) { case WM_NCCREATE: return notifysink_on_create(hwnd, (CREATESTRUCTW*)lparam); + case WM_COMMAND: return notifysink_on_wm_command(This, hwnd, wparam, lparam); + case WM_NOTIFY: return notifysink_on_wm_notify(This, hwnd, wparam, lparam); case WM_SIZE: hwnd_child = GetPropW(hwnd, notifysink_childW); GetClientRect(hwnd, &rc);
1
0
0
0
David Hedberg : comdlg32: Implement support for custom control subitems.
by Alexandre Julliard
27 May '11
27 May '11
Module: wine Branch: master Commit: d4f0aa2bb2b856c8cde0d227a1a721af0e4fe27a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d4f0aa2bb2b856c8cde0d227a…
Author: David Hedberg <david.hedberg(a)gmail.com> Date: Fri May 27 04:05:54 2011 +0200 comdlg32: Implement support for custom control subitems. --- dlls/comdlg32/itemdlg.c | 141 +++++++++++++++++++- dlls/comdlg32/tests/itemdlg.c | 288 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 422 insertions(+), 7 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=d4f0aa2bb2b856c8cde0d…
1
0
0
0
David Hedberg : comdlg32: Implement some functions for modifying custom controls.
by Alexandre Julliard
27 May '11
27 May '11
Module: wine Branch: master Commit: 23571b6a0a9928a029d34e42227543d7ff3ee426 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=23571b6a0a9928a029d34e422…
Author: David Hedberg <david.hedberg(a)gmail.com> Date: Fri May 27 04:05:53 2011 +0200 comdlg32: Implement some functions for modifying custom controls. --- dlls/comdlg32/itemdlg.c | 99 +++++++++++-- dlls/comdlg32/tests/itemdlg.c | 308 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 388 insertions(+), 19 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=23571b6a0a9928a029d34…
1
0
0
0
David Hedberg : comdlg32: Layout the customized controls.
by Alexandre Julliard
27 May '11
27 May '11
Module: wine Branch: master Commit: bb2230f0e8a287a70f56ff582d410b93f44d081b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bb2230f0e8a287a70f56ff582…
Author: David Hedberg <david.hedberg(a)gmail.com> Date: Fri May 27 04:05:52 2011 +0200 comdlg32: Layout the customized controls. --- dlls/comdlg32/itemdlg.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 157 insertions(+), 1 deletions(-) diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c index 40e785c..5acf3d2 100644 --- a/dlls/comdlg32/itemdlg.c +++ b/dlls/comdlg32/itemdlg.c @@ -536,6 +536,29 @@ static void ctrl_resize(HWND hctrl, UINT min_width, UINT max_width) HeapFree(GetProcessHeap(), 0, text); } +static void customctrl_resize(FileDialogImpl *This, customctrl *ctrl) +{ + RECT rc; + + switch(ctrl->type) + { + case IDLG_CCTRL_PUSHBUTTON: + case IDLG_CCTRL_COMBOBOX: + case IDLG_CCTRL_CHECKBUTTON: + case IDLG_CCTRL_TEXT: + ctrl_resize(ctrl->hwnd, 160, 160); + GetWindowRect(ctrl->hwnd, &rc); + SetWindowPos(ctrl->wrapper_hwnd, NULL, 0, 0, rc.right-rc.left, rc.bottom-rc.top, + SWP_NOZORDER|SWP_NOMOVE|SWP_NOZORDER); + case IDLG_CCTRL_RADIOBUTTONLIST: + case IDLG_CCTRL_EDITBOX: + case IDLG_CCTRL_SEPARATOR: + case IDLG_CCTRL_MENU: + /* Nothing */ + break; + } +} + static LRESULT notifysink_on_create(HWND hwnd, CREATESTRUCTW *crs) { FileDialogImpl *This = crs->lpCreateParams; @@ -613,7 +636,126 @@ static HRESULT cctrl_create_new(FileDialogImpl *This, DWORD id, */ static UINT ctrl_container_resize(FileDialogImpl *This, UINT container_width) { - return 0; + UINT container_height; + UINT column_width; + UINT nr_of_cols; + UINT max_control_height, total_height = 0; + UINT cur_col_pos, cur_row_pos; + customctrl *ctrl; + BOOL fits_height; + static const UINT col_indent = 100; /* The first column is indented 100px */ + static const UINT cspacing = 90; /* Columns are spaced with 90px */ + static const UINT rspacing = 4; /* Rows are spaced with 4 px. */ + + /* Given the new width of the container, this function determines the + * needed height of the container and places the controls according to + * the new layout. Returns the new height. + */ + + TRACE("%p\n", This); + + column_width = This->cctrl_width + cspacing; + nr_of_cols = (container_width - col_indent + cspacing) / column_width; + + /* We don't need to do anything unless the number of visible columns has changed. */ + if(nr_of_cols == This->cctrls_cols) + { + RECT rc; + GetWindowRect(This->cctrls_hwnd, &rc); + return rc.bottom - rc.top; + } + + This->cctrls_cols = nr_of_cols; + + /* Get the size of the tallest control, and the total size of + * all the controls to figure out the number of slots we need. + */ + max_control_height = 0; + LIST_FOR_EACH_ENTRY(ctrl, &This->cctrls, customctrl, entry) + { + if(ctrl->cdcstate & CDCS_VISIBLE) + { + RECT rc; + UINT control_height; + GetWindowRect(ctrl->wrapper_hwnd, &rc); + control_height = rc.bottom - rc.top; + max_control_height = max(max_control_height, control_height); + + total_height += control_height + rspacing; + } + } + + if(!total_height) + return 0; + + container_height = max(total_height / nr_of_cols, max_control_height + rspacing); + TRACE("Guess: container_height: %d\n",container_height); + + /* Incrementally increase container_height until all the controls + * fit. + */ + do { + UINT columns_needed = 1; + cur_row_pos = 0; + + fits_height = TRUE; + LIST_FOR_EACH_ENTRY(ctrl, &This->cctrls, customctrl, entry) + { + if(ctrl->cdcstate & CDCS_VISIBLE) + { + RECT rc; + UINT control_height; + GetWindowRect(ctrl->wrapper_hwnd, &rc); + control_height = rc.bottom - rc.top; + + if(cur_row_pos + control_height > container_height) + { + if(++columns_needed > nr_of_cols) + { + container_height += 1; + fits_height = FALSE; + break; + } + cur_row_pos = 0; + } + + cur_row_pos += control_height + rspacing; + } + } + } while(!fits_height); + + TRACE("Final container height: %d\n", container_height); + + /* Move the controls to their final destination + */ + cur_col_pos = col_indent, cur_row_pos = 0; + LIST_FOR_EACH_ENTRY(ctrl, &This->cctrls, customctrl, entry) + { + if(ctrl->cdcstate & CDCS_VISIBLE) + { + RECT rc; + UINT control_height; + GetWindowRect(ctrl->wrapper_hwnd, &rc); + control_height = rc.bottom - rc.top; + + if(cur_row_pos + control_height > container_height) + { + cur_row_pos = 0; + cur_col_pos += This->cctrl_width + cspacing; + } + + SetWindowPos(ctrl->wrapper_hwnd, NULL, cur_col_pos, cur_row_pos, 0, 0, + SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER); + + cur_row_pos += control_height + rspacing; + } + } + + /* Sanity check */ + if(cur_row_pos + This->cctrl_width > container_width) + ERR("-- Failed to place controls properly.\n"); + + return container_height; } static void ctrl_container_reparent(FileDialogImpl *This, HWND parent) @@ -622,6 +764,9 @@ static void ctrl_container_reparent(FileDialogImpl *This, HWND parent) if(parent) { + customctrl *ctrl; + HFONT font; + wndstyle = GetWindowLongW(This->cctrls_hwnd, GWL_STYLE); wndstyle &= ~(WS_POPUP); wndstyle |= WS_CHILD; @@ -629,6 +774,17 @@ static void ctrl_container_reparent(FileDialogImpl *This, HWND parent) SetParent(This->cctrls_hwnd, parent); ShowWindow(This->cctrls_hwnd, TRUE); + + /* Set the fonts to match the dialog font. */ + font = (HFONT)SendMessageW(parent, WM_GETFONT, 0, 0); + if(!font) + ERR("Failed to get font handle from dialog.\n"); + + LIST_FOR_EACH_ENTRY(ctrl, &This->cctrls, customctrl, entry) + { + if(font) SendMessageW(ctrl->hwnd, WM_SETFONT, (WPARAM)font, TRUE); + customctrl_resize(This, ctrl); + } } else {
1
0
0
0
David Hedberg : comdlg32: Support adding custom controls to the item dialog .
by Alexandre Julliard
27 May '11
27 May '11
Module: wine Branch: master Commit: ca136d75f9c00e74028f898013b421785310bd29 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ca136d75f9c00e74028f89801…
Author: David Hedberg <david.hedberg(a)gmail.com> Date: Fri May 27 04:05:51 2011 +0200 comdlg32: Support adding custom controls to the item dialog. --- dlls/comdlg32/itemdlg.c | 268 ++++++++++++++++++++++++++++++++++++++-- dlls/comdlg32/tests/itemdlg.c | 71 +++++++++++ 2 files changed, 325 insertions(+), 14 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=ca136d75f9c00e74028f8…
1
0
0
0
David Hedberg : comdlg32: Add a container for custom controls.
by Alexandre Julliard
27 May '11
27 May '11
Module: wine Branch: master Commit: 44e7cda419899d42ae808ad4e3b613980c46e88b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=44e7cda419899d42ae808ad4e…
Author: David Hedberg <david.hedberg(a)gmail.com> Date: Fri May 27 04:05:50 2011 +0200 comdlg32: Add a container for custom controls. --- dlls/comdlg32/itemdlg.c | 131 ++++++++++++++++++++++++++++++++++++++++- dlls/comdlg32/tests/itemdlg.c | 33 ++++++++++ 2 files changed, 161 insertions(+), 3 deletions(-) diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c index a1d61e8..920353b 100644 --- a/dlls/comdlg32/itemdlg.c +++ b/dlls/comdlg32/itemdlg.c @@ -98,6 +98,8 @@ typedef struct FileDialogImpl { LPWSTR custom_okbutton; LPWSTR custom_cancelbutton; LPWSTR custom_filenamelabel; + + HWND cctrls_hwnd; } FileDialogImpl; /************************************************************************** @@ -486,6 +488,104 @@ static void ctrl_resize(HWND hctrl, UINT min_width, UINT max_width) } /************************************************************************** + * Container functions. + */ +static UINT ctrl_container_resize(FileDialogImpl *This, UINT container_width) +{ + return 0; +} + +static void ctrl_container_reparent(FileDialogImpl *This, HWND parent) +{ + LONG wndstyle; + + if(parent) + { + wndstyle = GetWindowLongW(This->cctrls_hwnd, GWL_STYLE); + wndstyle &= ~(WS_POPUP); + wndstyle |= WS_CHILD; + SetWindowLongW(This->cctrls_hwnd, GWL_STYLE, wndstyle); + + SetParent(This->cctrls_hwnd, parent); + ShowWindow(This->cctrls_hwnd, TRUE); + } + else + { + ShowWindow(This->cctrls_hwnd, FALSE); + + wndstyle = GetWindowLongW(This->cctrls_hwnd, GWL_STYLE); + wndstyle &= ~(WS_CHILD); + wndstyle |= WS_POPUP; + SetWindowLongW(This->cctrls_hwnd, GWL_STYLE, wndstyle); + + SetParent(This->cctrls_hwnd, NULL); + } +} + +static LRESULT ctrl_container_on_create(HWND hwnd, CREATESTRUCTW *crs) +{ + FileDialogImpl *This = crs->lpCreateParams; + TRACE("%p\n", This); + + SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LPARAM)This); + return TRUE; +} + +static LRESULT ctrl_container_on_wm_destroy(FileDialogImpl *This) +{ + TRACE("%p", This); + return TRUE; +} + +static LRESULT CALLBACK ctrl_container_wndproc(HWND hwnd, UINT umessage, WPARAM wparam, LPARAM lparam) +{ + FileDialogImpl *This = (FileDialogImpl*)GetWindowLongPtrW(hwnd, GWLP_USERDATA); + + switch(umessage) + { + case WM_NCCREATE: return ctrl_container_on_create(hwnd, (CREATESTRUCTW*)lparam); + case WM_DESTROY: return ctrl_container_on_wm_destroy(This); + default: return DefWindowProcW(hwnd, umessage, wparam, lparam); + } + + return FALSE; +} + +static HRESULT init_custom_controls(FileDialogImpl *This) +{ + WNDCLASSW wc; + static const WCHAR ctrl_container_classname[] = + {'i','d','l','g','_','c','o','n','t','a','i','n','e','r','_','p','a','n','e',0}; + + if( !GetClassInfoW(COMDLG32_hInstance, ctrl_container_classname, &wc) ) + { + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = ctrl_container_wndproc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = COMDLG32_hInstance; + wc.hIcon = 0; + wc.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + wc.lpszMenuName = NULL; + wc.lpszClassName = ctrl_container_classname; + + if(!RegisterClassW(&wc)) return E_FAIL; + } + + This->cctrls_hwnd = CreateWindowExW(0, ctrl_container_classname, NULL, + WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + 0, 0, 0, 0, NULL, 0, + COMDLG32_hInstance, (void*)This); + if(!This->cctrls_hwnd) + return E_FAIL; + + SetWindowLongW(This->cctrls_hwnd, GWL_STYLE, WS_TABSTOP); + + return S_OK; +} + +/************************************************************************** * Window related functions. */ static SIZE update_layout(FileDialogImpl *This) @@ -495,7 +595,7 @@ static SIZE update_layout(FileDialogImpl *This) RECT dialog_rc; RECT cancel_rc, open_rc; RECT filetype_rc, filename_rc, filenamelabel_rc; - RECT toolbar_rc, ebrowser_rc; + RECT toolbar_rc, ebrowser_rc, customctrls_rc; int missing_width, missing_height; static const UINT vspacing = 4, hspacing = 4; SIZE ret; @@ -606,22 +706,35 @@ static SIZE update_layout(FileDialogImpl *This) MapWindowPoints(NULL, This->dlg_hwnd, (POINT*)&toolbar_rc, 2); } + /* The custom controls */ + customctrls_rc.left = dialog_rc.left + vspacing; + customctrls_rc.right = dialog_rc.right - vspacing; + customctrls_rc.bottom = filename_rc.top - hspacing; + customctrls_rc.top = customctrls_rc.bottom - + ctrl_container_resize(This, customctrls_rc.right - customctrls_rc.left); + /* The ExplorerBrowser control. */ ebrowser_rc.left = dialog_rc.left + vspacing; ebrowser_rc.top = toolbar_rc.bottom + vspacing; ebrowser_rc.right = dialog_rc.right - hspacing; - ebrowser_rc.bottom = filename_rc.top - hspacing; + ebrowser_rc.bottom = customctrls_rc.top - hspacing; /**** * Move everything to the right place. */ /* FIXME: The Save Dialog uses a slightly different layout. */ - hdwp = BeginDeferWindowPos(6); + hdwp = BeginDeferWindowPos(7); if(hdwp && This->peb) IExplorerBrowser_SetRect(This->peb, &hdwp, ebrowser_rc); + if(hdwp && This->cctrls_hwnd) + DeferWindowPos(hdwp, This->cctrls_hwnd, NULL, + customctrls_rc.left, customctrls_rc.top, + customctrls_rc.right - customctrls_rc.left, customctrls_rc.bottom - customctrls_rc.top, + SWP_NOZORDER | SWP_NOACTIVATE); + /* The default controls */ if(hdwp && (hwnd = GetDlgItem(This->dlg_hwnd, IDC_FILETYPE)) ) DeferWindowPos(hdwp, hwnd, NULL, filetype_rc.left, filetype_rc.top, 0, 0, @@ -797,6 +910,7 @@ static LRESULT on_wm_initdialog(HWND hwnd, LPARAM lParam) (hitem = GetDlgItem(This->dlg_hwnd, IDC_FILENAME)) ) SendMessageW(hitem, WM_SETTEXT, 0, (LPARAM)This->set_filename); + ctrl_container_reparent(This, This->dlg_hwnd); init_explorerbrowser(This); init_toolbar(This, hwnd); update_control_text(This); @@ -834,6 +948,7 @@ static LRESULT on_wm_destroy(FileDialogImpl *This) This->peb = NULL; } + ctrl_container_reparent(This, NULL); This->dlg_hwnd = NULL; return TRUE; @@ -1055,6 +1170,8 @@ static ULONG WINAPI IFileDialog2_fnRelease(IFileDialog2 *iface) } HeapFree(GetProcessHeap(), 0, This->filterspecs); + DestroyWindow(This->cctrls_hwnd); + if(This->psi_defaultfolder) IShellItem_Release(This->psi_defaultfolder); if(This->psi_setfolder) IShellItem_Release(This->psi_setfolder); if(This->psi_folder) IShellItem_Release(This->psi_folder); @@ -2736,6 +2853,14 @@ static HRESULT FileDialog_constructor(IUnknown *pUnkOuter, REFIID riid, void **p SHGetItemFromObject((IUnknown*)psf, &IID_IShellItem, (void**)&fdimpl->psi_defaultfolder); IShellFolder_Release(psf); + hr = init_custom_controls(fdimpl); + if(FAILED(hr)) + { + ERR("Failed to initialize custom controls (0x%08x).\n", hr); + IUnknown_Release((IUnknown*)fdimpl); + return E_FAIL; + } + hr = IUnknown_QueryInterface((IUnknown*)fdimpl, riid, ppv); IUnknown_Release((IUnknown*)fdimpl); return hr; diff --git a/dlls/comdlg32/tests/itemdlg.c b/dlls/comdlg32/tests/itemdlg.c index 4c4e1ce..9e4d571 100644 --- a/dlls/comdlg32/tests/itemdlg.c +++ b/dlls/comdlg32/tests/itemdlg.c @@ -1200,6 +1200,38 @@ static void test_filename(void) DeleteFileW(filename_ext2W); } +static void test_customize(void) +{ + IFileDialog *pfod; + IFileDialogCustomize *pfdc; + IOleWindow *pow; + LONG ref; + HWND dlg_hwnd; + HRESULT hr; + hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, + &IID_IFileDialog, (void**)&pfod); + ok(hr == S_OK, "got 0x%08x.\n", hr); + + hr = IFileOpenDialog_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&pfdc); + ok(hr == S_OK, "got 0x%08x.\n", hr); + if(FAILED(hr)) + { + skip("Skipping IFileDialogCustomize tests.\n"); + return; + } + + hr = IFileDialog_QueryInterface(pfod, &IID_IOleWindow, (void**)&pow); + ok(hr == S_OK, "Got 0x%08x\n", hr); + hr = IOleWindow_GetWindow(pow, &dlg_hwnd); + ok(hr == S_OK, "Got 0x%08x\n", hr); + ok(dlg_hwnd == NULL, "NULL\n"); + IOleWindow_Release(pow); + + IFileDialogCustomize_Release(pfdc); + ref = IFileOpenDialog_Release(pfod); + ok(!ref, "Refcount not zero (%d).\n", ref); +} + START_TEST(itemdlg) { OleInitialize(NULL); @@ -1210,6 +1242,7 @@ START_TEST(itemdlg) test_basics(); test_advise(); test_filename(); + test_customize(); } else skip("Skipping all Item Dialog tests.\n");
1
0
0
0
Dylan Smith : d3dxof: COM cleanup in d3dxof.c.
by Alexandre Julliard
27 May '11
27 May '11
Module: wine Branch: master Commit: ac65f31ae663d1dd630974686c4d3755e5d81151 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ac65f31ae663d1dd630974686…
Author: Dylan Smith <dylan.ah.smith(a)gmail.com> Date: Thu May 26 21:21:01 2011 -0400 d3dxof: COM cleanup in d3dxof.c. --- dlls/d3dxof/d3dxof.c | 164 +++++++++++++++++++++++++----------------- dlls/d3dxof/d3dxof_private.h | 14 ++-- 2 files changed, 106 insertions(+), 72 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=ac65f31ae663d1dd63097…
1
0
0
0
Dylan Smith : d3dxof: COM cleanup in main.c.
by Alexandre Julliard
27 May '11
27 May '11
Module: wine Branch: master Commit: 7a1d910566eb35f6f09cd567b0887345f85daa6e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7a1d910566eb35f6f09cd567b…
Author: Dylan Smith <dylan.ah.smith(a)gmail.com> Date: Thu May 26 21:20:55 2011 -0400 d3dxof: COM cleanup in main.c. --- dlls/d3dxof/main.c | 23 ++++++++++++++--------- 1 files changed, 14 insertions(+), 9 deletions(-) diff --git a/dlls/d3dxof/main.c b/dlls/d3dxof/main.c index 8eb1489..3b43ec8 100644 --- a/dlls/d3dxof/main.c +++ b/dlls/d3dxof/main.c @@ -64,12 +64,17 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) * DirectX File ClassFactory */ typedef struct { - IClassFactory ITF_IClassFactory; + IClassFactory IClassFactory_iface; LONG ref; HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj); } IClassFactoryImpl; +static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface) +{ + return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface); +} + struct object_creation_info { const CLSID *clsid; @@ -83,13 +88,13 @@ static const struct object_creation_info object_creation[] = static HRESULT WINAPI XFCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVOID *ppobj) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + IClassFactoryImpl *This = impl_from_IClassFactory(iface); if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IClassFactory)) { IClassFactory_AddRef(iface); - *ppobj = This; + *ppobj = &This->IClassFactory_iface; return S_OK; } @@ -99,13 +104,13 @@ static HRESULT WINAPI XFCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVO static ULONG WINAPI XFCF_AddRef(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + IClassFactoryImpl *This = impl_from_IClassFactory(iface); return InterlockedIncrement(&This->ref); } static ULONG WINAPI XFCF_Release(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + IClassFactoryImpl *This = impl_from_IClassFactory(iface); ULONG ref = InterlockedDecrement(&This->ref); @@ -117,7 +122,7 @@ static ULONG WINAPI XFCF_Release(LPCLASSFACTORY iface) static HRESULT WINAPI XFCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + IClassFactoryImpl *This = impl_from_IClassFactory(iface); HRESULT hres; LPUNKNOWN punk; @@ -134,7 +139,7 @@ static HRESULT WINAPI XFCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter static HRESULT WINAPI XFCF_LockServer(LPCLASSFACTORY iface, BOOL dolock) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + IClassFactoryImpl *This = impl_from_IClassFactory(iface); FIXME("(%p)->(%d),stub!\n",This,dolock); return S_OK; } @@ -211,12 +216,12 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory)); if (factory == NULL) return E_OUTOFMEMORY; - factory->ITF_IClassFactory.lpVtbl = &XFCF_Vtbl; + factory->IClassFactory_iface.lpVtbl = &XFCF_Vtbl; factory->ref = 1; factory->pfnCreateInstance = object_creation[i].pfnCreateInstance; - *ppv = &(factory->ITF_IClassFactory); + *ppv = &(factory->IClassFactory_iface); return S_OK; }
1
0
0
0
Dylan Smith : d3dxof: Removed function declarations with no definitions.
by Alexandre Julliard
27 May '11
27 May '11
Module: wine Branch: master Commit: cbc78b61e851ee857cb3461f146bb24fc51fa583 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cbc78b61e851ee857cb3461f1…
Author: Dylan Smith <dylan.ah.smith(a)gmail.com> Date: Thu May 26 21:20:38 2011 -0400 d3dxof: Removed function declarations with no definitions. --- dlls/d3dxof/d3dxof_private.h | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/dlls/d3dxof/d3dxof_private.h b/dlls/d3dxof/d3dxof_private.h index fb5ae77..225ec3f 100644 --- a/dlls/d3dxof/d3dxof_private.h +++ b/dlls/d3dxof/d3dxof_private.h @@ -165,8 +165,6 @@ typedef struct { } IDirectXFileSaveObjectImpl; HRESULT IDirectXFileImpl_Create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN; -HRESULT IDirectXFileFileObjectImpl_Create(IDirectXFileObjectImpl** ppObj) DECLSPEC_HIDDEN; -HRESULT IDirectXFileFileSaveObjectImpl_Create(IDirectXFileSaveObjectImpl** ppObj) DECLSPEC_HIDDEN; BOOL read_bytes(parse_buffer * buf, LPVOID data, DWORD size) DECLSPEC_HIDDEN; BOOL parse_template(parse_buffer * buf) DECLSPEC_HIDDEN;
1
0
0
0
← Newer
1
...
7
8
9
10
11
12
13
...
95
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Results per page:
10
25
50
100
200