#############################################################################
## Name:        XS/BookCtrl.xsp
## Purpose:     XS+++ for Wx::BookCtrl
## Author:      Mattia Barbon
## Modified by:
## Created:     06/12/2003
## RCS-ID:      $Id: BookCtrl.xsp 2071 2007-07-08 15:39:02Z mbarbon $
## Copyright:   (c) 2003, 2006-2007 Mattia Barbon
## Licence:     This program is free software; you can redistribute it and/or
##              modify it under the same terms as Perl itself
#############################################################################

%module{Wx};

%{
#if WXPERL_W_VERSION_GE( 2, 5, 1 )

#include <wx/bookctrl.h>
#include <wx/sizer.h>
%}

%name{Wx::BookCtrl} class wxBookCtrl
{
    size_t GetPageCount() const;
    wxWindow *GetPage(size_t n);
    int GetSelection() const;
    bool SetPageText(size_t n, const wxString& strText);
    wxString GetPageText(size_t n) const;
    void SetImageList(wxImageList *imageList);
##    void AssignImageList(wxImageList *imageList)
##    wxImageList* GetImageList() const;
    int GetPageImage(size_t n) const;
    bool SetPageImage(size_t n, int imageId);
    void SetPageSize(const wxSize& size);
    wxSize CalcSizeFromPage(const wxSize& sizePage) const;
#if WXPERL_W_VERSION_GE( 2, 7, 0 )
    unsigned int GetInternalBorder();
    void SetInternalBorder( unsigned int border );
    bool IsVertical();
    void SetFitToCurrentPage( bool fit );
    bool GetFitToCurrentPage();
    wxSizer* GetControlSizer();
#endif
    bool DeletePage(size_t n);
    bool RemovePage(size_t n);
    bool DeleteAllPages();
    bool AddPage(wxWindow *page, const wxString& text, bool bSelect = false,
                 int imageId = -1 );
    bool InsertPage(size_t n, wxWindow *page, const wxString& text,
                    bool bSelect = false, int imageId = -1 );
    int SetSelection(size_t n);
    void AdvanceSelection(bool forward = true);
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
    int ChangeSelection(size_t n);
#endif
#if WXPERL_W_VERSION_GE( 2, 6, 0 )
    wxWindow* GetCurrentPage();
#endif
};

%{
void
wxBookCtrl::AssignImageList( imagelist )
    wxImageList* imagelist
  CODE:
    wxPli_object_set_deleteable( aTHX_ ST(1), false );
    THIS->AssignImageList( imagelist );

wxImageList*
wxBookCtrl::GetImageList()
  OUTPUT:
    RETVAL
  CLEANUP:
    wxPli_object_set_deleteable( aTHX_ ST(0), false );

#if WXPERL_W_VERSION_GE( 2, 7, 0 )

void
wxBookCtrl::HitTest( point )
    wxPoint point
  PREINIT:
    long flags;
    int item;
  PPCODE:
    item = THIS->HitTest( point, &flags );
    EXTEND( SP, 2 );
    PUSHs( sv_2mortal( newSViv( item ) ) );
    PUSHs( sv_2mortal( newSViv( flags ) ) );

#endif
%}

%name{Wx::BookCtrlEvent} class wxBookCtrlEvent
{
    int GetSelection() const;
    void SetSelection(int nSel);
    int GetOldSelection() const;
    void SetOldSelection(int nOldSel);
};

%{
#endif
%}