Example #1
0
        /*! \brief Return information on a string.
         * \param [in] fontHandle Handle of font to use (0 for current handle) if
         * \b PlotType.GivenFont (bit 8) of flags set.
         * \param [in] str String to scan
         * \param [in] flags Plot type
         * \param [in] offset Offset of mouse click
         * \param [in,out] coordBlock Coordinate block for input if \b Font.PlotType.GivenBlock (bit 5)
         * of flags set and output if \b PlotType.ReturnBBox (bit 18) set, otherwise \b null.
         * \param [in,out] matrix Transformation matrix for input if \b PlotType.GivenMatrix (bit 6)
         * of flags set and output if \b PlotType.ReturnMatrix (bit 19) set, otherwise \b null.
         * \param [in] length Length of string to scan - if \b PlotType.GivenLength (bit 7) of flags set
         * \param [out] offsetReturn x,y coordinate offset to caret position -
         * if \b PlotType.ReturnCaretPos (bit 17) of flags set; else to split point,
         * or end of string if splitting not required
         * \param [out] splitCount Number of split characters encountered -
         * if \b PlotType.ReturnSplitCount (bit 20) of flags set
         * \return Index of point in string of caret position - if \b PlotType.ReturnCaretPos
         * (bit 17) of flags is set; else of split point, or of end of string if splitting
         * not required.  */
        public static int ScanString(IntPtr fontHandle,
                                     string str,
                                     PlotType flags,
                                     OS.Coord offset,
                                     Font.ScanCoordBlock coordBlock,
                                     OS.Matrix matrix,
                                     int length,
                                     OS.Coord offsetReturn,
                                     out int splitCount)
        {
            int result_index;

            OS.ThrowOnError(NativeMethods.Font_ScanString(fontHandle,
                                                          str,
                                                          flags,
                                                          offset.X,
                                                          offset.Y,
                                                          coordBlock,
                                                          matrix,
                                                          length,
                                                          out result_index,
                                                          out offsetReturn.X,
                                                          out offsetReturn.Y,
                                                          out splitCount));
            return(result_index);
        }
Example #2
0
 /*! \brief Convert a rectangle from screen to window when the window's origin
  * is already known.
  * \param [in] rect The rectangle to convert in screen coordinates.
  * \param [in] origin The origin of the window in screen coordinates.
  * \return The converted rectangle in window coordinates.
  * \note The original rectangle is left unchanged. */
 public OS.Rect RectangleToWorkArea(OS.Rect rect, OS.Coord origin)
 {
     return(new OS.Rect(rect.MinX - origin.X,
                        rect.MinY - origin.Y,
                        rect.MaxX - origin.X,
                        rect.MaxY - origin.Y));
 }
Example #3
0
            /*! \brief Open nested window. */
            public void OpenNested(OS.Rect visible,
                                   OS.Coord scroll,
                                   uint behindWindow,
                                   uint parentWindow,
                                   uint nestedFlags,
                                   uint windowFlags)
            {
                // Make sure bit 0 of nested flags is set correctly depending on whether
                // window flags are supplied.
                if (windowFlags == 0xffffffff)
                {
                    nestedFlags &= (~1U);
                    windowFlags  = 0;
                }
                else
                {
                    nestedFlags |= 1;
                }

                var block = new NativeWimp.WindowStateBlock(WimpWindow.Handle,
                                                            visible,
                                                            scroll,
                                                            behindWindow,
                                                            windowFlags);

                Wimp.OpenWindowNested(ref block, parentWindow, nestedFlags);
            }
Example #4
0
            /*! \brief Read details about a font.
             * \param[out] size x,y point size x 16 (in 1/16ths point)
             * \param[out] res x,y resolution (dots per inch)
             * \param[out] age Age of font
             * \param[out] usageCount Usage count of font
             * \returns Font identifier */
            public string ReadFullDefn(OS.Coord size,
                                       OS.Coord res,
                                       out int age,
                                       out int usageCount)
            {
                int buffer_size;

                OS.ThrowOnError(NativeMethods.Font_ReadIdentifier(Handle,
                                                                  null,
                                                                  out buffer_size));

                StringBuilder buffer = new StringBuilder(buffer_size);

                OS.ThrowOnError(NativeMethods.Font_ReadFullDefn(Handle,
                                                                buffer,
                                                                out size.X,
                                                                out size.Y,
                                                                out res.X,
                                                                out res.Y,
                                                                out age,
                                                                out usageCount));


                return(buffer.ToString());
            }
Example #5
0
 /*! \brief Create a ScanCoordBlock with default values. */
 public ScanCoordBlock()
 {
     Space       = new OS.Coord();
     Letter      = new OS.Coord();
     SplitChar   = -1;
     BoundingBox = new OS.Rect();
 }
Example #6
0
                public SubMenuEventArgs(IntPtr unmanagedEventData) : base(unmanagedEventData)
                {
                    int x = Marshal.ReadInt32(RawEventData, EventOffset.SubMenuX);
                    int y = Marshal.ReadInt32(RawEventData, EventOffset.SubMenuY);

                    Position = new OS.Coord(x, y);
                }
Example #7
0
 /*! \brief Convert a rectangle from window to screen when the window's origin
  * is already known.
  * \param [in] rect The rectangle to convert in window coordinates.
  * \param [in] origin The origin of the window in screen coordinates.
  * \return The converted rectangle in screen coordinates.
  * \note The original rectangle is left unchanged. */
 public OS.Rect RectangleToScreen(OS.Rect rect, OS.Coord origin)
 {
     return(new OS.Rect(rect.MinX + origin.X,
                        rect.MinY + origin.Y,
                        rect.MaxX + origin.X,
                        rect.MaxY + origin.Y));
 }
Example #8
0
                /*! \brief Create the arguments for a DragEnd event from the raw event data.  */
                public DragEndEventArgs(IntPtr unmanagedEventBlock) : base(unmanagedEventBlock)
                {
                    uint flags     = Header.Flags;
                    uint window_id = (uint)Marshal.ReadInt32(RawEventData, EventOffset.Window);
                    int  icon_id   = Marshal.ReadInt32(RawEventData, EventOffset.Icon);

                    if ((flags & Flags.ToolboxIDs) != 0)
                    {
                        ToolboxWindow    = Object.CreateInstance <Window> (window_id);
                        ToolboxCmpID     = (uint)icon_id;
                        WimpWindowHandle = 0;
                        WimpIconHandle   = -1;
                    }
                    else
                    {
                        ToolboxWindow    = null;
                        ToolboxCmpID     = 0xffffffff;
                        WimpWindowHandle = window_id;
                        WimpIconHandle   = icon_id;
                    }

                    int x = Marshal.ReadInt32(RawEventData, EventOffset.MouseX);
                    int y = Marshal.ReadInt32(RawEventData, EventOffset.MouseY);

                    MousePosition = new OS.Coord(x, y);
                }
Example #9
0
 /*! \brief Create a PaintCoordBlock */
 public PaintCoordBlock(OS.Coord space,
                        OS.Coord letter,
                        OS.Rect rubOut)
 {
     Space  = space;
     Letter = letter;
     RubOut = rubOut;
 }
Example #10
0
        /*! \brief Convert OS coordinates to internal coordinates
         * \param[in] os x,y coordinates in OS units
         * \returns New OS.Coord in millipoints */
        public static OS.Coord ConvertToPoints(OS.Coord os)
        {
            int points_x, points_y;

            OS.ThrowOnError(NativeMethods.Font_ConvertToPoints(os.X, os.Y,
                                                               out points_x, out points_y));

            return(new OS.Coord(points_x, points_y));
        }
Example #11
0
        /*! \brief Convert internal coordinates to OS coordinates
         * \param[in] points x,y coordinates in millipoints
         * \returns New OS.Coord in OS units */
        public static OS.Coord ConvertToOS(OS.Coord points)
        {
            int os_x, os_y;

            OS.ThrowOnError(NativeMethods.Font_ConvertToOS(points.X, points.Y,
                                                           out os_x, out os_y));

            return(new OS.Coord(os_x, os_y));
        }
Example #12
0
 /*! \brief Create a full show object specification from the details given.
  *
  * Assumes that window nesting is not required, and so assumes default values for
  * nesting parameters.  */
 public ShowObjectFull(OS.Rect visible,
                       OS.Coord scroll) : base(ShowObjectType.FullSpec)
 {
     Visible            = visible;
     Scroll             = scroll;
     StackPosition      = Wimp.WindowStackPosition.Top;
     WindowFlags        = 0;
     ParentWindowHandle = 0;
     AlignmentFlags     = 0;
 }
Example #13
0
 /*! \brief Create a ScanCoordBlock */
 public ScanCoordBlock(OS.Coord space,
                       OS.Coord letter,
                       int splitChar,
                       OS.Rect boundingBox)
 {
     Space       = space;
     Letter      = letter;
     SplitChar   = splitChar;
     BoundingBox = boundingBox;
 }
Example #14
0
            /*! \brief Open a normal window (no nesting) */
            public void Open(OS.Rect visible,
                             OS.Coord scroll,
                             uint behind)
            {
                var block = new NativeWimp.WindowStateBlock(WimpWindow.Handle,
                                                            visible,
                                                            scroll,
                                                            behind,
                                                            0);                  // Flags are ignored on a normal window open

                Wimp.OpenWindow(ref block);
            }
Example #15
0
 /*! \brief Open nested window using the window flags it already has. */
 public void OpenNested(OS.Rect visible,
                        OS.Coord scroll,
                        uint behindWindow,
                        uint parentWindow,
                        uint nestedFlags)
 {
     OpenNested(visible,
                scroll,
                behindWindow,
                parentWindow,
                nestedFlags,
                0xffffffff);                  // Use the window's existing flags.
 }
Example #16
0
 /*! \brief Create a full show object specification from the details given.
  *
  * Allows access to full window nesting parameters.  */
 public ShowObjectFull(OS.Rect visible,
                       OS.Coord scroll,
                       uint stackPosition,
                       uint windowFlags,
                       uint parentWindowHandle,
                       uint alignmentFlags) : base(ShowObjectType.FullSpec)
 {
     Visible            = visible;
     Scroll             = scroll;
     StackPosition      = stackPosition;
     WindowFlags        = windowFlags;
     ParentWindowHandle = parentWindowHandle;
     AlignmentFlags     = alignmentFlags;
 }
Example #17
0
            public uint           Flags;   // Used for nested windows

//			public WindowStateBlock (uint handle)
//			{
//				WindowHandle = handle;
//			}

            public WindowStateBlock(uint handle,
                                    OS.Rect rect,
                                    OS.Coord scroll,
                                    uint behind_window,
                                    uint window_flags)
            {
                WindowHandle = handle;
                Visible.MinX = rect.MinX;
                Visible.MinY = rect.MinY;
                Visible.MaxX = rect.MaxX;
                Visible.MaxY = rect.MaxY;

                Scroll.X = scroll.Y;
                Scroll.Y = scroll.Y;

                BehindWindow = behind_window;
                Flags        = window_flags;
            }
Example #18
0
            /*! \brief Return information on a string.
             * \param[in] str String to scan
             * \param[in] flags Plot type
             * \param[in] offset Offset of mouse click
             * \param[in,out] coordBlock Coordinate block
             * \param[in] length Length of string to scan - if \b PlotType.GivenLength (bit 7) of flags set
             * \param[out] offsetReturn x,y coordinate offset to caret position -
             * if \b PlotType.ReturnCaretPos (bit 17) of flags set; else to split point,
             * or end of string if splitting not required
             * \param[out] splitCount Number of split characters encountered -
             * if \b PlotType.ReturnSplitCount (bit 20) of flags set
             * \return Index of point in string of caret position - if \b PlotType.ReturnCaretPos
             * (bit 17) of flags is set; else of split point, or of end of string if splitting
             * not required.
             *
             * \note
             * Automatically:
             * \li Sets flag bit 5 to indicate coordinate block in use
             * \li Sets flag bit 8 to indicate font handle in use
             * \li Clears flag bits 6 & 19 to indicate transformation matrix not in use.
             *
             * All coordinates must be in millipoints. */
            public int ScanString(string str,
                                  PlotType flags,
                                  OS.Coord offset,
                                  Font.ScanCoordBlock coordBlock,
                                  int length,
                                  OS.Coord offsetReturn,
                                  out int splitCount)
            {
                flags |= PlotType.GivenBlock | PlotType.GivenFont;
                flags &= ~(PlotType.GivenMatrix | PlotType.ReturnMatrix);

                return(Font.ScanString(Handle,
                                       str,
                                       flags,
                                       offset,
                                       coordBlock,
                                       null,
                                       length,
                                       offsetReturn,
                                       out splitCount));
            }
Example #19
0
        /*! \brief Calculate how wide a string would be in the current font
         * \param[in] str String to scan
         * \param[in] max Maximum offset before termination in millipoints
         * \param[in] splitChar Character code of split char
         * \param[in] length Length of string to scan
         * \param[out] splitOffset Offset of split point
         * \param[out] splitCount Number of split characters in string
         * \returns Index into string of the split point
         * \deprecated You should use ScanString in preference */
        public static int StringWidth(string str,
                                      OS.Coord max,
                                      int splitChar,
                                      int length,
                                      OS.Coord splitOffset,
                                      out int splitCount)
        {
            int index;

            OS.ThrowOnError(NativeMethods.Font_StringWidth(str,
                                                           max.X,
                                                           max.Y,
                                                           splitChar,
                                                           length,
                                                           IntPtr.Zero,
                                                           out splitOffset.X,
                                                           out splitOffset.Y,
                                                           out splitCount,
                                                           out index));
            return(index);
        }
Example #20
0
 /*! \brief Create an object that holds details of the current state of
  * the pointer.  */
 public PointerInfo()
 {
     Pos = new OS.Coord();
     Update();
 }
Example #21
0
 /*! \brief Move the caret to the given position in this window.  */
 public void SetCaretPosition(OS.Coord Pos, int height, int index)
 {
     WimpWindow.SetCaretPosition(Pos, height, index);
 }
Example #22
0
 /*! \brief Convert a rectangle from window to screen when the window's origin
  * is already known.
  * \param [in] rect The rectangle to convert in window coordinates.
  * \param [in] origin The origin of the window in screen coordinates.
  * \return The converted rectangle in screen coordinates.
  * \note The original rectangle is left unchanged. */
 public OS.Rect RectangleToScreen(OS.Rect rect, OS.Coord origin)
 {
     return(WimpWindow.RectangleToScreen(rect, origin));
 }
Example #23
0
 /*! \brief Convert a rectangle from screen to window when the window's origin
  * is already known.
  * \param [in] rect The rectangle to convert in screen coordinates.
  * \param [in] origin The origin of the window in screen coordinates.
  * \return The converted rectangle in window coordinates.
  * \note The original rectangle is left unchanged. */
 public OS.Rect RectangleToWorkArea(OS.Rect rect, OS.Coord origin)
 {
     return(WimpWindow.RectangleToWorkArea(rect, origin));
 }
Example #24
0
 /*! \brief Convert a coordinate from window to screen when the window's origin
  * is unknown.
  * \param [in] point The coordinate to convert in window coordinates.
  * \return The converted coordinate in screen coordinates.
  * \note The original coordinate is left unchanged. */
 public OS.Coord PointToScreen(OS.Coord point)
 {
     return(WimpWindow.PointToScreen(point));
 }
Example #25
0
 /*! \brief Convert a coordinate from window to screen when the window's origin
  * is already known.
  * \param [in] point The coordinate to convert in window coordinates.
  * \param [in] origin The origin of the window in screen coordinates.
  * \return The converted coordinate in screen coordinates.
  * \note The original coordinate is left unchanged. */
 public OS.Coord PointToScreen(OS.Coord point, OS.Coord origin)
 {
     return(WimpWindow.PointToScreen(point, origin));
 }
Example #26
0
 /*! \brief Convert a rectangle from screen to window when the window's origin
  * is unknown.
  * \param [in] rect The rectangle to convert in screen coordinates.
  * \return The converted rectangle in window coordinates.
  * \note The original rectangle is left unchanged. */
 public OS.Coord PointToWorkArea(OS.Coord point)
 {
     return(PointToWorkArea(point));
 }
Example #27
0
 /*! \brief Convert a coordinate from screen to window when the window's origin
  * is already known.
  * \param [in] point The coordinate to convert in screen coordinates.
  * \param [in] origin The origin of the window in screen coordinates.
  * \return The converted coordinate in window coordinates.
  * \note The original coordinate is left unchanged. */
 public OS.Coord PointToWorkArea(OS.Coord point, OS.Coord origin)
 {
     return(PointToWorkArea(point, origin));
 }
Example #28
0
 public Coord(OS.Coord coord)
 {
     X = coord.X;
     Y = coord.Y;
 }
Example #29
0
 /*! \brief Create a show object specification from the details given.
  *
  * The top left hand corner of the object will be placed at the coordinate given.  */
 public ShowObjectTopLeft(OS.Coord topLeft) : base(ShowObjectType.TopLeft)
 {
     TopLeft = topLeft;
 }
Example #30
0
 /*! \brief Move the caret to the given position in this window.  */
 public void SetCaretPosition(OS.Coord Pos, int height, int index)
 {
     Wimp.SetCaretPosition(Handle, -1, Pos.X, Pos.Y, height, index);
 }