Skip to content

Commit

Permalink
Added: PrintDocument and PrintPreviewControl properties
Browse files Browse the repository at this point in the history
  • Loading branch information
XusinboyBekchanov committed Feb 27, 2024
1 parent 402e4fc commit 731838e
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
21 changes: 21 additions & 0 deletions mff/PrintDocument.bas
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
#include once "PrintDocument.bi"

Namespace My.Sys.ComponentModel
#ifndef ReadProperty_Off
Private Function PrintDocument.ReadProperty(PropertyName As String) As Any Ptr
Select Case LCase(PropertyName)
Case "documentname": Return DocumentName.vptr
Case "printersettings": Return @PrinterSettings
Case Else: Return Base.ReadProperty(PropertyName)
End Select
Return 0
End Function
#endif

#ifndef WriteProperty_Off
Private Function PrintDocument.WriteProperty(PropertyName As String, Value As Any Ptr) As Boolean
Select Case LCase(PropertyName)
Case "documentname": DocumentName = QWString(Value)
Case Else: Return Base.WriteProperty(PropertyName, Value)
End Select
Return True
End Function
#endif

Private Constructor PrintDocumentPage
WLet(FClassName, "PrintDocumentPage")
End Constructor
Expand Down
6 changes: 6 additions & 0 deletions mff/PrintDocument.bi
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ Namespace My.Sys.ComponentModel
Declare Sub Paint(hwnd As HWND, hdcDestination As HDC, ByVal PageNumber As Integer)
#endif
Public:
#ifndef ReadProperty_Off
Declare Function ReadProperty(PropertyName As String) As Any Ptr
#endif
#ifndef WriteProperty_Off
Declare Function WriteProperty(PropertyName As String, Value As Any Ptr) As Boolean
#endif
DocumentName As UString
Pages As PrintDocumentPages
PrinterSettings As Printer
Expand Down
12 changes: 12 additions & 0 deletions mff/PrintPreviewControl.bas
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ Namespace My.Sys.Forms
#ifndef ReadProperty_Off
Private Function PrintPreviewControl.ReadProperty(PropertyName As String) As Any Ptr
Select Case LCase(PropertyName)
Case "currentpage": Return @FCurrentPage
Case "document": Return Document
Case "orientation": Return @FOrientation
Case "pagelength": Return @FPageLength
Case "pagewidth": Return @FPageWidth
Case "tabindex": Return @FTabIndex
Case "zoom": Return @FZoom
Case Else: Return Base.ReadProperty(PropertyName)
End Select
Return 0
Expand All @@ -20,7 +26,13 @@ Namespace My.Sys.Forms
#ifndef WriteProperty_Off
Private Function PrintPreviewControl.WriteProperty(PropertyName As String, Value As Any Ptr) As Boolean
Select Case LCase(PropertyName)
Case "currentpage": CurrentPage = QInteger(Value)
Case "document": Document = Value
Case "orientation": Orientation = *Cast(PrinterOrientation Ptr, Value)
Case "pagelength": PageLength = QInteger(Value)
Case "pagewidth": PageWidth = QInteger(Value)
Case "tabindex": TabIndex = QInteger(Value)
Case "zoom": Zoom = QInteger(Value)
Case Else: Return Base.WriteProperty(PropertyName, Value)
End Select
Return True
Expand Down
6 changes: 6 additions & 0 deletions mff/mff.bi
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@
#include once "Pen.bi"
#include once "Picture.bi"
#include once "PrintDialog.bi"
#include once "PrintDocument.bi"
#include once "PrintPreviewControl.bi"
#include once "PrintPreviewDialog.bi"
#include once "Printer.bi"
#include once "ProgressBar.bi"
Expand Down Expand Up @@ -172,6 +174,7 @@ Using My.Sys.Forms
Case "pagescroller": Ctrl = _New( PageScroller)
Case "panel": Ctrl = _New( Panel)
Case "picture": Ctrl = _New( Picture)
Case "printpreviewcontrol": Ctrl = _New(PrintPreviewControl)
Case "progressbar": Ctrl = _New( ProgressBar)
Case "radiobutton": Ctrl = _New( RadioButton)
Case "rebar": Ctrl = _New( ReBar)
Expand Down Expand Up @@ -227,6 +230,7 @@ Using My.Sys.Forms
Case "savefiledialog": Cpnt = _New( SaveFileDialog)
Case "pagesetupdialog": Cpnt = _New( PageSetupDialog)
Case "printdialog": Cpnt = _New( PrintDialog)
Case "printdocument": Cpnt = _New(PrintDocument)
Case "printpreviewdialog": Cpnt = _New( PrintPreviewDialog)
Case "printer": Cpnt = _New( Printer)
Case Else: Cpnt = CreateControl(ClassName, sName, sName, lLeft, lTop, 10, 10, Parent)
Expand Down Expand Up @@ -289,6 +293,8 @@ Using My.Sys.Forms
Case "pagescroller": _Delete( Cast(PageScroller Ptr, Ctrl))
Case "pagesetupdialog": _Delete( Cast(PageSetupDialog Ptr, Ctrl))
Case "printdialog": _Delete( Cast(PrintDialog Ptr, Ctrl))
Case "printdocument": _Delete( Cast(PrintDocument Ptr, Ctrl))
Case "printpreviewcontrol": _Delete( Cast(PrintPreviewControl Ptr, Ctrl))
Case "printpreviewdialog": _Delete( Cast(PrintPreviewDialog Ptr, Ctrl))
Case "printer": _Delete( Cast(Printer Ptr, Ctrl))
Case "openfilecontrol": _Delete( Cast(OpenFileControl Ptr, Ctrl))
Expand Down

0 comments on commit 731838e

Please sign in to comment.