1 /*-*- c++ -*-********************************************************
2 * wxLwindow.h : a scrolled Window for displaying/entering rich text*
4 * (C) 1998, 1999 by Karsten Ballüder (Ballueder@usa.net) *
7 *******************************************************************/
9 // ===========================================================================
11 // ===========================================================================
13 // ----------------------------------------------------------------------------
15 // ----------------------------------------------------------------------------
18 # pragma implementation "wxlwindow.h"
21 #include "wx/wxprec.h"
32 # include "gui/wxMenuDefs.h"
33 # include "gui/wxMApp.h"
35 # include "gui/wxlwindow.h"
36 # include "gui/wxlparser.h"
39 # include <wx/msw/private.h>
42 # include "wxlwindow.h"
43 # include "wxlparser.h"
46 #include <wx/clipbrd.h>
47 #include <wx/textctrl.h>
48 #include <wx/dataobj.h>
50 #ifdef WXLAYOUT_USE_CARET
51 # include <wx/caret.h>
52 #endif // WXLAYOUT_USE_CARET
56 // ----------------------------------------------------------------------------
58 // ----------------------------------------------------------------------------
61 # define WXLO_DEBUG(x) wxLogDebug x
63 # define WXLO_DEBUG(x)
66 // ----------------------------------------------------------------------------
68 // ----------------------------------------------------------------------------
70 /// offsets to put a nice frame around text
71 #define WXLO_XOFFSET 4
72 #define WXLO_YOFFSET 4
74 /// offset to the right and bottom for when to redraw scrollbars
75 #define WXLO_ROFFSET 20
76 #define WXLO_BOFFSET 20
78 /// the size of one scrollbar page in pixels
79 static const int X_SCROLL_PAGE
= 10;
80 static const int Y_SCROLL_PAGE
= 20;
82 // ----------------------------------------------------------------------------
84 // ----------------------------------------------------------------------------
86 BEGIN_EVENT_TABLE(wxLayoutWindow
,wxScrolledWindow
)
87 EVT_PAINT (wxLayoutWindow::OnPaint
)
88 EVT_CHAR (wxLayoutWindow::OnChar
)
89 EVT_KEY_UP (wxLayoutWindow::OnKeyUp
)
90 EVT_LEFT_DOWN(wxLayoutWindow::OnLeftMouseClick
)
91 EVT_RIGHT_DOWN(wxLayoutWindow::OnRightMouseClick
)
92 EVT_LEFT_DCLICK(wxLayoutWindow::OnMouseDblClick
)
93 EVT_MOTION (wxLayoutWindow::OnMouseMove
)
94 EVT_MENU_RANGE(WXLOWIN_MENU_FIRST
, WXLOWIN_MENU_LAST
, wxLayoutWindow::OnMenu
)
95 EVT_SET_FOCUS(wxLayoutWindow::OnSetFocus
)
96 EVT_KILL_FOCUS(wxLayoutWindow::OnKillFocus
)
99 // ===========================================================================
101 // ===========================================================================
103 // ----------------------------------------------------------------------------
105 // ----------------------------------------------------------------------------
107 wxLayoutWindow::wxLayoutWindow(wxWindow
*parent
)
108 : wxScrolledWindow(parent
, -1,
109 wxDefaultPosition
, wxDefaultSize
,
110 wxHSCROLL
| wxVSCROLL
|
115 SetStatusBar(NULL
); // don't use statusbar
117 m_doSendEvents
= false;
118 m_ViewStartX
= 0; m_ViewStartY
= 0;
119 m_DoPopupMenu
= true;
120 m_PopupMenu
= MakeFormatMenu();
121 m_memDC
= new wxMemoryDC
;
122 m_bitmap
= new wxBitmap(4,4);
123 m_bitmapSize
= wxPoint(4,4);
124 m_llist
= new wxLayoutList();
127 m_ScrollToCursor
= false;
129 wxPoint max
= m_llist
->GetSize();
130 SetScrollbars(X_SCROLL_PAGE
, Y_SCROLL_PAGE
,
131 max
.x
/ X_SCROLL_PAGE
+ 1, max
.y
/ Y_SCROLL_PAGE
+ 1);
132 EnableScrolling(true, true);
133 m_maxx
= max
.x
+ X_SCROLL_PAGE
;
134 m_maxy
= max
.y
+ Y_SCROLL_PAGE
;
137 #ifdef WXLAYOUT_USE_CARET
138 // FIXME cursor size shouldn't be hardcoded
139 wxCaret
*caret
= new wxCaret(this, 2, 20);
141 m_llist
->SetCaret(caret
);
143 #endif // WXLAYOUT_USE_CARET
145 SetCursorVisibility(-1);
146 SetCursor(wxCURSOR_IBEAM
);
150 wxLayoutWindow::~wxLayoutWindow()
152 delete m_memDC
; // deletes bitmap automatically (?)
156 SetBackgroundBitmap(NULL
);
160 wxLayoutWindow::Clear(int family
,
168 GetLayoutList()->Clear(family
,size
,style
,weight
,underline
,fg
,bg
);
169 SetBackgroundColour(GetLayoutList()->GetDefaults()->GetBGColour());
170 ResizeScrollbars(true);
174 DoPaint((wxRect
*)NULL
);
178 wxLayoutWindow::OnMouse(int eventId
, wxMouseEvent
& event
)
180 wxClientDC
dc( this );
182 if ( eventId
!= WXLOWIN_MENU_MOUSEMOVE
)
184 // moving the mouse in a window shouldn't give it the focus!
189 findPos
.x
= dc
.DeviceToLogicalX(event
.GetX());
190 findPos
.y
= dc
.DeviceToLogicalY(event
.GetY());
192 findPos
.x
-= WXLO_XOFFSET
;
193 findPos
.y
-= WXLO_YOFFSET
;
195 if(findPos
.x
< 0) findPos
.x
= 0;
196 if(findPos
.y
< 0) findPos
.y
= 0;
198 m_ClickPosition
= wxPoint(event
.GetX(), event
.GetY());
202 wxLayoutObject
*obj
= m_llist
->FindObjectScreen(dc
, findPos
,
204 wxLayoutObject::UserData
*u
= obj
? obj
->GetUserData() : NULL
;
206 //has the mouse only been moved?
207 if(eventId
== WXLOWIN_MENU_MOUSEMOVE
)
209 // found is only true if we are really over an object, not just
211 if(found
&& u
&& ! m_Selecting
)
214 SetCursor(wxCURSOR_HAND
);
216 if(m_StatusBar
&& m_StatusFieldLabel
!= -1)
218 const wxString
&label
= u
->GetLabel();
220 m_StatusBar
->SetStatusText(label
,
227 SetCursor(wxCURSOR_IBEAM
);
228 m_HandCursor
= FALSE
;
229 if(m_StatusBar
&& m_StatusFieldLabel
!= -1)
230 m_StatusBar
->SetStatusText("", m_StatusFieldLabel
);
232 if(event
.LeftIsDown())
236 m_llist
->StartSelection();
242 m_llist
->ContinueSelection(cursorPos
);
246 if(m_Selecting
&& ! event
.LeftIsDown())
248 m_llist
->EndSelection(cursorPos
);
256 // always move cursor to mouse click:
257 if(eventId
== WXLOWIN_MENU_LCLICK
)
259 m_llist
->MoveCursorTo(cursorPos
);
261 // Calculate where the top of the visible area is:
265 GetScrollPixelsPerUnit(&dx
, &dy
);
268 wxPoint
offset(-x0
+WXLO_XOFFSET
, -y0
+WXLO_YOFFSET
);
269 m_llist
->UpdateCursorScreenPos(dc
, true, offset
);
271 if(m_CursorVisibility
== -1)
272 m_CursorVisibility
= 1;
274 // VZ: this should be unnecessary because mouse can only click on a
275 // visible part of the canvas
281 DoPaint(FALSE
); // DoPaint suppresses flicker under GTK
285 if(!m_doSendEvents
) // nothing to do
291 // only do the menu if activated, editable and not on a clickable object
292 if(eventId
== WXLOWIN_MENU_RCLICK
294 && (! obj
|| u
== NULL
))
296 PopupMenu(m_PopupMenu
, m_ClickPosition
.x
, m_ClickPosition
.y
);
302 // find the object at this position
305 wxCommandEvent
commandEvent(wxEVT_COMMAND_MENU_SELECTED
, eventId
);
306 commandEvent
.SetEventObject( this );
307 commandEvent
.SetClientData((char *)obj
);
308 GetEventHandler()->ProcessEvent(commandEvent
);
313 * Some simple keyboard handling.
316 wxLayoutWindow::OnChar(wxKeyEvent
& event
)
318 int keyCode
= event
.KeyCode();
320 #ifdef WXLAYOUT_DEBUG
321 if(keyCode
== WXK_F1
)
328 if(! m_Selecting
&& event
.ShiftDown())
341 m_llist
->StartSelection();
348 // If needed, make cursor visible:
349 if(m_CursorVisibility
== -1)
350 m_CursorVisibility
= 1;
352 /* These two nested switches work like this:
353 The first one processes all non-editing keycodes, to move the
354 cursor, etc. It's default will process all keycodes causing
355 modifications to the buffer, but only if editing is allowed.
357 bool ctrlDown
= event
.ControlDown();
362 m_llist
->MoveCursorWord(1);
364 m_llist
->MoveCursorHorizontally(1);
368 m_llist
->MoveCursorWord(-1);
370 m_llist
->MoveCursorHorizontally(-1);
373 m_llist
->MoveCursorVertically(-1);
376 m_llist
->MoveCursorVertically(1);
379 m_llist
->MoveCursorVertically(-Y_SCROLL_PAGE
);
382 m_llist
->MoveCursorVertically(Y_SCROLL_PAGE
);
386 m_llist
->MoveCursorTo(wxPoint(0, 0));
388 m_llist
->MoveCursorToBeginOfLine();
392 m_llist
->MoveCursorTo(m_llist
->GetSize());
394 m_llist
->MoveCursorToEndOfLine();
398 if(keyCode
== 'c' && ctrlDown
)
400 // this should work even in read-only mode
403 else if( IsEditable() )
405 /* First, handle control keys */
406 if(event
.ControlDown() && ! event
.AltDown())
418 m_llist
->DeleteLines(1);
420 case 'h': // like backspace
421 if(m_llist
->MoveCursorHorizontally(-1)) m_llist
->Delete(1);
424 m_llist
->DeleteToBeginOfLine();
427 m_llist
->DeleteToEndOfLine();
435 #ifdef WXLAYOUT_DEBUG
437 m_llist
->SetFont(-1,-1,-1,-1,true); // underlined
445 else if( event
.AltDown() && ! event
.ControlDown() )
451 m_llist
->DeleteWord();
458 else if ( ! event
.AltDown() && ! event
.ControlDown())
463 if(event
.ShiftDown())
467 if(event
.ShiftDown())
472 case WXK_BACK
: // backspace
473 if(m_llist
->MoveCursorHorizontally(-1)) m_llist
->Delete(1);
477 m_llist
->WrapLine(m_WrapMargin
);
478 m_llist
->LineBreak();
481 if((!(event
.ControlDown() || event
.AltDown() || event
.MetaDown()))
482 && (keyCode
< 256 && keyCode
>= 32)
485 if(m_WrapMargin
> 0 && isspace(keyCode
))
486 m_llist
->WrapLine(m_WrapMargin
);
487 m_llist
->Insert((char)keyCode
);
498 if(event
.ShiftDown())
499 m_llist
->ContinueSelection();
502 m_llist
->EndSelection();
507 // we must call ResizeScrollbars() before ScrollToCursor(), otherwise the
508 // ne cursor position might be outside the current scrolllbar range
512 // refresh the screen
513 DoPaint(m_llist
->GetUpdateRect());
517 wxLayoutWindow::OnKeyUp(wxKeyEvent
& event
)
519 if(event
.KeyCode() == WXK_SHIFT
&& m_llist
->IsSelecting())
521 m_llist
->EndSelection();
529 wxLayoutWindow::ScrollToCursor(void)
531 wxClientDC
dc( this );
534 int x0
,y0
,x1
,y1
, dx
, dy
;
536 // Calculate where the top of the visible area is:
538 GetScrollPixelsPerUnit(&dx
, &dy
);
541 WXLO_DEBUG(("ScrollToCursor: ViewStart is %d/%d", x0
, y0
));
543 // Get the size of the visible window:
544 GetClientSize(&x1
,&y1
);
546 // notice that the client size may be (0, 0)...
547 wxASSERT(x1
>= 0 && y1
>= 0);
549 // VZ: I think this is false - if you do it here, ResizeScrollbars() won't
550 // call SetScrollbars() later
552 // As we have the values anyway, use them to avoid unnecessary scrollbar
554 if(x1
> m_maxx
) m_maxx
= x1
;
555 if(y1
> m_maxy
) m_maxy
= y1
;
558 // Make sure that the scrollbars are at a position so that the cursor is
559 // visible if we are editing
560 WXLO_DEBUG(("m_ScrollToCursor = %d", (int) m_ScrollToCursor
));
561 wxPoint cc
= m_llist
->GetCursorScreenPos(*m_memDC
);
563 // the cursor should be completely visible in both directions
564 wxPoint
cs(m_llist
->GetCursorSize());
567 if ( cc
.x
< x0
|| cc
.x
>= x0
+ x1
- cs
.x
)
574 if ( cc
.y
< y0
|| cc
.y
>= y0
+ y1
- cs
.y
)
581 if ( nx
!= -1 || ny
!= -1 )
583 // set new view start
584 Scroll(nx
== -1 ? -1 : (nx
+dx
-1)/dx
, ny
== -1 ? -1 : (ny
+dy
-1)/dy
);
587 m_ScrollToCursor
= false;
592 wxLayoutWindow::OnPaint( wxPaintEvent
&WXUNUSED(event
))
594 wxRect region
= GetUpdateRegion().GetBox();
595 InternalPaint(®ion
);
599 wxLayoutWindow::DoPaint(const wxRect
*updateRect
)
602 InternalPaint(updateRect
);
604 Refresh(FALSE
, updateRect
); // Causes bad flicker under wxGTK!!!
606 if ( !::UpdateWindow(GetHwnd()) )
607 wxLogLastError("UpdateWindow");
612 wxLayoutWindow::InternalPaint(const wxRect
*updateRect
)
614 wxPaintDC
dc( this );
617 #ifdef WXLAYOUT_USE_CARET
618 // hide the caret before drawing anything
620 #endif // WXLAYOUT_USE_CARET
622 int x0
,y0
,x1
,y1
, dx
, dy
;
624 // Calculate where the top of the visible area is:
626 GetScrollPixelsPerUnit(&dx
, &dy
);
629 // Get the size of the visible window:
630 GetClientSize(&x1
,&y1
);
636 WXLO_DEBUG(("Update rect: %ld,%ld / %ld,%ld",
637 updateRect
->x
, updateRect
->y
,
638 updateRect
->x
+updateRect
->width
,
639 updateRect
->y
+updateRect
->height
));
646 /* Check whether the window has grown, if so, we need to reallocate
647 the bitmap to be larger. */
648 if(x1
> m_bitmapSize
.x
|| y1
> m_bitmapSize
.y
)
650 wxASSERT(m_bitmapSize
.x
> 0);
651 wxASSERT(m_bitmapSize
.y
> 0);
653 m_memDC
->SelectObject(wxNullBitmap
);
655 m_bitmapSize
= wxPoint(x1
,y1
);
656 m_bitmap
= new wxBitmap(x1
,y1
);
657 m_memDC
->SelectObject(*m_bitmap
);
660 m_memDC
->SetDeviceOrigin(0,0);
661 m_memDC
->SetBrush(wxBrush(m_llist
->GetDefaults()->GetBGColour(),wxSOLID
));
662 m_memDC
->SetPen(wxPen(m_llist
->GetDefaults()->GetBGColour(),
664 m_memDC
->SetLogicalFunction(wxCOPY
);
666 /* Either fill the background with the background bitmap, or clear
672 w
= m_BGbitmap
->GetWidth(),
673 h
= m_BGbitmap
->GetHeight();
674 for(y
= 0; y
< y1
; y
+=h
)
675 for(x
= 0; x
< x1
; x
+=w
)
676 m_memDC
->DrawBitmap(*m_BGbitmap
, x
, y
);
677 m_memDC
->SetBackgroundMode(wxTRANSPARENT
);
681 // clear the background: (must not be done if we use the update rectangle!)
682 m_memDC
->SetBackgroundMode(wxSOLID
);
683 m_memDC
->DrawRectangle(0,0,x1
, y1
);
687 /* This is the important bit: we tell the list to draw itself: */
691 WXLO_DEBUG(("Update rect: %ld,%ld / %ld,%ld",
692 updateRect
->x
, updateRect
->y
,
693 updateRect
->x
+updateRect
->width
,
694 updateRect
->y
+updateRect
->height
));
698 // Device origins on the memDC are suspect, we translate manually
699 // with the translate parameter of Draw().
700 wxPoint
offset(-x0
+WXLO_XOFFSET
,-y0
+WXLO_YOFFSET
);
701 m_llist
->Draw(*m_memDC
,offset
, y0
, y0
+y1
);
703 // We start calculating a new update rect before drawing the
704 // cursor, so that the cursor coordinates get included in the next
705 // update rectangle (although they are drawn on the memDC, this is
706 // needed to erase it):
707 m_llist
->InvalidateUpdateRect();
708 if(m_CursorVisibility
!= 0)
710 m_llist
->UpdateCursorScreenPos(dc
, true, offset
);
711 m_llist
->DrawCursor(*m_memDC
,
712 m_HaveFocus
&& IsEditable(), // draw a thick
713 // cursor for editable windows with focus
717 // Now copy everything to the screen:
719 // This somehow doesn't work, but even the following bit with the
720 // whole rect at once is still a bit broken I think.
721 wxRegionIterator
ri ( GetUpdateRegion() );
725 WXLO_DEBUG(("UpdateRegion: %ld,%ld, %ld,%ld",
726 ri
.GetX(),ri
.GetY(),ri
.GetW(),ri
.GetH()));
727 dc
.Blit(x0
+ri
.GetX(),y0
+ri
.GetY(),ri
.GetW(),ri
.GetH(),
728 m_memDC
,ri
.GetX(),ri
.GetY(),wxCOPY
,FALSE
);
734 // FIXME: Trying to copy only the changed parts, but it does not seem
736 // x0 = updateRect->x; y0 = updateRect->y;
737 // if(updateRect->height < y1)
738 // y1 = updateRect->height;
739 // y1 += WXLO_YOFFSET; //FIXME might not be needed
740 dc
.Blit(x0
,y0
,x1
,y1
,m_memDC
,0,0,wxCOPY
,FALSE
);
743 #ifdef WXLAYOUT_USE_CARET
744 // show the caret back after everything is redrawn
746 #endif // WXLAYOUT_USE_CARET
749 m_ScrollToCursor
= false;
751 if ( m_StatusBar
&& m_StatusFieldCursor
!= -1 )
753 static wxPoint
s_oldCursorPos(-1, -1);
755 wxPoint
pos(m_llist
->GetCursorPos());
757 // avoid unnecessary status bar refreshes
758 if ( pos
!= s_oldCursorPos
)
760 s_oldCursorPos
= pos
;
763 label
.Printf(_("Ln:%d Col:%d"), pos
.y
+ 1, pos
.x
+ 1);
764 m_StatusBar
->SetStatusText(label
, m_StatusFieldCursor
);
769 // change the range and position of scrollbars
771 wxLayoutWindow::ResizeScrollbars(bool exact
)
773 wxPoint max
= m_llist
->GetSize();
775 WXLO_DEBUG(("ResizeScrollbars: max size = (%ld, %ld)",
776 (long int)max
.x
, (long int) max
.y
));
778 if( max
.x
> m_maxx
- WXLO_ROFFSET
|| max
.y
> m_maxy
- WXLO_BOFFSET
|| exact
)
782 // add an extra bit to the sizes to avoid future updates
783 max
.x
+= WXLO_ROFFSET
;
784 max
.y
+= WXLO_BOFFSET
;
787 ViewStart(&m_ViewStartX
, &m_ViewStartY
);
788 SetScrollbars(X_SCROLL_PAGE
, Y_SCROLL_PAGE
,
789 max
.x
/ X_SCROLL_PAGE
+ 1, max
.y
/ Y_SCROLL_PAGE
+ 1,
790 m_ViewStartX
, m_ViewStartY
,
793 m_maxx
= max
.x
+ X_SCROLL_PAGE
;
794 m_maxy
= max
.y
+ Y_SCROLL_PAGE
;
799 wxLayoutWindow::Paste(void)
802 if (wxTheClipboard
->Open())
804 #if wxUSE_PRIVATE_CLIPBOARD_FORMAT
805 wxLayoutDataObject wxldo
;
806 if (wxTheClipboard
->IsSupported( wxldo
.GetFormat() ))
808 wxTheClipboard
->GetData(&wxldo
);
811 //FIXME: missing functionality m_llist->Insert(wxldo.GetList());
816 wxTextDataObject data
;
817 if (wxTheClipboard
->IsSupported( data
.GetFormat() ))
819 wxTheClipboard
->GetData(&data
);
820 wxString text
= data
.GetText();
821 wxLayoutImportText( m_llist
, text
);
824 wxTheClipboard
->Close();
828 /* My attempt to get the primary selection, but it does not
830 if(text
.Length() == 0)
832 wxTextCtrl
tmp_tctrl(this,-1);
834 text
+= tmp_tctrl
.GetValue();
840 wxLayoutWindow::Copy(bool invalidate
)
842 // Calling GetSelection() will automatically do an EndSelection()
843 // on the list, but we need to take a note of it, too:
847 m_llist
->EndSelection();
850 wxLayoutDataObject wldo
;
851 wxLayoutList
*llist
= m_llist
->GetSelection(&wldo
, invalidate
);
854 // Export selection as text:
856 wxLayoutExportObject
*export
;
857 wxLayoutExportStatus
status(llist
);
858 while((export
= wxLayoutExport( &status
, WXLO_EXPORT_AS_TEXT
)) != NULL
)
860 if(export
->type
== WXLO_EXPORT_TEXT
)
861 text
<< *(export
->content
.text
);
866 // The exporter always appends a newline, so we chop it off if it
869 size_t len
= text
.Length();
870 if(len
> 2 && text
[len
-2] == '\r') // Windows
871 text
= text
.Mid(0,len
-2);
872 else if(len
> 1 && text
[len
-1] == '\n')
873 text
= text
.Mid(0,len
-1);
877 if (wxTheClipboard
->Open())
879 wxTextDataObject
*data
= new wxTextDataObject( text
);
880 bool rc
= wxTheClipboard
->SetData( data
);
881 #if wxUSE_PRIVATE_CLIPBOARD_FORMAT
882 rc
|= wxTheClipboard
->AddData( &wldo
);
884 wxTheClipboard
->Close();
892 wxLayoutWindow::Cut(void)
894 if(Copy(false)) // do not invalidate selection after copy
896 m_llist
->DeleteSelection();
903 wxLayoutWindow::Find(const wxString
&needle
,
908 if(fromWhere
== NULL
)
909 found
= m_llist
->FindText(needle
, m_llist
->GetCursorPos());
911 found
= m_llist
->FindText(needle
, *fromWhere
);
919 m_llist
->MoveCursorTo(found
);
927 wxLayoutWindow::MakeFormatMenu()
929 wxMenu
*m
= new wxMenu(_("Layout Menu"));
931 m
->Append(WXLOWIN_MENU_LARGER
,_("&Larger"),_("Switch to larger font."), false);
932 m
->Append(WXLOWIN_MENU_SMALLER
,_("&Smaller"),_("Switch to smaller font."), false);
933 m
->AppendSeparator();
934 m
->Append(WXLOWIN_MENU_UNDERLINE_ON
, _("&Underline on"),_("Activate underline mode."), false);
935 m
->Append(WXLOWIN_MENU_UNDERLINE_OFF
,_("&Underline off"),_("Deactivate underline mode."), false);
936 m
->Append(WXLOWIN_MENU_BOLD_ON
,_("&Bold on"),_("Activate bold mode."), false);
937 m
->Append(WXLOWIN_MENU_BOLD_OFF
,_("&Bold off"),_("Deactivate bold mode."), false);
938 m
->Append(WXLOWIN_MENU_ITALICS_ON
,_("&Italics on"),_("Activate italics mode."), false);
939 m
->Append(WXLOWIN_MENU_ITALICS_OFF
,_("&Italics off"),_("Deactivate italics mode."), false);
940 m
->AppendSeparator();
941 m
->Append(WXLOWIN_MENU_ROMAN
,_("&Roman"),_("Switch to roman font."), false);
942 m
->Append(WXLOWIN_MENU_TYPEWRITER
,_("&Typewriter"),_("Switch to typewriter font."), false);
943 m
->Append(WXLOWIN_MENU_SANSSERIF
,_("&Sans Serif"),_("Switch to sans serif font."), false);
947 void wxLayoutWindow::OnMenu(wxCommandEvent
& event
)
949 switch (event
.GetId())
951 case WXLOWIN_MENU_LARGER
:
952 m_llist
->SetFontLarger(); break;
953 case WXLOWIN_MENU_SMALLER
:
954 m_llist
->SetFontSmaller(); break;
955 case WXLOWIN_MENU_UNDERLINE_ON
:
956 m_llist
->SetFontUnderline(true); break;
957 case WXLOWIN_MENU_UNDERLINE_OFF
:
958 m_llist
->SetFontUnderline(false); break;
959 case WXLOWIN_MENU_BOLD_ON
:
960 m_llist
->SetFontWeight(wxBOLD
); break;
961 case WXLOWIN_MENU_BOLD_OFF
:
962 m_llist
->SetFontWeight(wxNORMAL
); break;
963 case WXLOWIN_MENU_ITALICS_ON
:
964 m_llist
->SetFontStyle(wxITALIC
); break;
965 case WXLOWIN_MENU_ITALICS_OFF
:
966 m_llist
->SetFontStyle(wxNORMAL
); break;
967 case WXLOWIN_MENU_ROMAN
:
968 m_llist
->SetFontFamily(wxROMAN
); break;
969 case WXLOWIN_MENU_TYPEWRITER
:
970 m_llist
->SetFontFamily(wxFIXED
); break;
971 case WXLOWIN_MENU_SANSSERIF
:
972 m_llist
->SetFontFamily(wxSWISS
); break;
977 wxLayoutWindow::OnSetFocus(wxFocusEvent
&ev
)
984 wxLayoutWindow::OnKillFocus(wxFocusEvent
&ev
)