class Fzeet::PropertySheet

Public Class Methods

new(parent, opts = {wizard: false}) click to toggle source
# File lib/fzeet/windows/comctl/PropertySheet.rb, line 237
def initialize(parent, opts = {wizard: false})
        pointers = []

        psps = PropertyPage::PROPSHEETPAGEA1.new

        dt = Windows::DLGTEMPLATE.new

        dt[:style] = Fzeet.flags([:'3dlook', :control, :child, :tabstop], :ds_, :ws_)
        dt[:x], dt[:y], dt[:cx], dt[:cy] = 100, 100, 300, 150

        psp = psps[:array][0]

        psp[:dwSize] = psp.size
        psp[:dwFlags] = Fzeet.flags([:dlgindirect, :usetitle], :psp_)
        psp[:hInstance] = Windows.GetModuleHandle(nil)
        psp[:template][:pResource] = dt
        psp[:pszTitle] = pointers.push(FFI::MemoryPointer.from_string("Page")).last

        psh = Windows::PROPSHEETHEADER.new

        psh[:dwSize] = psh.size
        psh[:dwFlags] = Fzeet.flags(:propsheetpage, :psh_)
        psh[:dwFlags] |= Windows::PSH_WIZARD if opts[:wizard]
        psh[:hwndParent] = parent.handle
        psh[:hInstance] = Windows.GetModuleHandle(nil)
        psh[:pszCaption] = pointers.push(FFI::MemoryPointer.from_string('Sheet')).last
        psh[:nPages] = 1
        psh[:start][:nStartPage] = 0
        psh[:pages][:ppsp] = psps

        Windows.DetonateLastError(-1, :PropertySheet, psh)
ensure
        pointers.each(&:free)
end