1 /* 2 * Copyright (C) 2015-2019, by Laszlo Szeremi under the Boost license. 3 * 4 * Pixel Perfect Engine, concrete.interfaces module 5 */ 6 7 module PixelperfectEngine.concrete.interfaces; 8 9 public import PixelPerfectEngine.graphics.fontsets; 10 public import PixelPerfectEngine.graphics.bitmap; 11 public import PixelPerfectEngine.graphics.common; 12 public import PixelPerfectEngine.concrete.text; 13 14 /** 15 * Radio button interface. Can be used to implement radio button style behavior on almost any component that implements this interface. 16 */ 17 public interface IRadioButton { 18 /** 19 * If the radio button is pressed, then it sets to unpressed. Does nothing otherwise. 20 */ 21 public void latchOff() @trusted; 22 /** 23 * Sets the radio button into its pressed state. 24 */ 25 public void latchOn() @trusted; 26 /** 27 * Returns the current state of the radio button. 28 * True: Pressed. 29 * False: Unpressed. 30 */ 31 public void state() @safe @property const; 32 /** 33 * Sets the group of the radio button. 34 */ 35 public void setGroup(IRadioButtonGroup group) @safe @property; 36 } 37 /** 38 * Implements the basis of a radio button group. 39 */ 40 public interface IRadioButtonGroup { 41 /** 42 * Adds a radio button to the group. 43 */ 44 public void add(IRadioButton rg) @safe; 45 /** 46 * Removes a radio button from the group. 47 */ 48 public void remove(IRadioButton rg) @safe; 49 /** 50 * Groups receive latch signals here. 51 */ 52 public void latch(IRadioButton sender) @safe; 53 } 54 /** 55 * IMPORTANT: This will replace the current drawing methods by version 1.0.0 56 * The older method of using multiple BitmapDrawer class will be removed by that point. 57 * </br> 58 * Implements the frontend of a drawable canvas, primarily for GUI elements. 59 * Mostly limited to 256 colors, certain methods (eg. blitting) might enable more. 60 */ 61 public interface Canvas { 62 ///Draws a line. 63 public void drawLine(int x0, int y0, int x1, int y1, ubyte color, int lineWidth = 1) @trusted; 64 ///Draws an empty rectangle 65 public void drawRectangle(int x0, int y0, int x1, int y1, ubyte color, int lineWidth = 1) @trusted; 66 ///Draws a filled rectangle 67 public void drawFilledRectange(int x0, int y0, int x1, int y1, ubyte color, int lineWidth = 1) @trusted; 68 ///Fills an area with the specified color 69 public void fill(int x0, int y0, ubyte color, ubyte background = 0) @trusted; 70 ///Draws a text with the specified data. Can be multiline. 71 public void drawText(int x0, int y0, Fontset!Bitmap8Bit font, dstring text, ubyte color) @trusted; 72 ///Draws a fully formatted text. Can be multiline. 73 public void drawText(int x0, int y0, Text!Bitmap8Bit text) @trusted; 74 ///Draws a text within the given area with the specified data. Can be multiline. 75 public void drawText(Coordinate c, Fontset!Bitmap8Bit font, dstring text, ubyte color) @trusted; 76 ///Draws a fully formatted text within the specified area. Can be multiline. 77 public void drawText(Coordinate c, Text!Bitmap8Bit text) @trusted; 78 ///Draws a text with the specified data and offset from the upper-left corner. Can be multiline. 79 public void drawText(int x0, int y0, int sliceX, int sliceY, Fontset!Bitmap8Bit font, dstring text, ubyte color) 80 @trusted; 81 ///Draws a fully formatted text with offset from the upper-left corner. Can be multiline. 82 public void drawText(int x0, int y0, int sliceX, int sliceY, Text!Bitmap8Bit text) @trusted; 83 public void drawText(Coordinate c, int sliceX, int sliceY, Fontset!Bitmap8Bit font, dstring text, ubyte color) 84 @trusted; 85 public void drawText(Coordinate c, int sliceX, int sliceY, Text!Bitmap8Bit text) @trusted; 86 public void bitBLiT(int x0, int y0, ABitmap source) @trusted; 87 public void bitBLiT(int x0, int y0, int x1, int y1, ABitmap source) @trusted; 88 public void bitBLiT(int x0, int y0, Coordinate slice, ABitmap source) @trusted; 89 public void xorBLiT(int x0, int y0, int x1, int y1, ubyte color) @trusted; 90 public void xorBLiT(int x0, int y0, ABitmap source) @trusted; 91 }