Ticket #15023 (closed enhancement: fixed)

Opened 4 months ago

Last modified 3 months ago

New wxIcon::CreateFromHICON() method

Reported by: troelsk Owned by: vadz
Priority: normal Milestone:
Component: wxMSW Version: 2.9-svn
Keywords: wxIcon Cc:
Blocked By: Patch: yes
Blocking:

Description

It is rather unexpected that SetHICON() leaves the wxIcon width and height members at zero.

Attachments

hicon.patch download (1.4 KB) - added by troelsk 4 months ago.
hicon.2.patch download (2.2 KB) - added by troelsk 4 months ago.
CreateFromHICON

Change History

Changed 4 months ago by troelsk

Changed 4 months ago by vadz

  • status changed from new to closed
  • resolution set to wontfix

I don't think it's a good idea. Calling SetHICON() should really be restricted to wxMSW code itself which knows what it is doing. The user code shouldn't call it and if we want to provide a way to wrap an existing HICON, we should do it properly, i.e. add a new public CreateFromHICON() or static New(HICON) method.

Applying this patch would just make SetHICON() inconsistent with SetHBITMAP() and other similar methods.

Changed 4 months ago by troelsk

  • status changed from closed to reopened
  • resolution deleted

CreateFromHICON() sounds good. From the user perspective SetHICON() appears just broken. Patch added.

Changed 4 months ago by troelsk

CreateFromHICON

Changed 4 months ago by troelsk

  • summary changed from wxIcon::SetHICON() enhancement to New wxIcon::CreateFromHICON() method

Changed 3 months ago by vadz

  • owner set to vadz
  • status changed from reopened to accepted

Thanks, will apply soon after changing the code to avoid calling wxGetHiconSize() twice when loading icons.

Changed 3 months ago by VZ

  • status changed from accepted to closed
  • resolution set to fixed

(In [73489]) Add wxIcon::CreateFromHICON() to wxMSW.

Provide a public method properly assigning an HICON to wxIcon, instead of
asking people to call SetHICON() and SetSize().

Closes #15023.

Note: See TracTickets for help on using tickets.