From a6052817bb8cc906c8fc1dc801f8f21c58041f92 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Tue, 25 Mar 2008 12:22:08 +0000 Subject: [PATCH] prototype fixes (in particular fix missing default value initializers) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52806 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- interface/bmpbuttn.h | 10 ++-- interface/button.h | 6 +- interface/event.h | 90 +++++++++++++++------------- interface/hyperlink.h | 28 ++++----- interface/notebook.h | 29 ++++----- interface/tglbtn.h | 136 +++++++++++++++++++++--------------------- interface/tipwin.h | 2 +- 7 files changed, 156 insertions(+), 145 deletions(-) diff --git a/interface/bmpbuttn.h b/interface/bmpbuttn.h index 76df95492e..99f137badd 100644 --- a/interface/bmpbuttn.h +++ b/interface/bmpbuttn.h @@ -108,7 +108,7 @@ public: const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW, const wxValidator& validator = wxDefaultValidator, - const wxString& name = "button"); + const wxString& name = wxButtonNameStr); /** Destructor, destroying the button. @@ -121,11 +121,11 @@ public: */ bool Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, - const wxPoint& pos, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator, - const wxString& name = "button"); + long style = wxBU_AUTODRAW, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); //@{ /** diff --git a/interface/button.h b/interface/button.h index a6c07f3fe3..5cc9bad0f7 100644 --- a/interface/button.h +++ b/interface/button.h @@ -86,7 +86,7 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, - const wxString& name = "button"); + const wxString& name = wxButtonNameStr); /** Destructor, destroying the button. @@ -102,8 +102,8 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator, - const wxString& name = "button"); + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); /** Returns the default size for the buttons. It is advised to make all the dialog diff --git a/interface/event.h b/interface/event.h index 22fab0484e..5e92102e33 100644 --- a/interface/event.h +++ b/interface/event.h @@ -165,12 +165,12 @@ public: /** Returns the X position (in client coordinates) of the event. */ - long GetX() const; + wxCoord GetX() const; /** Returns the Y (in client coordinates) position of the event. */ - long GetY() const; + wxCoord GetY() const; /** Returns @true if either CTRL or ALT keys was down @@ -774,7 +774,7 @@ public: /** Returns @true if the Alt key was down at the time of the event. */ - bool AltDown(); + bool AltDown() const; /** Returns @true if the event was a first extra button double click. @@ -848,7 +848,7 @@ public: check if any button was pressed */ - bool Button(int button); + bool Button(int button) const; /** If the argument is omitted, this returns @true if the event was a mouse @@ -856,7 +856,7 @@ public: was generated (see Button() for the possible values). */ - bool ButtonDClick(int but = wxMOUSE_BTN_ANY); + bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const; /** If the argument is omitted, this returns @true if the event was a mouse @@ -864,7 +864,7 @@ public: was generated (see Button() for the possible values). */ - bool ButtonDown(int but = -1); + bool ButtonDown(int = wxMOUSE_BTN_ANY) const; /** If the argument is omitted, this returns @true if the event was a mouse @@ -872,7 +872,7 @@ public: was generated (see Button() for the possible values). */ - bool ButtonUp(int but = -1); + bool ButtonUp(int = wxMOUSE_BTN_ANY) const; /** Same as MetaDown() under Mac, same as @@ -885,20 +885,20 @@ public: /** Returns @true if the control key was down at the time of the event. */ - bool ControlDown(); + bool ControlDown() const; /** Returns @true if this was a dragging event (motion while a button is depressed). @see Moving() */ - bool Dragging(); + bool Dragging() const; /** Returns @true if the mouse was entering the window. See also Leaving(). */ - bool Entering(); + bool Entering() const; /** Returns the mouse button which generated this event or @c wxMOUSE_BTN_NONE @@ -966,12 +966,12 @@ public: /** Returns X coordinate of the physical mouse event position. */ - long GetX() const; + wxCoord GetX() const; /** Returns Y coordinate of the physical mouse event position. */ - long GetY(); + wxCoord GetY() const; /** Returns @true if the event was a mouse button event (not necessarily a button @@ -1247,13 +1247,13 @@ public: Returns client data pointer for a listbox or choice selection event (not valid for a deselection). */ - void* GetClientData(); + void* GetClientData() const; /** Returns client object pointer for a listbox or choice selection event (not valid for a deselection). */ - wxClientData* GetClientObject(); + wxClientData* GetClientObject() const; /** Returns extra information dependant on the event objects type. @@ -1263,26 +1263,26 @@ public: multiple-selection boxes, and in this case the index and string values are indeterminate and the listbox must be examined by the application. */ - long GetExtraLong(); + long GetExtraLong() const; /** Returns the integer identifier corresponding to a listbox, choice or radiobox selection (only if the event was a selection, not a deselection), or a boolean value representing the value of a checkbox. */ - int GetInt(); + int GetInt() const; /** Returns item index for a listbox or choice selection event (not valid for a deselection). */ - int GetSelection(); + int GetSelection() const; /** Returns item string for a listbox or choice selection event (not valid for a deselection). */ - wxString GetString(); + wxString GetString() const; /** This method can be used with checkbox and menu events: for the checkboxes, the @@ -1299,7 +1299,7 @@ public: For a listbox or similar event, returns @true if it is a selection, @false if it is a deselection. */ - bool IsSelection(); + bool IsSelection() const; /** Sets the client data for this event. @@ -1405,7 +1405,7 @@ public: If the event originated from a keyboard event, the value returned from this function will be wxDefaultPosition. */ - wxPoint GetPosition() const; + const wxPoint& GetPosition() const; /** Sets the position at which the menu should be shown. @@ -1642,11 +1642,21 @@ public: class wxHelpEvent : public wxCommandEvent { public: + // how was this help event generated? + enum Origin + { + Origin_Unknown, // unrecognized event source + Origin_Keyboard, // event generated from F1 key press + Origin_HelpButton // event from [?] button on the title bar (Windows) + }; + /** Constructor. */ - wxHelpEvent(WXTYPE eventType = 0, wxWindowID id = 0, - const wxPoint& point); + wxHelpEvent(wxEventType type = wxEVT_NULL, + wxWindowID winid = 0, + const wxPoint& pt = wxDefaultPosition, + Origin origin = Origin_Unknown); /** Returns the origin of the help event which is one of the following values: @@ -1671,20 +1681,20 @@ public: @see SetOrigin() */ - wxHelpEvent::Origin GetOrigin() const; + Origin GetOrigin() const; /** Returns the left-click position of the mouse, in screen coordinates. This allows the application to position the help appropriately. */ - const wxPoint GetPosition() const; + const wxPoint& GetPosition() const; /** Set the help event origin, only used internally by wxWidgets normally. @see GetOrigin() */ - void SetOrigin(wxHelpEvent::Origin origin); + void SetOrigin(Origin); /** Sets the left-click position of the mouse, in screen coordinates. @@ -2045,7 +2055,7 @@ public: force the application to exit, and so this function must be called to check this. */ - bool CanVeto(); + bool CanVeto() const; /** Returns @true if the user is just logging off or @false if the system is @@ -2067,7 +2077,7 @@ public: /** Sets the 'logging off' flag. */ - void SetLoggingOff(bool loggingOff) const; + void SetLoggingOff(bool loggingOff); /** Call this from your event handler to veto a system shutdown or to signal @@ -2168,14 +2178,14 @@ public: Note that the @a win window @b must remain alive until the wxEventBlocker object destruction. */ - wxEventBlocker(wxWindow* win, wxEventType type = wxEVT_ANY); + wxEventBlocker(wxWindow* win, wxEventType = -0x000000001); /** Destructor. The blocker will remove itself from the chain of event handlers for the window provided in the constructor, thus restoring normal processing of events. */ - ~wxEventBlocker(); + virtual ~wxEventBlocker(); /** Adds to the list of event types which should be blocked the given @e eventType. @@ -2217,7 +2227,7 @@ public: unlink itself and restore the previous and next handlers so that they point to each other. */ - ~wxEvtHandler(); + virtual ~wxEvtHandler(); /** This function posts an event to be processed later. @@ -2324,7 +2334,7 @@ public: @see SetClientData() */ - void* GetClientData(); + void* GetClientData() const; /** Get a pointer to the user-supplied client data object. @@ -2338,7 +2348,7 @@ public: @see SetEvtHandlerEnabled() */ - bool GetEvtHandlerEnabled(); + bool GetEvtHandlerEnabled() const; /** Gets the pointer to the next handler in the chain. @@ -2347,7 +2357,7 @@ public: SetPreviousHandler(), wxWindow::PushEventHandler, wxWindow::PopEventHandler */ - wxEvtHandler* GetNextHandler(); + wxEvtHandler* GetNextHandler() const; /** Gets the pointer to the previous handler in the chain. @@ -2356,7 +2366,7 @@ public: SetNextHandler(), wxWindow::PushEventHandler, wxWindow::PopEventHandler */ - wxEvtHandler* GetPreviousHandler(); + wxEvtHandler* GetPreviousHandler() const; /** Processes an event, searching event tables and calling zero or more suitable @@ -2570,19 +2580,19 @@ public: implementing the Clone function is to implement a copy constructor for a new event (call it MyEvent) and then define the Clone function like this: */ - virtual wxEvent* Clone() const; + virtual wxEvent* Clone() const = 0; /** Returns the object (usually a window) associated with the event, if any. */ - wxObject* GetEventObject(); + wxObject* GetEventObject() const; /** Returns the identifier of the given event type, such as @c wxEVT_COMMAND_BUTTON_CLICKED. */ - wxEventType GetEventType(); + wxEventType GetEventType() const; /** Returns the identifier associated with this event, such as a button command id. @@ -2600,7 +2610,7 @@ public: only differences between the timestamps and not their absolute values usually make sense). */ - long GetTimestamp(); + long GetTimestamp() const; /** Returns @true if the event is or is derived from @@ -2633,7 +2643,7 @@ public: /** Sets the timestamp for the event. */ - void SetTimestamp(long timeStamp); + void SetTimestamp(long = 0); /** Test if this event should be propagated or not, i.e. if the propagation level @@ -2753,7 +2763,7 @@ public: /** Returns a reference to the cursor specified by this event. */ - wxCursor GetCursor() const; + const wxCursor& GetCursor() const; /** Returns the X coordinate of the mouse in client coordinates. diff --git a/interface/hyperlink.h b/interface/hyperlink.h index 5421ca0e0c..8dc59863ac 100644 --- a/interface/hyperlink.h +++ b/interface/hyperlink.h @@ -79,6 +79,17 @@ public: class wxHyperlinkCtrl : public wxControl { public: + /** + Constructor. See Create() for more info. + */ + wxHyperLink(wxWindow* parent, wxWindowID id, + const wxString& label, + const wxString& url, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHL_DEFAULT_STYLE, + const wxString& name = "hyperlink"); + /** Creates the hyperlink control. @@ -107,7 +118,7 @@ public: const wxString& url, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style, + long style = wxHL_DEFAULT_STYLE, const wxString& name = "hyperlink"); /** @@ -132,7 +143,7 @@ public: Returns @true if the hyperlink has already been clicked by the user at least one time. */ - bool GetVisited() const; + virtual bool GetVisited() const = 0; /** Returns the colour used to print the label when the mouse is not over the @@ -163,7 +174,7 @@ public: /** Marks the hyperlink as visited (see wxHyperlinkCtrl::SetVisitedColour). */ - void SetVisited(bool visited = true); + virtual void SetVisited(bool visited = true) = 0; /** Sets the colour used to print the label when the mouse is not over the control @@ -171,16 +182,5 @@ public: visited). */ void SetVisitedColour(const wxColour& colour); - - /** - Constructor. See Create() for more info. - */ - wxHyperLink(wxWindow* parent, wxWindowID id, - const wxString& label, - const wxString& url, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style, - const wxString& name = "hyperlink"); }; diff --git a/interface/notebook.h b/interface/notebook.h index c4c630df11..43a91dc98c 100644 --- a/interface/notebook.h +++ b/interface/notebook.h @@ -147,7 +147,7 @@ public: /** Destroys the wxNotebook object. */ - ~wxNotebook(); + virtual ~wxNotebook(); /** Adds a new page. @@ -192,7 +192,7 @@ public: This is the only difference with SetSelection(). See @ref overview_progevent "this topic" for more info. */ - int ChangeSelection(size_t page); + virtual int ChangeSelection(size_t page); /** Creates a notebook control. See wxNotebook() for a description @@ -200,13 +200,14 @@ public: */ bool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, - const wxSize& size, long style = 0, + const wxSize& size = wxDefaultSize, + long style = 0, const wxString& name = wxNotebookNameStr); /** Deletes all pages. */ - bool DeleteAllPages(); + virtual bool DeleteAllPages(); /** Deletes the specified page, and the associated window. @@ -239,17 +240,17 @@ public: /** Returns the image index for the given page. */ - int GetPageImage(size_t nPage) const; + virtual int GetPageImage(size_t nPage) const; /** Returns the string for the given page. */ - wxString GetPageText(size_t nPage) const; + virtual wxString GetPageText(size_t nPage) const; /** Returns the number of rows in the notebook control. */ - int GetRowCount() const; + virtual int GetRowCount() const; /** Returns the currently selected page, or -1 if none was selected. @@ -259,7 +260,7 @@ public: wxNotebookEvent::GetSelection should be used instead in this case. */ - int GetSelection() const; + virtual int GetSelection() const; /** If running under Windows and themes are enabled for the application, this @@ -268,7 +269,7 @@ public: can be passed to @c SetBackgroundColour. Otherwise, an uninitialised colour will be returned. */ - wxColour GetThemeBackgroundColour() const; + virtual wxColour GetThemeBackgroundColour() const; /** Returns the index of the tab at the specified position or @c wxNOT_FOUND @@ -341,7 +342,7 @@ public: @returns Returns the zero-based tab index or wxNOT_FOUND if there is no tab is at the specified position. */ - int HitTest(const wxPoint& pt, long flags = NULL); + virtual int HitTest(const wxPoint& pt, long* = NULL) const; /** Inserts a new page at the specified position. @@ -398,18 +399,18 @@ public: Sets the image index for the given page. @a image is an index into the image list which was set with SetImageList(). */ - bool SetPageImage(size_t page, int image); + virtual bool SetPageImage(size_t page, int image); /** Sets the width and height of the pages. @b NB: This method is currently not implemented for wxGTK. */ - void SetPageSize(const wxSize& size); + virtual void SetPageSize(const wxSize& size); /** Sets the text for the given page. */ - bool SetPageText(size_t page, const wxString& text); + virtual bool SetPageText(size_t page, const wxString& text); /** Sets the selection for the given page, returning the previous selection. @@ -419,6 +420,6 @@ public: @see GetSelection() */ - int SetSelection(size_t page); + virtual int SetSelection(size_t page); }; diff --git a/interface/tglbtn.h b/interface/tglbtn.h index 05dc33d08b..9a31b188c5 100644 --- a/interface/tglbtn.h +++ b/interface/tglbtn.h @@ -6,71 +6,6 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// -/** - @class wxBitmapToggleButton - @wxheader{tglbtn.h} - - wxBitmapToggleButton is a wxToggleButton - that contains a bitmap instead of text. - - This control emits an update UI event. - - @beginEventTable - @event{EVT_TOGGLEBUTTON(id, func)}: - Handles a toggle button click event. - @endEventTable - - @library{wxcore} - @category{ctrl} - @appearance{bitmaptogglebutton.png} -*/ -class wxBitmapToggleButton : public wxControl -{ -public: - //@{ - /** - Constructor, creating and showing a toggle button with the bitmap @e label. - Internally calls Create(). - */ - wxBitmapToggleButton(); - wxBitmapToggleButton(wxWindow* parent, wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& val, - const wxString& name = "checkBox"); - //@} - - /** - Create method for two-step construction. - */ - bool Create(wxWindow* parent, wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& val, - const wxString& name = "checkBox"); - - /** - Gets the state of the toggle button. - - @returns Returns @true if it is pressed, @false otherwise. - */ - bool GetValue() const; - - /** - Sets the toggle button to the given state. This does not cause a - @c EVT_TOGGLEBUTTON event to be emitted. - - @param state - If @true, the button is pressed. - */ - void SetValue(bool state); -}; - - /** @class wxToggleButton @@ -130,14 +65,14 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& val, + const wxValidator& val = wxDefaultValidator, const wxString& name = "checkBox"); //@} /** Destructor, destroying the toggle button. */ - ~wxToggleButton(); + virtual ~wxToggleButton(); /** Creates the toggle button for two-step construction. See wxToggleButton() @@ -148,7 +83,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& val, + const wxValidator& val = wxDefaultValidator, const wxString& name = "checkBox"); /** @@ -168,3 +103,68 @@ public: void SetValue(bool state); }; + +/** + @class wxBitmapToggleButton + @wxheader{tglbtn.h} + + wxBitmapToggleButton is a wxToggleButton + that contains a bitmap instead of text. + + This control emits an update UI event. + + @beginEventTable + @event{EVT_TOGGLEBUTTON(id, func)}: + Handles a toggle button click event. + @endEventTable + + @library{wxcore} + @category{ctrl} + @appearance{bitmaptogglebutton.png} +*/ +class wxBitmapToggleButton : public wxControl +{ +public: + //@{ + /** + Constructor, creating and showing a toggle button with the bitmap @e label. + Internally calls Create(). + */ + wxBitmapToggleButton(); + wxBitmapToggleButton(wxWindow* parent, wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& val = wxDefaultValidator, + const wxString& name = "checkBox"); + //@} + + /** + Create method for two-step construction. + */ + bool Create(wxWindow* parent, wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& val = wxDefaultValidator, + const wxString& name = "checkBox"); + + /** + Gets the state of the toggle button. + + @returns Returns @true if it is pressed, @false otherwise. + */ + virtual bool GetValue() const; + + /** + Sets the toggle button to the given state. This does not cause a + @c EVT_TOGGLEBUTTON event to be emitted. + + @param state + If @true, the button is pressed. + */ + virtual void SetValue(bool state); +}; + diff --git a/interface/tipwin.h b/interface/tipwin.h index 63d63a3ed5..ef4a08e2a4 100644 --- a/interface/tipwin.h +++ b/interface/tipwin.h @@ -45,7 +45,7 @@ public: */ wxTipWindow(wxWindow* parent, const wxString& text, wxCoord maxLength = 100, - wxTipWindow** windowPtr, + wxTipWindow** windowPtr = NULL, wxRect* rectBounds = NULL); /** -- 2.45.2