Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move SeparatorLine to separate source files.

  • Loading branch information...
commit f9c5dd3638832877d76f0d439641d9945154a498 1 parent 14913e2
@adamv adamv authored
View
35 src/SearchPanel.cpp
@@ -21,6 +21,7 @@
#include "eSettings.h"
#include "CloseButton.h"
+#include "SeparatorLine.h"
#include "images/search_png.h"
#include "images/search_re_png.h"
@@ -92,7 +93,7 @@ SearchPanel::SearchPanel(IFrameSearchService& searchService, wxWindow* parent, w
m_popupMenu.Check(PMENU_HIGHLIGHT, m_highlight);
// Create the controls
- sepline = new SeperatorLine(this, -1);
+ SeperatorLine* sepline = new SeperatorLine(this, -1);
closeButton = new CloseButton(this, SEARCH_CLOSE);
wxStaticText *searchlabel = new wxStaticText(this, -1, _("Search: "));
@@ -477,38 +478,6 @@ void SearchPanel::UpdateReplaceHistory() {
}
}
-
-// -- SeperatorLine -----------------------------------------------------------------
-
-BEGIN_EVENT_TABLE(SearchPanel::SeperatorLine, wxControl)
- EVT_PAINT(SearchPanel::SeperatorLine::OnPaint)
- EVT_ERASE_BACKGROUND(SearchPanel::SeperatorLine::OnEraseBackground)
-END_EVENT_TABLE()
-
-SearchPanel::SeperatorLine::SeperatorLine(wxWindow* parent, wxWindowID id, const wxPoint& pos)
-: wxControl(parent, id, pos, wxSize(10, 2)) {
- // Make sure sizers min/max height are fixed to 2 pixels
- SetSizeHints(-1, 2, -1, 2);
-}
-
-void SearchPanel::SeperatorLine::OnPaint(wxPaintEvent& WXUNUSED(evt)) {
- wxPaintDC dc(this);
- // Get view dimensions
- wxSize size = GetClientSize();
- wxPen darkPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID);
- wxPen lightPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHILIGHT), 1, wxSOLID);
-
- dc.SetPen(darkPen);
- dc.DrawLine(0, 0, size.x, 0);
-
- dc.SetPen(lightPen);
- dc.DrawLine(0, 1, size.x, 1);
-}
-
-// no evt.Skip() as we don't want the background to be erased
-void SearchPanel::SeperatorLine::OnEraseBackground(wxEraseEvent& WXUNUSED(event)) {}
-
-
// -- SearchEvtHandler -----------------------------------------------------------------
BEGIN_EVENT_TABLE(SearchPanel::SearchEvtHandler, wxEvtHandler)
View
15 src/SearchPanel.h
@@ -17,7 +17,6 @@
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include <wx/panel.h>
- #include <wx/control.h>
#include <wx/string.h>
#include <wx/menu.h>
#include <wx/bitmap.h>
@@ -55,19 +54,6 @@ class SearchPanel : public wxPanel {
IEditorSearch* GetEditorSearch();
private:
- // Embedded class: SeperatorLine
- class SeperatorLine : public wxControl {
- public:
- SeperatorLine(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition);
- private:
- // overriden base class virtuals
- virtual bool AcceptsFocus() const { return FALSE; }
- // Event handlers
- void OnPaint(wxPaintEvent& evt);
- void OnEraseBackground(wxEraseEvent& event);
- DECLARE_EVENT_TABLE();
- };
-
// Embedded class: SearchEvtHandler
class SearchEvtHandler : public wxEvtHandler {
public:
@@ -117,7 +103,6 @@ class SearchPanel : public wxPanel {
wxBoxSizer* box;
wxBoxSizer* vbox;
wxComboBox* searchbox;
- SeperatorLine* sepline;
wxButton* nextButton;
wxButton* prevButton;
wxButton* replaceButton;
View
37 src/SeparatorLine.cpp
@@ -0,0 +1,37 @@
+#include "SeparatorLine.h"
+
+#include "wx/wxprec.h"
+#ifndef WX_PRECOMP
+ #include <wx/dcclient.h>
+#endif
+
+BEGIN_EVENT_TABLE(SeperatorLine, wxControl)
+ EVT_PAINT(SeperatorLine::OnPaint)
+ EVT_ERASE_BACKGROUND(SeperatorLine::OnEraseBackground)
+END_EVENT_TABLE()
+
+bool SeperatorLine::AcceptsFocus() const { return FALSE; }
+
+SeperatorLine::SeperatorLine(wxWindow* parent, wxWindowID id, const wxPoint& pos):
+ wxControl(parent, id, pos, wxSize(10, 2))
+{
+ // Make sure sizers min/max height are fixed to 2 pixels
+ SetSizeHints(-1, 2, -1, 2);
+}
+
+void SeperatorLine::OnPaint(wxPaintEvent& WXUNUSED(evt)) {
+ wxPaintDC dc(this);
+ // Get view dimensions
+ wxSize size = GetClientSize();
+ wxPen darkPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID);
+ wxPen lightPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHILIGHT), 1, wxSOLID);
+
+ dc.SetPen(darkPen);
+ dc.DrawLine(0, 0, size.x, 0);
+
+ dc.SetPen(lightPen);
+ dc.DrawLine(0, 1, size.x, 1);
+}
+
+// no evt.Skip() as we don't want the background to be erased
+void SeperatorLine::OnEraseBackground(wxEraseEvent& WXUNUSED(event)) {}
View
20 src/SeparatorLine.h
@@ -0,0 +1,20 @@
+#ifndef __SEPARATORLINE_H__
+#define __SEPARATORLINE_H__
+
+#include <wx/control.h>
+
+class SeperatorLine : public wxControl {
+public:
+ SeperatorLine(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition);
+
+private:
+ // overriden base class virtuals
+ virtual bool AcceptsFocus() const;
+
+ // Event handlers
+ void OnPaint(wxPaintEvent& evt);
+ void OnEraseBackground(wxEraseEvent& event);
+ DECLARE_EVENT_TABLE();
+};
+
+#endif
View
8 src/e.vcproj
@@ -3546,6 +3546,14 @@
>
</File>
<File
+ RelativePath=".\SeparatorLine.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\SeparatorLine.h"
+ >
+ </File>
+ <File
RelativePath="ShellContextMenu.cpp"
>
<FileConfiguration
Please sign in to comment.
Something went wrong with that request. Please try again.