wxPython / src / _brush.i

/////////////////////////////////////////////////////////////////////////////
// Name:        _brush.i
// Purpose:     SWIG interface for wxPen
//
// Author:      Robin Dunn
//
// Created:     7-July-1997
// RCS-ID:      $Id: _brush.i 65979 2010-11-02 02:39:58Z RD $
// Copyright:   (c) 2003 by Total Control Software
// Licence:     wxWindows license
/////////////////////////////////////////////////////////////////////////////

// Not a %module


//---------------------------------------------------------------------------
%newgroup

enum wxBrushStyle
{
    wxBRUSHSTYLE_INVALID,

    wxBRUSHSTYLE_SOLID,
    wxBRUSHSTYLE_TRANSPARENT,
    wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE,
    wxBRUSHSTYLE_STIPPLE_MASK,
    wxBRUSHSTYLE_STIPPLE,
    wxBRUSHSTYLE_BDIAGONAL_HATCH,
    wxBRUSHSTYLE_CROSSDIAG_HATCH,
    wxBRUSHSTYLE_FDIAGONAL_HATCH,
    wxBRUSHSTYLE_CROSS_HATCH,
    wxBRUSHSTYLE_HORIZONTAL_HATCH,
    wxBRUSHSTYLE_VERTICAL_HATCH,
    wxBRUSHSTYLE_FIRST_HATCH,
    wxBRUSHSTYLE_LAST_HATCH,
};


DocStr(wxBrush,
"A brush is a drawing tool for filling in areas. It is used for
painting the background of rectangles, ellipses, etc. when drawing on
a `wx.DC`.  It has a colour and a style.", "

:warning: Do not create instances of wx.Brush before the `wx.App`
    object has been created because, depending on the platform,
    required internal data structures may not have been initialized
    yet.  Instead create your brushes in the app's OnInit or as they
    are needed for drawing.

:note: On monochrome displays all brushes are white, unless the colour
    really is black.

:see: `wx.BrushList`, `wx.DC`, `wx.DC.SetBrush`
");

MustHaveApp(wxBrush);

class wxBrush : public wxGDIObject {
public:
    DocCtorStr(
        wxBrush(const wxColour& colour, wxBrushStyle style=wxSOLID),
        "Constructs a brush from a `wx.Colour` object and a style.",
        "The style parameter may be one of the following:

    ===================   =============================
    Style                 Meaning
    ===================   =============================
    wx.TRANSPARENT        Transparent (no fill).
    wx.SOLID              Solid.
    wx.STIPPLE            Uses a bitmap as a stipple.
    wx.BDIAGONAL_HATCH    Backward diagonal hatch.
    wx.CROSSDIAG_HATCH    Cross-diagonal hatch.
    wx.FDIAGONAL_HATCH    Forward diagonal hatch.
    wx.CROSS_HATCH        Cross hatch.
    wx.HORIZONTAL_HATCH   Horizontal hatch.
    wx.VERTICAL_HATCH     Vertical hatch.
    ===================   =============================

:see: `wx.BrushFromBitmap`
");

    DocCtorStrName(
        wxBrush(const wxBitmap& stippleBitmap),
        "Constructs a stippled brush using a bitmap.", "",
        BrushFromBitmap);

    ~wxBrush();


    DocDeclStr(
        virtual void , SetColour(const wxColour& col),
        "Set the brush's `wx.Colour`.", "");

    DocDeclStr(
        virtual void , SetStyle(wxBrushStyle style),
        "Sets the style of the brush. See `__init__` for a listing of styles.", "");

    DocDeclStr(
        virtual void , SetStipple(const wxBitmap& stipple),
        "Sets the stipple `wx.Bitmap`.", "");


    DocDeclStr(
        wxColour , GetColour() const,
        "Returns the `wx.Colour` of the brush.", "");

    DocDeclStr(
        wxBrushStyle , GetStyle() const,
        "Returns the style of the brush.  See `__init__` for a listing of
styles.", "");

    DocDeclStr(
        wxBitmap *, GetStipple() const,
        "Returns the stiple `wx.Bitmap` of the brush.  If the brush does not
have a wx.STIPPLE style, then the return value may be non-None but an
uninitialised bitmap (`wx.Bitmap.Ok` returns False).", "");

    
    DocDeclStr(
        bool , IsHatch() const,
        "Is the current style a hatch type?", "");

    bool IsTransparent() const;
    bool IsNonTransparent() const;


    DocDeclStr(
        bool , IsOk(),
        "Returns True if the brush is initialised and valid.", "");
    %pythoncode { Ok = IsOk }


#ifdef __WXMAC__
//     short MacGetTheme();

     %pythoncode { def MacSetTheme(self, macThemeBrush): self.SetColour(wx.Colour(macThemeBrush)) }
#endif

    %pythoncode { def __nonzero__(self): return self.IsOk() }

    %property(Colour, GetColour, SetColour, doc="See `GetColour` and `SetColour`");
    %property(Stipple, GetStipple, SetStipple, doc="See `GetStipple` and `SetStipple`");
    %property(Style, GetStyle, SetStyle, doc="See `GetStyle` and `SetStyle`");

};

//---------------------------------------------------------------------------
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.