comparison dynamin/gui/windows_window.d @ 55:c138461bf845

Add focusing and other changes that are related like descendantAdded/Removed events, Window.activated event, and updating List. Window.state was also added, even though focusing does not depend on it.
author Jordan Miner <jminer7@gmail.com>
date Sat, 08 Aug 2009 15:42:27 -0500
parents 2a194d52fdb5
children 8dac206ea523
comparison
equal deleted inserted replaced
54:3738a2d0bac3 55:c138461bf845
189 auto g = new Graphics(cr); 189 auto g = new Graphics(cr);
190 cairo_destroy(cr); 190 cairo_destroy(cr);
191 return g; 191 return g;
192 } 192 }
193 void backend_visible(bool b) { 193 void backend_visible(bool b) {
194 //if not created, create the handle by calling Handle() 194 if(b)
195 ShowWindow(handle, b ? SW_SHOW : SW_HIDE); 195 // visible has been set to true by now...use state() to show window
196 backend_state = _state;
197 else
198 //if not created, create the handle by calling handle()
199 ShowWindow(handle, SW_HIDE);
200 }
201 void backend_state(WindowState s) {
202 if(!visible)
203 return;
204 //if not created, create the handle by calling handle()
205 if(s == WindowState.Normal)
206 ShowWindow(handle, SW_RESTORE);
207 else if(s == WindowState.Minimized)
208 ShowWindow(handle, SW_MINIMIZE);
209 else if(s == WindowState.Maximized)
210 ShowWindow(handle, SW_MAXIMIZE);
211 }
212 void backend_activate() {
213 SetForegroundWindow(_handle);
196 } 214 }
197 void backend_borderStyle(WindowBorderStyle border) { 215 void backend_borderStyle(WindowBorderStyle border) {
198 backend_updateWindowStyles(); 216 backend_updateWindowStyles();
199 } 217 }
200 void backend_setCurrentCursor(Cursor cur) { 218 void backend_setCurrentCursor(Cursor cur) {
655 c._location = Point(rect.left, rect.top); 673 c._location = Point(rect.left, rect.top);
656 scope args = new EventArgs(); 674 scope args = new EventArgs();
657 c.moved(args); 675 c.moved(args);
658 return 0; 676 return 0;
659 case WM_SIZE: 677 case WM_SIZE:
660 if(wParam == SIZE_MINIMIZED) 678 if(wParam == SIZE_RESTORED)
661 break; 679 c._state = WindowState.Normal;
680 else if(wParam == SIZE_MINIMIZED) {
681 c._state = WindowState.Minimized;
682 break; // don't update size if minimized (would be wierd size)
683 } else if(wParam == SIZE_MAXIMIZED)
684 c._state = WindowState.Maximized;
685
662 RECT rect; 686 RECT rect;
663 GetWindowRect(hwnd, &rect); 687 GetWindowRect(hwnd, &rect);
664 c._size = Size(rect.right-rect.left, rect.bottom-rect.top); 688 c._size = Size(rect.right-rect.left, rect.bottom-rect.top);
665 c.backend_nativeToBorderSize(); 689 c.backend_nativeToBorderSize();
666 scope args = new EventArgs(); 690 scope args = new EventArgs();
667 c.resized(args); 691 c.resized(args);
692 return 0;
693 case WM_ACTIVATE:
694 scope e = new EventArgs;
695 if(LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) {
696 c._active = true;
697 c.activated(e);
698 } else if(LOWORD(wParam) == WA_INACTIVE) {
699 c._active = false;
700 c.deactivated(e);
701 }
668 return 0; 702 return 0;
669 case WM_MOUSEMOVE: 703 case WM_MOUSEMOVE:
670 if(!trackingMouseLeave) { 704 if(!trackingMouseLeave) {
671 TRACKMOUSEEVENT tme; 705 TRACKMOUSEEVENT tme;
672 tme.cbSize = TRACKMOUSEEVENT.sizeof; 706 tme.cbSize = TRACKMOUSEEVENT.sizeof;