#include "xnotebk.h"
#include "XBookPg.h"

/*@ 
@class XNoteBook
@parent XControl
@type overview
@symbol _
*/

/*@ XNoteBook :: XNoteBook(const XWindow * owner, const XRect * rec, const USHORT id, const ULONG style, char *font)
@group constructors/destructors
@remarks Create a notebook
@parameters <t 'ø' c=2>
				øXWindow * owner   øthe owner-window
            øXRect * rect      øsize and position
            øUSHORT id         øID of the window
            øULONG style       østyle of the notebook, valid values are:
										<t 'ø' c=1>
                                 øNB_BACKPAGESBR
                                 øNB_BACKPAGESBL
                                 øNB_BACKPAGESTR
                                 øNB_BACKPAGESTL
                                 øNB_MAJORTABRIGHT
                                 øNB_MAJORTABLEFT
                                 øNB_MAJORTABTOP
                                 øNB_MAJORTABBOTTOM
                                 øNB_SQUARETABS
                                 øNB_ROUNDEDTABS
                                 øNB_POLYGONTABS
                                 øNB_SOLIDBIND
                                 øNB_SPIRALBIND
                                 øNB_STATUSTEXTLEFT
                                 øNB_STATUSTEXTRIGHT
                                 øNB_STATUSTEXTCENTER
                                 øNB_TABTEXTLEFT
                                 øNB_TABTEXTRIGHT
                                 øNB_TABTEXTCENTER
											øNB_TABBEDDIALOG	(Warp4 only)
										</t>
                              (can be or-ed, default is NB_SOLIDBIND|NB_BACKPAGESBR|NB_SQUARETABS|NB_TABTEXTCENTER|NB_STATUSTEXTLEFT)
            øchar * font			øfont to use, eg "8.Helv" (default is NULL)
				</t>
*/
XNoteBook :: XNoteBook(const XWindow * owner, const XRect * rec, const USHORT id, const ULONG style, char *font):XControl(rec, style, owner, "", WC_NOTEBOOK, id, font)
{
	color = XColor(COL_WHITE).GetColor();
}


/*@ XNoteBook::SetMajorTabSize(const SHORT width, const SHORT height)
@group size
@remarks Set the size of major tabs.
@parameters SHORT width<BR>
            SHORT hight
*/
void XNoteBook::SetMajorTabSize(const SHORT width, const SHORT height) const
{
	WinSendMsg(winhandle, BKM_SETDIMENSIONS, MPFROM2SHORT(width, height), (MPARAM) BKA_MAJORTAB);
}


/*@ XNoteBook::SetMinorTabSize(const SHORT width, const SHORT height)
@group size
@remarks Set the size of minor tabs.
@parameters SHORT width<BR>
            SHORT hight
*/
void XNoteBook::SetMinorTabSize(const SHORT width, const SHORT height) const
{
	WinSendMsg(winhandle, BKM_SETDIMENSIONS, MPFROM2SHORT(width, height), (MPARAM) BKA_MINORTAB);
}


/*@ XNoteBook::SetBackgroundColor(const XColor * col)
@group colors
@remarks Set the background color.
@parameters XColor * color    the new color
*/
void XNoteBook::SetBackgroundColor(const XColor * col)
{
	color = col->GetColor();
	WinSendMsg(winhandle, BKM_SETNOTEBOOKCOLORS, MPFROMLONG(col->GetColor()), MPFROMLONG(BKA_BACKGROUNDPAGECOLOR));
}


/*@ XNoteBook::SetMajorBackgroundColor(const XColor * col)
@group colors
@remarks Set the background color of major tabs.
@parameters XColor * theColor
*/
void XNoteBook::SetMajorBackgroundColor(const XColor * col) const
{
	WinSendMsg(winhandle, BKM_SETNOTEBOOKCOLORS, MPFROMLONG(col->GetColor()), MPFROMLONG(BKA_BACKGROUNDMAJORCOLOR));
}


/*@ XNoteBook::SetMajorForegroundColor(const XColor * col)
@group colors
@remarks Set the foreground color of major tabs.
@parameters XColor * theColor
*/
void XNoteBook::SetMajorForegroundColor(const XColor * col) const
{
	WinSendMsg(winhandle, BKM_SETNOTEBOOKCOLORS, MPFROMLONG(col->GetColor()), MPFROMLONG(BKA_FOREGROUNDMAJORCOLOR));
}


/*@ XNoteBook::SetMinorBackgroundColor(const XColor * col)
@group colors
@remarks Set the backgroundcolor of minor tabs.
@parameters XColor * theColor
*/
void XNoteBook::SetMinorBackgroundColor(const XColor * col) const
{
	WinSendMsg(winhandle, BKM_SETNOTEBOOKCOLORS, MPFROMLONG(col->GetColor()), MPFROMLONG(BKA_BACKGROUNDMINORCOLOR));
}


/*@ XNoteBook::SetMinorForegroundColor(const XColor * col)
@group colors
@remarks Set the foreground color of minor tabs.
@parameters XColor * theColor
*/
void XNoteBook::SetMinorForegroundColor(const XColor * col) const
{
	WinSendMsg(winhandle, BKM_SETNOTEBOOKCOLORS, MPFROMLONG(col->GetColor()), MPFROMLONG(BKA_FOREGROUNDMINORCOLOR));
}


/*@ XNoteBook::GetBackgroundColor(XColor*)
@group colors
@remarks Returns the background color.
@parameters XColor * buffer   buffer to hold the data
*/


/*@ XNoteBook::GetPageCount(void)
@group misc
@remarks Returns the count of pages.
@returns SHORT numberOfPages
*/
SHORT XNoteBook::GetPageCount(void) const
{
	return SHORT1FROMMR(WinSendMsg(winhandle, BKM_QUERYPAGECOUNT, (MPARAM) 0, (MPARAM) BKA_END));
}

