void CWndNeuz::SetSizeMax() { if( m_bFullMax ) { if( m_nWinSize == WSIZE_WINDOW ) { m_rectBackup = GetWindowRect(TRUE); CRect rect; CWndBase* pWndFull = m_pWndRoot->FindFullWnd(); if(pWndFull) rect = pWndFull->GetWindowRect(TRUE); //rect = pWndFull->GetLayoutRect( TRUE ); else if(IsWndStyle(WBS_CHILD)) rect = m_pParentWnd->GetClientRect(TRUE); else { //rect = m_pWndRoot->GetWindowRect(); rect = m_pWndRoot->GetLayoutRect(); //rect.left = rect.Width() - 200; } m_wndTitleBar.GetDlgItem( WTBID_MAX )->SetTitle( _T( "#" ) ); m_bFullWnd = TRUE; m_nWinSize = WSIZE_MAX; SetWndRect(rect); } } else if( m_nWinSize == WSIZE_WINDOW ) { m_rectBackup = GetWindowRect(TRUE); CRect rect; CWndBase* pWndFull = m_pWndRoot->FindFullWnd(); if(pWndFull) rect = pWndFull->GetWindowRect(TRUE); else if(IsWndStyle(WBS_CHILD)) rect = m_pParentWnd->GetClientRect(TRUE); else { //rect = m_pWndRoot->GetWindowRect(); rect = m_pWndRoot->GetLayoutRect(); rect.left = rect.Width() - 200; } SetWndRect(rect); m_wndTitleBar.GetDlgItem( WTBID_MAX )->SetTitle( _T( "#" ) ); AddWndStyle(WBS_MANAGER); m_bFullWnd = TRUE; m_nWinSize = 2; } }
void CUILevelMap::Update() { CUIGlobalMap* w = MapWnd()->GlobalMap(); Frect rect; Fvector2 tmp; tmp = w->ConvertRealToLocal(GlobalRect().lt); rect.lt = tmp; tmp = w->ConvertRealToLocal(GlobalRect().rb); rect.rb = tmp; SetWndRect (rect); inherited::Update (); if(m_bCursorOverWindow){ VERIFY(m_dwFocusReceiveTime>=0); if( Device.dwTimeGlobal>(m_dwFocusReceiveTime+500) ){ if(fsimilar(MapWnd()->GlobalMap()->GetCurrentZoom(), MapWnd()->GlobalMap()->GetMinZoom(),EPS_L )) MapWnd()->ShowHint(this, *MapName()); else MapWnd()->HideHint(this); } } }
CUIWindow::CUIWindow() { //. m_dbg_flag.zero (); m_pFont = NULL; m_pParentWnd = NULL; m_pMouseCapturer = NULL; m_pOrignMouseCapturer = NULL; m_pMessageTarget = NULL; m_pKeyboardCapturer = NULL; SetWndRect (0,0,0,0); m_bAutoDelete = false; Show (true); Enable (true); m_bCursorOverWindow = false; m_bClickable = false; m_bPP = false; m_dwFocusReceiveTime = 0; #ifdef LOG_ALL_WNDS ListWndCount++; m_dbg_id = ListWndCount; dbg_list_wnds.push_back(DBGList()); dbg_list_wnds.back().num = m_dbg_id; dbg_list_wnds.back().closed = false; #endif }
void iPopupMenu::ShowPopupMenu(const iPoint &pos, iAlignment algn) { if (m_Items.GetSize() == 0) return; iRect nrect(0,0,0,0); for (uint32 xx=0; xx< m_Items.GetSize(); ++xx) { m_Items[xx]->m_Button->SetElementPos(iPoint(nrect.w,0)); nrect.w += m_Items[xx]->m_Button->GetElementRect().w; nrect.h = iMAX(nrect.h,m_Items[xx]->m_Button->GetElementRect().h); } nrect.y = pos.y-nrect.h; nrect.x = pos.x - nrect.w/2; iSize ssize = iWindowManager::GetScreenSize(); if (nrect.x<0) nrect.x=0; else if (nrect.x2() > (sint32)ssize.w) nrect.x = ssize.w - nrect.w; if (nrect.y<0) nrect.y=0; else if (nrect.y2() > (sint32)ssize.h) nrect.y = ssize.h - nrect.h; SetWndRect(nrect); ShowWindow(SW_SHOW); SetActiveWindow(); }
void CUICustomMap::FitToHeight (float height) { float k = m_BoundRect.width()/m_BoundRect.height(); float h = height; float w = k*height; SetWndRect (0.0f,0.0f,w,h); }
void CUICustomMap::FitToWidth (float width) { float k = m_BoundRect.width()/m_BoundRect.height(); float w = width; float h = width/k; SetWndRect (0.0f,0.0f,w,h); }
void Ctrl::WndSetPos0(const Rect& rect) { GuiLock __; TopWindow *w = dynamic_cast<TopWindow *>(this); if(w) w->SyncFrameRect(rect); invalid.Add(GetRect()); SetWndRect(rect); invalid.Add(rect); }
void CUIDragItem::Init(const ui_shader& sh, const Frect& rect, const Frect& text_rect) { SetWndRect (rect); m_static.SetShader (sh); m_static.SetTextureRect (text_rect); m_static.SetWndPos (Fvector2().set(0.0f,0.0f)); m_static.SetWndSize (GetWndSize()); m_static.TextureOn (); m_static.SetTextureColor (color_rgba(255,255,255,170)); m_static.SetStretchTexture (true); m_pos_offset.sub (rect.lt, GetUICursor().GetCursorPosition()); }
void CWndNeuz::SetSizeWnd() { if( m_bFullMax ) { if( m_nWinSize != WSIZE_WINDOW ) { m_nWinSize = WSIZE_WINDOW; SetWndRect(m_rectBackup); m_wndTitleBar.GetDlgItem( WTBID_MAX )->SetTitle( _T( "#" ) ); } } else { if( m_nWinSize != WSIZE_WINDOW ) { m_nWinSize = WSIZE_WINDOW; SetWndRect(m_rectBackup); m_wndTitleBar.GetDlgItem( WTBID_MAX )->SetTitle( _T( "#" ) ); DelWndStyle(WBS_MANAGER); } } }
void CUIDragItem::Init(const ref_shader& sh, const Frect& rect, const Frect& text_rect) { SetWndRect (rect); m_static.SetShader (sh); m_static.SetOriginalRect (text_rect); m_static.SetWndPos (0.0f,0.0f); m_static.SetWndSize (GetWndSize()); m_static.TextureAvailable (true); m_static.TextureOn (); m_static.SetColor (color_rgba(255,255,255,170)); m_static.SetStretchTexture (true); m_pos_offset.sub (rect.lt, GetUICursor()->GetCursorPosition()); }
void CWndNeuz::OnSize(UINT nType, int cx, int cy) { if(IsWndRoot()) return; if( m_bTile ) //m_strTexture.IsEmpty() == FALSE ) { CRect rectWnd = GetWndRect(); CSize size2( rectWnd.Width(), rectWnd.Height() ); CSize sizeDiv = size2; sizeDiv.cx %= 16; sizeDiv.cy %= 16; size2.cx /= 16; size2.cx *= 16; size2.cy /= 16; size2.cy *= 16; if( sizeDiv.cx ) size2.cx += 16; if( sizeDiv.cy ) size2.cy += 16; rectWnd.bottom = rectWnd.top + size2.cy; rectWnd.right = rectWnd.left + size2.cx; SetWndRect( rectWnd, FALSE ); } AdjustWndBase(); m_wndTitleBar.Replace(); CWndBase::OnSize( nType, cx, cy ); // if( rectOld.Width() != m_rectClient.Width() || rectOld.Height() != m_rectClient.Height() ) // 차일드 윈도우들의 사이즈를 조절 /* for(int i = 0; i < m_wndArray.GetSize(); i++) { CWndBase* pWnd = (CWndBase*)m_wndArray.GetAt(i); if(pWnd->IsWndStyle(WBS_DOCKED))// && pWnd->IsWndStyle(WBS_CHILD)) { CRect rect = pWnd->GetWindowRect(TRUE); rect.SetRect(0,0,cx,cy); pWnd->SetWndRect(rect); } } */ /* if(IsWndStyle(WBS_DOCKED))// && IsWndStyle(WBS_CHILD)) { m_wndTitleBar.m_wndMinimize.SetVisible(FALSE); m_wndTitleBar.m_wndMaximize.SetVisible(FALSE); } */ }
void CWndCommand::OnInitialUpdate() { CWndListBox::OnInitialUpdate(); int nCount = 0, nIndex, nNum = 0; while( m_textCmdFunc[ nCount ].m_pFunc ) { TextCmdFunc* pTextCmdFunc = &m_textCmdFunc[nCount]; if( ::GetLanguage() != LANG_KOR ) // 한국이외에서는 사용제한 { if( memcmp( pTextCmdFunc->m_pCommand, "open", 4 ) == 0 ) break; } if( pTextCmdFunc->m_dwAuthorization <= g_pPlayer->m_dwAuthorization ) { if( ::GetLanguage() != LANG_KOR ) g_Option.m_nChatCommand = 2; switch( g_Option.m_nChatCommand ) { default: case 0: nIndex = AddString( &(*pTextCmdFunc->m_pKrCommand) ); break; case 1: nIndex = AddString( &(*pTextCmdFunc->m_pKrAbbreviation) ); break; case 2: nIndex = AddString( &(*pTextCmdFunc->m_pCommand) ); break; case 3: nIndex = AddString( &(*pTextCmdFunc->m_pAbbreviation) ); break; } SetItemDataPtr( nIndex, pTextCmdFunc ); nNum++; } nCount++; } SortListBox(); if( nNum > 20 ) nNum = 20; if( nNum < 5 ) nNum = 5; SetWndRect( CRect( 0, 0, 160, nNum * ( GetFontHeight() + 3 ) + 8 ) ); m_pWndEdit->SetFocus(); }
bool Ctrl::SweepConfigure(bool wait) { Ptr<Ctrl> this_ = this; bool r = false; FetchEvents(wait); for(int i = 0; i < Events.GetCount() && this_; i++) { Event& e = Events[i]; if(e.type == GDK_CONFIGURE && this_ && top->id == e.windowid) { Rect rect = e.value; LLOG("SweepConfigure " << rect); if(GetRect() != rect) SetWndRect(rect); r = true; e.type = EVENT_NONE; } } return r; }
//----------------------------------------------------------------------------- void CWndHelperWebBox::OnInitialUpdate( void ) { CWndNeuz::OnInitialUpdate(); SetTitle( prj.GetText( TID_GAME_HELPER_WEB_BOX_ICON_TITLE ) ); if( g_Option.m_nResWidth >= 1024 && g_Option.m_nResHeight >= 768 ) { CRect rectHelperWebBox = GetWndRect(); rectHelperWebBox.right = 1024; rectHelperWebBox.bottom = 768; SetWndRect( rectHelperWebBox ); } DelWndStyle( WBS_MOVE ); AddWndStyle( WBS_TOPMOST ); CHelperWebBox::GetInstance()->Initialize(); MoveParentCenter(); }
void CWndChatFilter::OnInitialUpdate() { CWndNeuz::OnInitialUpdate(); // 여기에 코딩하세요 SetButtonStatus(); #if __VER >= 8 //__Y_CHAT_SYSTEM_8 CRect rect = GetClientRect(); SetWndRect( CRect(0, 0, rect.right, rect.bottom - 130)); CWndGroupBox* pWndGroup = (CWndGroupBox*)GetDlgItem( WIDC_GROUPBOX2 ); if( pWndGroup ) pWndGroup->SetVisible(FALSE); #endif //__Y_CHAT_SYSTEM_8 // 윈도를 중앙으로 옮기는 부분. CRect rectRoot = m_pWndRoot->GetLayoutRect(); CRect rectWindow = GetWindowRect(); CPoint point( rectRoot.right - rectWindow.Width(), 110 ); Move( point ); MoveParentCenter(); }
void CUIWindow::Init(Frect* pRect) { SetWndRect (*pRect); }
void Ctrl::EventProc(XWindow& w, XEvent *event) { GuiLock __; eventid++; Ptr<Ctrl> _this = this; bool pressed = false; int count = 1; switch(event->type) { case NoExpose: LLOG("NoExpose serial " << event->xnoexpose.serial); break; case GraphicsExpose: LLOG("GraphicsExpose serial " << event->xgraphicsexpose.serial); case Expose: { XExposeEvent& e = event->xexpose; w.exposed = true; LLOG("Expose " << RectC(e.x, e.y, e.width, e.height)); Invalidate(w, RectC(e.x, e.y, e.width, e.height)); } return; case ConfigureNotify: { XConfigureEvent& e = event->xconfigure; int x, y; Window dummy; // 01/12/2007 - mdelfede // added support for windowed controls // if(top) // XTranslateCoordinates(Xdisplay, top->window, Xroot, 0, 0, &x, &y, &dummy); if(top) { Window DestW = (parent ? GetParentWindow() : Xroot); XTranslateCoordinates(Xdisplay, top->window, DestW, 0, 0, &x, &y, &dummy); Rect rect = RectC(x, y, e.width, e.height); LLOG("CongigureNotify " << rect); if(GetRect() != rect) SetWndRect(rect); // Synchronizes native windows (NOT the main one) } SyncNativeWindows(); // 01/12/2007 - END } return; default: if(!IsEnabled()) return; } LTIMING("XUserInput"); switch(event->type) { case FocusIn: if(w.xic) XSetICFocus(w.xic); break; case FocusOut: if(w.xic) XUnsetICFocus(w.xic); break; case KeyPress: pressed = true; LLOG("event type:" << event->type << " state:" << event->xkey.state << "keycode:" << event->xkey.keycode); for(;;) { XEvent ev1[1], ev2[1]; bool hasev2 = false; if(!IsWaitingEvent()) break; do XNextEvent(Xdisplay, ev1); while(ev1->type == NoExpose && IsWaitingEvent()); LLOG("ev1 type:" << ev1->type << " state:" << ev1->xkey.state << "keycode:" << ev1->xkey.keycode); if(ev1->type == KeyPress) *ev2 = *ev1; else { if(ev1->type != KeyRelease || ev1->xkey.state != event->xkey.state || ev1->xkey.keycode != event->xkey.keycode || !IsWaitingEvent()) { XPutBackEvent(Xdisplay, ev1); break; } do XNextEvent(Xdisplay, ev2); while(ev2->type == NoExpose && IsWaitingEvent()); LLOG("ev2 type:" << ev2->type << " state:" << ev2->xkey.state << "keycode:" << ev2->xkey.keycode); hasev2 = true; } if(ev2->type != KeyPress || ev2->xkey.state != event->xkey.state || ev2->xkey.keycode != event->xkey.keycode) { if(hasev2) XPutBackEvent(Xdisplay, ev2); XPutBackEvent(Xdisplay, ev1); break; } else { XFilterEvent(ev1, None); if(hasev2) XFilterEvent(ev2, None); } count++; } case KeyRelease: { mousePos = Point(event->xkey.x_root, event->xkey.y_root); char buff[128]; Xeventtime = event->xkey.time; LLOG("Key Xeventtime: " << Xeventtime << " count:" << count); KeySym keysym; int chr = 0; WString wtext; if(pressed && w.xic) { Status status; int len = Xutf8LookupString(w.xic, &event->xkey, buff, sizeof(buff), &keysym, &status); buff[len] = 0; if(status == XLookupChars || status == XLookupBoth) { chr = FromUtf8(buff, len)[0]; if(status == XLookupChars) wtext = FromUtf8(buff, len); } else if(status != XLookupKeySym && status != XLookupBoth) keysym = 0; } else { int len = XLookupString(&event->xkey, buff, sizeof(buff), &keysym, NULL); buff[len] = 0; chr = FromUtf8(buff, len)[0]; if(len > 1) wtext = FromUtf8(buff, len); } if(keysym == XK_Control_L || keysym == XK_Control_R) { keysym = XK_Control_L; if(pressed) sKbdState |= ControlMask; else sKbdState &= ~ControlMask; } if(keysym == XK_Shift_L || keysym == XK_Shift_R) { keysym = XK_Shift_L; if(pressed) sKbdState |= ShiftMask; else sKbdState &= ~ShiftMask; } if(keysym == XK_Meta_L || keysym == XK_Meta_R || keysym == XK_Alt_L || keysym == XK_Alt_R || keysym == XK_Super_L || keysym == XK_Super_R || keysym == XK_Hyper_L || keysym == XK_Hyper_R || keysym == XK_ISO_Prev_Group) { keysym = XK_Meta_L; if(pressed) sKbdState |= Mod1Mask; else sKbdState &= ~Mod1Mask; } LLOG("KeySym:" << FormatIntHex(keysym) << " " << (char)keysym << " " << count); dword up = pressed ? 0 : K_KEYUP; static struct { KeySym keysym; dword key; } tab[] = { { XK_ISO_Left_Tab, K_TAB|K_SHIFT }, { XK_BackSpace, K_BACKSPACE }, { XK_Tab, K_TAB }, { XK_Return, K_ENTER }, { XK_KP_Enter, K_ENTER }, { XK_Escape, K_ESCAPE }, { XK_space, K_SPACE }, { XK_KP_Space, K_SPACE }, { XK_KP_Tab, K_TAB }, { XK_KP_Enter, K_ENTER }, { XK_KP_F1, K_F1 }, { XK_KP_F2, K_F2 }, { XK_KP_F3, K_F3 }, { XK_KP_F4, K_F4 }, { XK_KP_Home, K_HOME }, { XK_KP_Left, K_LEFT }, { XK_KP_Up, K_UP }, { XK_KP_Right, K_RIGHT }, { XK_KP_Down, K_DOWN }, { XK_KP_Page_Up, K_PAGEUP }, { XK_KP_Page_Down, K_PAGEDOWN }, { XK_KP_End, K_END }, { XK_KP_Begin, K_HOME }, { XK_KP_Insert, K_INSERT }, { XK_KP_Delete, K_DELETE }, }; for(int i = 0; i < __countof(tab); i++) if(tab[i].keysym == keysym) { DispatchKey(KEYtoK(tab[i].key)|up, count); return; } if(GetShift() && chr == 0) { static dword k[] = { 41, 33, 64, 35, 36, 37, 94, 38, 42, 40 }; for(int i = 0; i < 10; i++) if(keysym == k[i]) { DispatchKey(KEYtoK(i + K_0)|up, count); return; } } if(keysym >= 48 && keysym <= 57 && chr == 0) { DispatchKey(KEYtoK(keysym - 48 + K_0)|up, count); return; } if(chr >= 1 && chr < 32) { DispatchKey(KEYtoK(chr - 1 + K_CTRL_A)|up, count); return; } if(keysym >= 0xff80 && keysym <= 0xffb9 && chr) { DispatchKey(KEYtoK(chr)|up, count); return; } if(keysym >= 0xff00 && chr < 128 || (GetCtrl() || GetAlt()) && keysym >= 0x20 && keysym < 0x7f) { if(keysym >= 'a' && keysym <= 'z') keysym = keysym - 'a' + 'A'; DispatchKey(KEYtoK(keysym|K_DELTA)|up, count); return; } if((chr == 32 || chr == 9 || chr == 13) && !pressed) DispatchKey(chr|K_KEYUP, count); if(chr && pressed) { DispatchKey(chr, count); for(int ii = 1; ii < wtext.GetLength(); ii++) DispatchKey(wtext[ii], count); } } break; case ButtonPress: { if(!HasWndFocus() && !popup) SetWndFocus(); ClickActivateWnd(); mousePos = Point(event->xbutton.x_root, event->xbutton.y_root); ReleaseGrab(); XButtonEvent& e = event->xbutton; sModState = e.state; Xeventtime = e.time; if(ignoreclick) break; Point p = Point(e.x, e.y); dword action = DOWN; if((dword)e.time - (dword)Xbuttontime < 800) { action = DOUBLE; Xbuttontime = Xeventtime - 0x80000000; } else { Xbuttontime = e.time; Xbuttonpos = mousePos; } switch(e.button) { case Button1: sModState |= Button1Mask; DispatchMouse(LEFT|action, p, 0); break; case Button2: sModState |= Button2Mask; if(Xbuttons < 3) DispatchMouse(RIGHT|action, p, 0); else DispatchMouse(MIDDLE|action, p, 0); break; case Button3: sModState |= Button3Mask; DispatchMouse(RIGHT|action, p, 0); break; } if(_this) PostInput(); } break; case ButtonRelease: { mousePos = Point(event->xbutton.x_root, event->xbutton.y_root); XButtonEvent& e = event->xbutton; sModState = e.state; Xeventtime = e.time; Point p = Point(e.x, e.y); switch(e.button) { case Button1: sModState &= ~Button1Mask; break; case Button2: sModState &= ~Button2Mask; break; case Button3: sModState &= ~Button3Mask; break; } if(ignoreclick) EndIgnore(); else switch(e.button) { case Button1: DispatchMouse(LEFTUP, p, 0); break; case Button2: if(Xbuttons < 3) DispatchMouse(RIGHTUP, p, 0); else DispatchMouse(MIDDLEUP, p, 0); break; case Button3: DispatchMouse(RIGHTUP, p, 0); break; case Button4: DispatchMouse(MOUSEWHEEL, p, 120); break; case Button5: DispatchMouse(MOUSEWHEEL, p, -120); break; } if(_this) PostInput(); } break; case MotionNotify: while(XCheckWindowEvent(Xdisplay, top->window, PointerMotionMask, event)); EndIgnore(); mousePos = Point(event->xmotion.x_root, event->xmotion.y_root); Xeventtime = event->xmotion.time; Point p = mousePos - Xbuttonpos; if(max(abs(p.x), abs(p.y)) > 4) Xbuttontime = Xeventtime - 0x80000000; sModState = event->xmotion.state; DispatchMouse(MOUSEMOVE, Point(event->xmotion.x, event->xmotion.y)); DoCursorShape(); break; } DropEvent(w, event); }
void CWndGuideTextMgr::_SetGuideText(GUIDE_STRUCT guide) #endif { CWndText* pWndText; CWndButton* pWndButton; pWndText = (CWndText*)GetDlgItem( WIDC_TEXT1 ); pWndText->SetWndRect( m_Rect[0] ); pWndButton= (CWndButton*)GetDlgItem( WIDC_BACK ); pWndButton->SetWndRect( m_Rect[1] ); pWndButton= (CWndButton*)GetDlgItem( WIDC_NEXT ); pWndButton->SetWndRect( m_Rect[2] ); SetWndRect( m_Rect[3] ); #if __VER >= 12 // __MOD_TUTORIAL if(bIsNext) pWndButton->SetVisible(TRUE); else pWndButton->SetVisible(FALSE); #endif m_bVisible = TRUE; m_strHelpKey = guide.m_str; pWndText = (CWndText*)GetDlgItem( WIDC_TEXT1 ); #if __VER >= 12 // __MOD_TUTORIAL pWndText->SetString(""); pWndText->m_string.AddParsingString(LPCTSTR(guide.m_str)); pWndText->ResetString(); #else pWndText->SetString( (guide.m_nkey == CWndGuideSystem::KEY) ? prj.GetHelp( m_strHelpKey ) : guide.m_str ); #endif CRect rect = pWndText->GetWndRect(); pWndText->m_string.Align( m_pFont ); int nLine = pWndText->m_string.GetLineCount(); if( nLine < 10 ) { if( nLine < 8 ) nLine = 8; CRect clientrect = GetWndRect(); int ngap = rect.Height() - (nLine * 22); clientrect.top += ngap; SetWndRect(clientrect); rect.bottom -= ngap; pWndText->SetWndRect( rect ); CRect ptRect; #ifndef __MOD_TOTURIAL pWndButton= (CWndButton*)GetDlgItem( WIDC_BACK ); ptRect = pWndButton->GetWndRect(); ptRect.OffsetRect( 0, -ngap ); pWndButton->SetWndRect(ptRect); #endif pWndButton= (CWndButton*)GetDlgItem( WIDC_NEXT ); ptRect = pWndButton->GetWndRect(); ptRect.OffsetRect( 0, -ngap ); pWndButton->SetWndRect(ptRect); pWndText->m_wndScrollBar.m_bVisible = FALSE; } else { /* pWndText = (CWndText*)GetDlgItem( WIDC_TEXT1 ); pWndText->SetWndRect( m_Rect[0] ); pWndButton= (CWndButton*)GetDlgItem( WIDC_BACK ); pWndButton->SetWndRect( m_Rect[1] ); pWndButton= (CWndButton*)GetDlgItem( WIDC_NEXT ); pWndButton->SetWndRect( m_Rect[2] ); SetWndRect( m_Rect[3] ); */ pWndText->m_wndScrollBar.m_bVisible = TRUE; pWndText->SetWndRect( rect ); } CWndGuideSystem* pWndGuide = (CWndGuideSystem*)GetWndBase( APP_GUIDE ); CRect rectGuide = pWndGuide->GetWindowRect( TRUE ); CPoint ptGuide = rectGuide.TopLeft(); CPoint ptMove; pWndGuide->m_bVisible = TRUE; CRect windowrect = GetWindowRect( TRUE ); if( ptGuide.x > windowrect.Width() ) ptMove = ptGuide - CPoint( windowrect.Width(), 0 ); else ptMove = ptGuide + CPoint( rectGuide.Width(), 0 ); ptMove.y = rectGuide.bottom; ptMove.y -= windowrect.Height(); if( ptMove.y < 0 ) ptMove.y = rectGuide.top; Move( ptMove ); }
void Ctrl::Proc() { #ifdef LOG_EVENTS String ev = "?"; Tuple2<int, const char *> *f = FindTuple(xEvent, __countof(xEvent), CurrentEvent.type); if(f) ev = f->b; LOG(rmsecs() << " PROCESS EVENT " << Upp::Name(this) << " " << ev); ProcStop tm; tm.ev = ev; #endif if(!IsOpen()) return; Ptr<Ctrl> _this = this; bool pressed = false; int kv; static int clicktime = msecs() - 100000; switch(CurrentEvent.type) { case GDK_MOTION_NOTIFY: { GtkMouseEvent(MOUSEMOVE, MOUSEMOVE, 0); break; } case GDK_BUTTON_PRESS: if(!HasWndFocus() && !popup) SetWndFocus(); ClickActivateWnd(); if(ignoremouseup) { KillRepeat(); ignoreclick = false; ignoremouseup = false; } if(!ignoreclick) GtkButtonEvent(msecs(clicktime) < 250 ? DOUBLE : DOWN); clicktime = msecs(); break; /* case GDK_2BUTTON_PRESS: if(!ignoreclick) GtkButtonEvent(DOUBLE); break; */ case GDK_BUTTON_RELEASE: if(ignoreclick) EndIgnore(); else GtkButtonEvent(UP); break; case GDK_SCROLL: { GtkMouseEvent(MOUSEWHEEL, MOUSEWHEEL, CurrentEvent.value); break; } case GDK_KEY_PRESS: pressed = true; case GDK_KEY_RELEASE: kv = CurrentEvent.value; if(kv >= 0 && kv < 65536) { LLOG("keyval " << FormatIntHex(kv) << ' ' << (char)kv); if(kv >= 'a' && kv <= 'z') kv = kv - 'a' + 'A'; static Tuple2<int, int> cv[] = { { GDKEY(BackSpace), K_BACKSPACE }, { GDKEY(Tab), K_TAB }, { GDKEY(ISO_Left_Tab), K_TAB }, { GDKEY(Return), K_ENTER }, { GDKEY(Escape), K_ESCAPE }, { GDKEY(space), K_SPACE }, { GDKEY(Control_L), K_CTRL_KEY }, { GDKEY(Control_R), K_CTRL_KEY }, { GDKEY(Shift_L), K_SHIFT_KEY }, { GDKEY(Shift_R), K_SHIFT_KEY }, { GDKEY(Alt_L), K_ALT_KEY }, { GDKEY(Alt_R), K_ALT_KEY }, { GDKEY(KP_Space), K_SPACE }, { GDKEY(KP_Tab), K_TAB }, { GDKEY(KP_Enter), K_ENTER }, { GDKEY(KP_F1), K_F1 }, { GDKEY(KP_F2), K_F2 }, { GDKEY(KP_F3), K_F3 }, { GDKEY(KP_F4), K_F4 }, { GDKEY(KP_Home), K_HOME }, { GDKEY(KP_Left), K_LEFT }, { GDKEY(KP_Up), K_UP }, { GDKEY(KP_Right), K_RIGHT }, { GDKEY(KP_Down), K_DOWN }, { GDKEY(KP_Page_Up), K_PAGEUP }, { GDKEY(KP_Page_Down), K_PAGEDOWN }, { GDKEY(KP_End), K_END }, { GDKEY(KP_Begin), K_HOME }, { GDKEY(KP_Insert), K_INSERT }, { GDKEY(KP_Delete), K_DELETE }, }; Tuple2<int, int> *x = FindTuple(cv, __countof(cv), kv); if(x) kv = x->b; else kv += K_DELTA; if(GetShift() && kv != K_SHIFT_KEY) kv |= K_SHIFT; if(GetCtrl() && kv != K_CTRL_KEY) kv |= K_CTRL; if(GetAlt() && kv != K_ALT_KEY) kv |= K_ALT; LLOG(GetKeyDesc(kv) << ", pressed: " << pressed << ", count: " << CurrentEvent.count); #ifdef GDK_WINDOWING_X11 if(pressed) for(int i = 0; i < hotkey.GetCount(); i++) { if(hotkey[i] && keyhot[i] == (dword)kv) { hotkey[i](); return; } } #endif DispatchKey(!pressed * K_KEYUP + kv, CurrentEvent.count); } break; case EVENT_TEXT: { WString h = CurrentEvent.value; for(int i = 0; i < h.GetCount(); i++) // TODO: Add compression DispatchKey(h[i], 1); break; } case GDK_DELETE: { TopWindow *w = dynamic_cast<TopWindow *>(this); if(w) { if(IsEnabled()) { IgnoreMouseUp(); w->WhenClose(); } } return; } case GDK_CONFIGURE: { Rect rect = CurrentEvent.value; if(GetRect() != rect) SetWndRect(rect); } break; default: return; } if(_this) _this->PostInput(); }
void CWndTitleBar::OnInitialUpdate() { CWndBase::OnInitialUpdate(); m_nButtonMax = 0; if(m_pParentWnd->IsWndStyle( WBS_PIN ) ) m_awndButton[ WTBID_PIN - 10000 ].Create( _T( "" ), 0, CRect( m_nButtonMax * 16, 4, m_nButtonMax * 16 + 16, 20), this, WTBID_PIN ), m_nButtonMax++; if(m_pParentWnd->IsWndStyle( WBS_VIEW ) ) m_awndButton[ WTBID_REPORT - 10000 ].Create( _T( "" ), 0, CRect( m_nButtonMax * 16, 4, m_nButtonMax * 16 + 16, 20), this, WTBID_REPORT ), m_nButtonMax++; if(m_pParentWnd->IsWndStyle( WBS_EXTENSION ) ) m_awndButton[ WTBID_EXTENSION - 10000 ].Create( _T( "" ), WBS_CHECK | WBS_PUSHLIKE , CRect( m_nButtonMax * 15, 4, m_nButtonMax * 16 + 16, 20), this, WTBID_EXTENSION ), m_nButtonMax++; if(m_pParentWnd->IsWndStyle( WBS_HELP ) ) { m_awndButton[ WTBID_HELP - 10000 ].Create( _T( "" ), 0, CRect( m_nButtonMax * 16, 4 , m_nButtonMax * 16 + 16, 20), this, WTBID_HELP ), m_nButtonMax++; //#ifdef __CLIENT m_awndButton[ WTBID_HELP - 10000 ].SetTexture( m_pApp->m_pd3dDevice, MakePath( DIR_THEME, "ButtWndHelp.tga" ), TRUE ); m_awndButton[ WTBID_HELP - 10000 ].FitTextureSize(); //#endif } if(m_pParentWnd->IsWndStyle( WBS_MINIMIZEBOX ) ) m_awndButton[ WTBID_MIN - 10000 ].Create( _T( "" ), 0, CRect( m_nButtonMax * 16, 4 , m_nButtonMax* 16 + 16, 20), this, WTBID_MIN ), m_nButtonMax++; #if __VER >= 15 // __IMPROVE_QUEST_INTERFACE m_awndButton[ WTBID_MIN - 10000 ].SetTexture( m_pApp->m_pd3dDevice, MakePath( DIR_THEME, "ButtWndMin.tga" ), TRUE ); m_awndButton[ WTBID_MIN - 10000 ].FitTextureSize(); #endif // __IMPROVE_QUEST_INTERFACE if(m_pParentWnd->IsWndStyle( WBS_MAXIMIZEBOX ) ) { m_awndButton[ WTBID_MAX - 10000 ].Create( _T( "" ), 0, CRect( m_nButtonMax * 16, 4 , m_nButtonMax* 16 + 16, 20), this, WTBID_MAX ), m_nButtonMax++; //#ifdef __CLIENT m_awndButton[ WTBID_MAX - 10000 ].SetTexture( m_pApp->m_pd3dDevice, MakePath( DIR_THEME, "ButtWndMax.tga" ), TRUE ); m_awndButton[ WTBID_MAX - 10000 ].FitTextureSize(); //#endif } if(m_pParentWnd->IsWndStyle( WBS_CAPTION ) ) { #if __VER >= 15 // __IMPROVE_QUEST_INTERFACE if( m_pParentWnd->m_bNoCloseButton == FALSE ) { m_awndButton[ WTBID_CLOSE - 10000 ].Create( _T( "" ), 0, CRect( m_nButtonMax * 16, 4 , m_nButtonMax * 16 + 16, 20), this, WTBID_CLOSE ), m_nButtonMax++; m_awndButton[ WTBID_CLOSE - 10000 ].SetTexture( m_pApp->m_pd3dDevice, MakePath( DIR_THEME, "ButtWndExit.tga" ), TRUE ); m_awndButton[ WTBID_CLOSE - 10000 ].FitTextureSize(); } #else // __IMPROVE_QUEST_INTERFACE // m_awndButton[ WTBID_CLOSE - 10000 ].Create( _T( "x" ), 0, CRect( m_nButtonMax * 16, 1 , m_nButtonMax * 16 + 16, 20), this, WTBID_CLOSE ), m_nButtonMax++; //#ifdef __CLIENT m_awndButton[ WTBID_CLOSE - 10000 ].SetTexture( m_pApp->m_pd3dDevice, MakePath( DIR_THEME, "ButtWndExit.tga" ), TRUE ); m_awndButton[ WTBID_CLOSE - 10000 ].FitTextureSize(); //#endif #endif // __IMPROVE_QUEST_INTERFACE } CRect rect( 0, 4, m_nButtonMax * 16, 20 ); SetWndRect( rect ); ///wndTitleBar.Create( WBS_CHILD | WBS_DOCKING | WBS_NOFRAME, CRect(0,0,48,20), this, 100000);// ,m_pSprPack,9); //m_wndTitleBar.SetTitle("f**k"); //m_wndTitleBar.Move(CPoint(GetWindowRect().Width()-52,3)); //SetWndRect(rect); }