~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxSmith/propgrid/contrib/include/wx/propgrid/propgrid.h

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#ifndef __WX_PROPGRID_PROPGRID_H__
13
13
#define __WX_PROPGRID_PROPGRID_H__
14
14
 
15
 
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16
 
    #pragma interface "propgrid.cpp"
17
 
#endif
18
 
 
19
15
#include <wx/window.h>
20
16
#include <wx/bitmap.h>
21
17
#include <wx/dcclient.h>
29
25
 
30
26
// NB: Do *NOT * remove this.
31
27
#if defined(SWIG) || defined(SWIG_TYPE_TABLE)
32
 
    #ifndef __WXPYTHON__
 
28
    #if !defined(__WXPYTHON__) && !defined(__NOTWXPYTHON__)
33
29
        #define __WXPYTHON__
34
30
    #endif
35
31
#endif
62
58
 
63
59
 
64
60
//
65
 
// Check some wxUSE_FOOs
 
61
// Check that some wxUSE_FOOs exist
 
62
// (we don't care if they are 1 or 0, just that they exist)
66
63
#ifndef wxUSE_VALIDATORS
67
64
    #error "wxUSE_VALIDATORS not defined"
68
65
#endif
92
89
// for "configure" scripts under unix, use them.
93
90
#define wxPROPGRID_MAJOR          1
94
91
#define wxPROPGRID_MINOR          2
95
 
#define wxPROPGRID_RELEASE        10
 
92
#define wxPROPGRID_RELEASE        12
96
93
 
97
94
// For non-Unix systems (i.e. when building without a configure script),
98
95
// users of this component can use the following macro to check if the
396
393
 
397
394
extern WXDLLIMPEXP_PG const wxChar *wxPropertyGridNameStr;
398
395
 
 
396
 
 
397
#ifdef __WXMSW__
 
398
  #if wxCHECK_VERSION(2,9,0)
 
399
    #define wxPG_GetHDCOf(DC) ((HDC)((const wxMSWDCImpl *)DC.GetImpl())->GetHDC())
 
400
  #else
 
401
    #define wxPG_GetHDCOf(DC) ((HDC)DC.GetHDC())
 
402
  #endif
 
403
#endif
 
404
 
399
405
#endif // #ifndef SWIG
400
406
 
401
407
 
655
661
*/
656
662
#define wxPG_EX_AUTO_UNSPECIFIED_VALUES     0x00200000
657
663
 
 
664
/** Hides page selection buttons from toolbar.
 
665
*/
 
666
#define wxPG_EX_HIDE_PAGE_BUTTONS           0x00400000
 
667
 
658
668
 
659
669
/** Combines various styles.
660
670
*/
1907
1917
    */
1908
1918
    virtual void SetAttribute( int id, wxVariant& value );
1909
1919
 
 
1920
    /** Version of SetAttribute with straight wxVariant argument (SetAttribute
 
1921
        itself cannot be overloaded for this).
 
1922
    */
 
1923
    inline void SetAttrib( int id, wxVariant value )
 
1924
    {
 
1925
        SetAttribute(id,value);
 
1926
    }
1910
1927
 
1911
1928
    /** Adds entry to property's wxPGChoices and editor control (if it is active).
1912
1929
        Returns index of item added.
1942
1959
 
1943
1960
    /** Returns property's name (alternate way to access property). */
1944
1961
    inline const wxString& GetName() const { return m_name; }
1945
 
    inline void DoSetName(const wxString& str) { m_name = str; }
1946
1962
 
1947
1963
    /** If property did not have data extension, one is created now
1948
1964
        (returns true in that case).
2009
2025
        return ( m_flags & flag ) ? true : false;
2010
2026
    }
2011
2027
 
2012
 
    /** Initializes the property. Usually only called in the constructor.
2013
 
    */
2014
 
    void Init( const wxString& label, const wxString& name );
2015
 
 
2016
2028
    /** Returns true if extra children can be added for this property
2017
2029
        (i.e. it is wxPropertyCategory or wxCustomProperty)
2018
2030
    */
2057
2069
        return false;
2058
2070
    }
2059
2071
 
 
2072
    inline unsigned int GetArrIndex() const { return m_arrIndex; }
 
2073
 
2060
2074
    /** Returns last visible sub-property, recursively.
2061
2075
    */
2062
2076
    const wxPGProperty* GetLastVisibleSubItem() const;
2091
2105
    /** Returns number of children (always 0 for normal properties). */
2092
2106
    size_t GetChildCount() const;
2093
2107
 
2094
 
    inline unsigned int GetArrIndex() const { return m_arrIndex; }
2095
 
 
2096
 
    inline unsigned int GetDepth() const { return (unsigned int)m_depth; }
2097
 
 
2098
2108
    /** Returns position in parent's array. */
2099
2109
    inline unsigned int GetIndexInParent() const
2100
2110
    {
2117
2127
    */
2118
2128
    bool RecreateEditor();
2119
2129
 
2120
 
    inline void SetAttrib( int id, wxVariant value )
2121
 
    {
2122
 
        SetAttribute(id,value);
2123
 
    }
2124
 
 
2125
2130
    /** Sets attributes from a comma-delimited string.
2126
2131
    */
2127
2132
    void SetAttributes( const wxString& attributes );
2261
2266
#ifndef SWIG
2262
2267
protected:
2263
2268
 
 
2269
    inline void DoSetName(const wxString& str) { m_name = str; }
 
2270
 
 
2271
    inline unsigned int GetDepth() const { return (unsigned int)m_depth; }
 
2272
 
 
2273
    /** Initializes the property. Usually only called in the constructor.
 
2274
    */
 
2275
    void Init( const wxString& label, const wxString& name );
 
2276
 
2264
2277
    // Called in constructors.
2265
2278
    void Init();
2266
2279
 
2413
2426
    /** This is used by properties that have fixed sub-properties. */
2414
2427
    void AddChild( wxPGProperty* prop );
2415
2428
 
2416
 
    /** This is used by Insert etc. */
2417
 
    void AddChild2( wxPGProperty* prop, int index = -1, bool correct_mode = true );
2418
 
 
2419
2429
    /** Returns number of sub-properties. */
2420
2430
    inline size_t GetCount() const { return m_children.GetCount(); }
2421
2431
 
2455
2465
    // Call for after sub-properties added with AddChild
2456
2466
    void PrepareSubProperties();
2457
2467
 
2458
 
    inline void SetParentState( wxPropertyGridState* pstate ) { m_parentState = pstate; }
2459
 
 
2460
2468
    // Call after fixed sub-properties added/removed after creation.
2461
2469
    // if oldSelInd >= 0 and < new max items, then selection is
2462
2470
    // moved to it.
2464
2472
 
2465
2473
protected:
2466
2474
 
 
2475
    /** This is used by Insert etc. */
 
2476
    void AddChild2( wxPGProperty* prop, int index = -1, bool correct_mode = true );
 
2477
 
 
2478
    inline void SetParentState( wxPropertyGridState* pstate ) { m_parentState = pstate; }
 
2479
 
2467
2480
    wxPropertyGridState*    m_parentState;
2468
2481
 
2469
2482
    wxPGArrayProperty       m_children;
2519
2532
    /** Must be overridden with function that doesn't do anything. */
2520
2533
    virtual wxString GetValueAsString( int argFlags ) const;
2521
2534
 
2522
 
    inline int GetTextExtent() const { return m_textExtent; }
2523
 
 
2524
 
    void CalculateTextExtent( wxWindow* wnd, wxFont& font );
2525
 
 
2526
2535
    void SetTextColIndex( unsigned int colInd ) { m_capFgColIndex = (wxByte) colInd; }
2527
2536
    unsigned int GetTextColIndex() const { return (unsigned int) m_capFgColIndex; }
2528
2537
 
 
2538
    int GetTextExtent( const wxWindow* wnd, const wxFont& font ) const;
 
2539
 
 
2540
    void CalculateTextExtent( wxWindow* wnd, const wxFont& font );
 
2541
 
2529
2542
protected:
 
2543
 
2530
2544
    int     m_textExtent;  // pre-calculated length of text
2531
2545
    wxByte  m_capFgColIndex;  // caption text colour index
2532
2546
};
3063
3077
 
3064
3078
    wxPGId GetNextProperty( wxPGId id ) const;
3065
3079
 
3066
 
    static wxPGId GetNextSibling( wxPGId id );
 
3080
    static wxPGId GetNextSiblingProperty( wxPGId id );
3067
3081
 
3068
 
    static wxPGId GetPrevSibling( wxPGId id );
 
3082
    static wxPGId GetPrevSiblingProperty( wxPGId id );
3069
3083
 
3070
3084
    wxPGId GetPrevProperty( wxPGId id ) const;
3071
3085
 
3400
3414
    }
3401
3415
 
3402
3416
    /** Returns next item under the same parent. */
3403
 
    inline wxPGId GetNextSibling( wxPGId id )
 
3417
    inline wxPGId GetNextSiblingProperty( wxPGId id )
3404
3418
    {
3405
 
        return wxPropertyGridState::GetNextSibling(id);
 
3419
        return wxPropertyGridState::GetNextSiblingProperty(id);
3406
3420
    }
3407
 
    inline wxPGId GetNextSibling( wxPGPropNameStr name )
 
3421
    inline wxPGId GetNextSiblingProperty( wxPGPropNameStr name )
3408
3422
    {
3409
3423
        wxPG_PROP_NAME_CALL_PROLOG_RETVAL(wxNullProperty)
3410
 
        return wxPropertyGridState::GetNextSibling(wxPGIdGen(p));
 
3424
        return wxPropertyGridState::GetNextSiblingProperty(wxPGIdGen(p));
3411
3425
    }
3412
3426
 
3413
3427
    /** Returns comma-delimited string with property's attributes (both
4314
4328
    }
4315
4329
 
4316
4330
#if wxUSE_VALIDATORS
4317
 
    /** Sets validator of a property. For example
4318
 
        \code
4319
 
          // Allow property's value range from -100 to 100
4320
 
          wxIntPropertyValidator validator(-100,100);
4321
 
          wxPGId id = pg->Append( wxIntProperty(wxT("Value 1",wxPG_LABEL,0)) );
4322
 
          pg->SetPropertyValidator( id, validator );
4323
 
        \endcode
 
4331
    /** Sets validator of a property.
4324
4332
    */
4325
4333
    inline void SetPropertyValidator( wxPGId id, const wxValidator& validator )
4326
4334
    {
4528
4536
                else:
4529
4537
                    dict_[p.GetName()] = getter(p)
4530
4538
 
4531
 
                p = self.GetNextSibling(p)
 
4539
                p = self.GetNextSiblingProperty(p)
4532
4540
 
4533
4541
 
4534
4542
        def GetPropertyValues(self,dict_=None,as_strings=False):
4651
4659
                p = self.GetFirstChild(parent)
4652
4660
                while p:
4653
4661
                    self.Delete(p)
4654
 
                    p = self.GetNextSibling(p)
 
4662
                    p = self.GetNextSiblingProperty(p)
4655
4663
 
4656
4664
            if not is_manager or page == self.GetSelectedPage():
4657
4665
                self.Freeze()
4685
4693
        /** Sets property as read-only. It's value cannot be changed by the user, but the
4686
4694
            editor may still be created for copying purposes.
4687
4695
        */
4688
 
        void SetPropertyReadOnly( wxPGId id, bool readOnly = true )
4689
 
        {
4690
 
        wxPG_PROP_ID_CALL_PROLOG()
4691
 
                if ( readOnly )
4692
 
                        p->SetFlag(wxPG_PROP_READONLY);
4693
 
                else
4694
 
                        p->ClearFlag(wxPG_PROP_READONLY);
4695
 
        }
 
4696
        void SetPropertyReadOnly( wxPGId id, bool readOnly = true );
4696
4697
 
4697
4698
        /** Sets property as read-only. It's value cannot be changed by the user, but the
4698
4699
            editor may still be created for copying purposes.
4700
4701
        void SetPropertyReadOnly( wxPGPropNameStr name, bool readOnly = true )
4701
4702
        {
4702
4703
        wxPG_PROP_NAME_CALL_PROLOG()
4703
 
                if ( readOnly )
4704
 
                        p->SetFlag(wxPG_PROP_READONLY);
4705
 
                else
4706
 
                        p->ClearFlag(wxPG_PROP_READONLY);
 
4704
        SetPropertyReadOnly(p, readOnly);
4707
4705
        }
4708
4706
 
4709
4707
    // GetPropertyByNameI With nice assertion error message.
5321
5319
    }
5322
5320
 
5323
5321
    /** Returns id of previous item under the same parent. */
5324
 
    inline wxPGId GetPrevSibling( wxPGId id )
 
5322
    inline wxPGId GetPrevSiblingProperty( wxPGId id )
5325
5323
    {
5326
5324
        wxPG_PROP_ID_CALL_PROLOG_RETVAL(wxNullProperty)
5327
 
        return wxPropertyGridState::GetPrevSibling(id);
 
5325
        return wxPropertyGridState::GetPrevSiblingProperty(id);
5328
5326
    }
5329
 
    inline wxPGId GetPrevSibling( wxPGPropNameStr name )
 
5327
    inline wxPGId GetPrevSiblingProperty( wxPGPropNameStr name )
5330
5328
    {
5331
5329
        wxPG_PROP_NAME_CALL_PROLOG_RETVAL(wxNullProperty)
5332
 
        return wxPropertyGridState::GetPrevSibling(wxPGIdGen(p));
 
5330
        return wxPropertyGridState::GetPrevSiblingProperty(wxPGIdGen(p));
5333
5331
    }
5334
5332
 
5335
5333
    /** Returns id of previous visible property.
6154
6152
        SetDefaultPriority(wxPG_HIGH);
6155
6153
    }
6156
6154
 
6157
 
    /** Property editor widget helper methods. */
6158
 
    //@{
6159
6155
    /** Call when editor widget's contents is modified. For example, this is called
6160
6156
        when changes text in wxTextCtrl (used in wxStringProperty and wxIntProperty).
6161
6157
        \remarks
6293
6289
    void SLAlloc ( unsigned int itemcount, const wxChar** items );
6294
6290
    /** Returns sl. */
6295
6291
    inline wxArrayString& SLGet() { return m_sl; }
6296
 
    //@}
6297
6292
 
6298
6293
    inline long GetInternalFlags() const { return m_iFlags; }
6299
6294
    inline void ClearInternalFlag( long flag ) { m_iFlags &= ~(flag); }
7047
7042
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_PG, wxEVT_PG_ITEM_COLLAPSED,     wxPG_BASE_EVT_PRE_ID+5)
7048
7043
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_PG, wxEVT_PG_ITEM_EXPANDED,      wxPG_BASE_EVT_PRE_ID+6)
7049
7044
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_PG, wxEVT_PG_DOUBLE_CLICK,       wxPG_BASE_EVT_PRE_ID+7)
 
7045
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_PG, wxEVT_PG_COMPACT_MODE_ENTERED,  wxPG_BASE_EVT_PRE_ID+8)
 
7046
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_PG, wxEVT_PG_EXPANDED_MODE_ENTERED, wxPG_BASE_EVT_PRE_ID+9)
7050
7047
END_DECLARE_EVENT_TYPES()
7051
7048
#else
7052
7049
    enum {
7057
7054
        wxEVT_PG_PAGE_CHANGED,
7058
7055
        wxEVT_PG_ITEM_COLLAPSED,
7059
7056
        wxEVT_PG_ITEM_EXPANDED,
7060
 
        wxEVT_PG_DOUBLE_CLICK
 
7057
        wxEVT_PG_DOUBLE_CLICK,
 
7058
        wxEVT_PG_COMPACT_MODE_ENTERED,
 
7059
        wxEVT_PG_EXPANDED_MODE_ENTERED
7061
7060
    };
7062
7061
#endif
7063
7062
 
7077
7076
#define EVT_PG_PAGE_CHANGED(id, fn)          DECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_PAGE_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxPropertyGridEventFunction, & fn ), (wxObject *) NULL ),
7078
7077
#define EVT_PG_ITEM_COLLAPSED(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_ITEM_COLLAPSED, id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxPropertyGridEventFunction, & fn ), (wxObject *) NULL ),
7079
7078
#define EVT_PG_ITEM_EXPANDED(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_ITEM_EXPANDED, id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxPropertyGridEventFunction, & fn ), (wxObject *) NULL ),
 
7079
#define EVT_PG_COMPACT_MODE_ENTERED(id, fn)  DECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COMPACT_MODE_ENTERED, id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxPropertyGridEventFunction, & fn ), (wxObject *) NULL ),
 
7080
#define EVT_PG_EXPANDED_MODE_ENTERED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_EXPANDED_MODE_ENTERED, id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxPropertyGridEventFunction, & fn ), (wxObject *) NULL ),
7080
7081
 
7081
7082
#define wxPropertyGridEventHandler(A) ((wxObjectEventFunction)(wxEventFunction)(wxPropertyGridEventFunction)&A)
7082
7083