1589 |
1589 |
1590 if (bring_to_front) BringWindowToFront(w); |
1590 if (bring_to_front) BringWindowToFront(w); |
1591 return true; |
1591 return true; |
1592 } |
1592 } |
1593 |
1593 |
1594 /** Send a message from one window to another. The receiving window is found by |
|
1595 * @param w Window pointer pointing to the other window |
|
1596 * @param msg Specifies the message to be sent |
|
1597 * @param wparam Specifies additional message-specific information |
|
1598 * @param lparam Specifies additional message-specific information |
|
1599 */ |
|
1600 static void SendWindowMessageW(Window *w, uint msg, uint wparam, uint lparam) |
|
1601 { |
|
1602 WindowEvent e; |
|
1603 |
|
1604 e.event = WE_MESSAGE; |
|
1605 e.we.message.msg = msg; |
|
1606 e.we.message.wparam = wparam; |
|
1607 e.we.message.lparam = lparam; |
|
1608 |
|
1609 w->HandleWindowEvent(&e); |
|
1610 } |
|
1611 |
|
1612 /** Send a message from one window to another. The receiving window is found by |
|
1613 * @param wnd_class see WindowClass class AND |
|
1614 * @param wnd_num see WindowNumber number, mostly 0 |
|
1615 * @param msg Specifies the message to be sent |
|
1616 * @param wparam Specifies additional message-specific information |
|
1617 * @param lparam Specifies additional message-specific information |
|
1618 */ |
|
1619 void SendWindowMessage(WindowClass wnd_class, WindowNumber wnd_num, int msg, int wparam, int lparam) |
|
1620 { |
|
1621 Window *w = FindWindowById(wnd_class, wnd_num); |
|
1622 if (w != NULL) SendWindowMessageW(w, msg, wparam, lparam); |
|
1623 } |
|
1624 |
|
1625 /** Send a message from one window to another. The message will be sent |
|
1626 * to ALL windows of the windowclass specified in the first parameter |
|
1627 * @param wnd_class see WindowClass class |
|
1628 * @param msg Specifies the message to be sent |
|
1629 * @param wparam Specifies additional message-specific information |
|
1630 * @param lparam Specifies additional message-specific information |
|
1631 */ |
|
1632 void SendWindowMessageClass(WindowClass wnd_class, int msg, int wparam, int lparam) |
|
1633 { |
|
1634 Window* const *wz; |
|
1635 |
|
1636 FOR_ALL_WINDOWS(wz) { |
|
1637 if ((*wz)->window_class == wnd_class) SendWindowMessageW(*wz, msg, wparam, lparam); |
|
1638 } |
|
1639 } |
|
1640 |
|
1641 /** Handle keyboard input. |
1594 /** Handle keyboard input. |
1642 * @param key Lower 8 bits contain the ASCII character, the higher 16 bits the keycode |
1595 * @param key Lower 8 bits contain the ASCII character, the higher 16 bits the keycode |
1643 */ |
1596 */ |
1644 void HandleKeypress(uint32 key) |
1597 void HandleKeypress(uint32 key) |
1645 { |
1598 { |
2030 |
1983 |
2031 /** |
1984 /** |
2032 * Mark window data as invalid (in need of re-computing) |
1985 * Mark window data as invalid (in need of re-computing) |
2033 * @param w Window with invalid data |
1986 * @param w Window with invalid data |
2034 */ |
1987 */ |
2035 void InvalidateThisWindowData(Window *w) |
1988 void InvalidateThisWindowData(Window *w, int data) |
2036 { |
1989 { |
2037 CallWindowEventNP(w, WE_INVALIDATE_DATA); |
1990 WindowEvent e; |
|
1991 |
|
1992 e.event = WE_INVALIDATE_DATA; |
|
1993 e.we.invalidate.data = data; |
|
1994 |
|
1995 w->HandleWindowEvent(&e); |
2038 w->SetDirty(); |
1996 w->SetDirty(); |
2039 } |
1997 } |
2040 |
1998 |
2041 /** |
1999 /** |
2042 * Mark window data of the window of a given class and specific window number as invalid (in need of re-computing) |
2000 * Mark window data of the window of a given class and specific window number as invalid (in need of re-computing) |
2043 * @param cls Window class |
2001 * @param cls Window class |
2044 * @param number Window number within the class |
2002 * @param number Window number within the class |
2045 */ |
2003 */ |
2046 void InvalidateWindowData(WindowClass cls, WindowNumber number) |
2004 void InvalidateWindowData(WindowClass cls, WindowNumber number, int data) |
2047 { |
2005 { |
2048 Window* const *wz; |
2006 Window* const *wz; |
2049 |
2007 |
2050 FOR_ALL_WINDOWS(wz) { |
2008 FOR_ALL_WINDOWS(wz) { |
2051 Window *w = *wz; |
2009 Window *w = *wz; |
2052 if (w->window_class == cls && w->window_number == number) InvalidateThisWindowData(w); |
2010 if (w->window_class == cls && w->window_number == number) InvalidateThisWindowData(w, data); |
2053 } |
2011 } |
2054 } |
2012 } |
2055 |
2013 |
2056 /** |
2014 /** |
2057 * Mark window data of all windows of a given class as invalid (in need of re-computing) |
2015 * Mark window data of all windows of a given class as invalid (in need of re-computing) |
2058 * @param cls Window class |
2016 * @param cls Window class |
2059 */ |
2017 */ |
2060 void InvalidateWindowClassesData(WindowClass cls) |
2018 void InvalidateWindowClassesData(WindowClass cls, int data) |
2061 { |
2019 { |
2062 Window* const *wz; |
2020 Window* const *wz; |
2063 |
2021 |
2064 FOR_ALL_WINDOWS(wz) { |
2022 FOR_ALL_WINDOWS(wz) { |
2065 if ((*wz)->window_class == cls) InvalidateThisWindowData(*wz); |
2023 if ((*wz)->window_class == cls) InvalidateThisWindowData(*wz, data); |
2066 } |
2024 } |
2067 } |
2025 } |
2068 |
2026 |
2069 /** |
2027 /** |
2070 * Dispatch WE_TICK event over all windows |
2028 * Dispatch WE_TICK event over all windows |