Example #1
0
/* -------------- MB_SELECTION Message -------------- */
static void SelectionMsg(WINDOW wnd, PARAM p1, PARAM p2)
{
    int wd, mx, my;
    MENU *mnu;

	if (!p2)	{
	    ActiveMenuBar->ActiveSelection = -1;
    	SendMessage(wnd, PAINT, 0, 0);
	}
    Selecting = TRUE;
    mnu = ActiveMenu+(int)p1;
    if (mnu->PrepMenu != NULL)
        (*(mnu->PrepMenu))(GetDocFocus(), mnu);
    wd = MenuWidth(mnu->Selections);
    if (p2)    {
		int brd = GetRight(wnd);
        mx = GetLeft(mwnd) + WindowWidth(mwnd) - 1;
		if (mx + wd > brd)
			mx = brd - wd;
        my = GetTop(mwnd) + mwnd->selection;
    }
    else    {
        int offset = menu[(int)p1].x1 - 4 * (int)p1;
        if (mwnd != NULL)
            SendMessage(mwnd, CLOSE_WINDOW, 0, 0);
        ActiveMenuBar->ActiveSelection = (int) p1;
        if (offset > WindowWidth(wnd)-wd)
            offset = WindowWidth(wnd)-wd;
        mx = GetLeft(wnd)+offset;
        my = GetTop(wnd)+1;
    }
    mwnd = CreateWindow(POPDOWNMENU, NULL,
                mx, my,
                MenuHeight(mnu->Selections),
                wd,
                NULL,
                wnd,
                NULL,
                SHADOW);
	if (!p2)	{
	    Selecting = FALSE;
    	SendMessage(wnd, PAINT, 0, 0);
	    Selecting = TRUE;
	}
    if (mnu->Selections[0].SelectionTitle != NULL)    {
        SendMessage(mwnd, BUILD_SELECTIONS, (PARAM) mnu, 0);
		SendMessage(mwnd, SETFOCUS, TRUE, 0);
		SendMessage(mwnd, SHOW_WINDOW, 0, 0);
    }
    Selecting = FALSE;
}
Example #2
0
File: spinbutt.c Project: FDOS/edit
int SpinButtonProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
{
    int rtn;
    CTLWINDOW *ct = GetControl(wnd);
    if (ct != NULL)    {
        switch (msg)    {
            case CREATE_WINDOW:
                wnd->wd -= 2;
                wnd->rc.rt -= 2;
                break;
            case SETFOCUS:
                rtn = BaseWndProc(SPINBUTTON, wnd, msg, p1, p2);
                if (!(int)p1)
                    SendMessage(NULL, HIDE_CURSOR, 0, 0);
                SetFocusCursor(wnd);
                return rtn;
            case PAINT:
                foreground = WndBackground(wnd);
                background = WndForeground(wnd);
                wputch(wnd,UPSCROLLBOX,WindowWidth(wnd), 0);
                wputch(wnd,DOWNSCROLLBOX,WindowWidth(wnd)+1,0);
                SetFocusCursor(wnd);
                break;
            case LEFT_BUTTON:
                if (p1 == GetRight(wnd) + 1)
                    SendMessage(wnd, KEYBOARD, UP, 0);
                else if (p1 == GetRight(wnd) + 2)
                    SendMessage(wnd, KEYBOARD, DN, 0);
                if (wnd != inFocus)
                    SendMessage(wnd, SETFOCUS, TRUE, 0);
                return TRUE;
            case LB_SETSELECTION:
                rtn = BaseWndProc(SPINBUTTON, wnd, msg, p1, p2);
                wnd->wtop = (int) p1;
                SendMessage(wnd, PAINT, 0, 0);
                return rtn;
            default:
                break;
        }
    }
    return BaseWndProc(SPINBUTTON, wnd, msg, p1, p2);
}
Example #3
0
/* ------------- reset the MENUBAR -------------- */
static void reset_menubar(WINDOW wnd)
{
    ATTRCHR * cp = GetText(wnd) = DFrealloc(GetText(wnd), (SCREENWIDTH+5) * sizeof(ATTRCHR));
	int attr = clr(WndForeground(wnd), WndBackground(wnd));
	int i;
	for (i=0; i < SCREENWIDTH +5; i++)
	{
		cp->ch = ' ';
		cp->attrib = attr;
		cp++;
	}
    (GetText(wnd)+WindowWidth(wnd))->ch = '\0';
}
Example #4
0
/* ------------- reset the MENUBAR -------------- */
static void reset_menubar(WINDOW wnd)
{
    GetText(wnd) = DFrealloc(GetText(wnd), SCREENWIDTH+5);
    memset(GetText(wnd), ' ', SCREENWIDTH);
    *(GetText(wnd)+WindowWidth(wnd)) = '\0';
}
Example #5
0
	void FlagWatcher::CreateChildren(HWND hWnd){
		m_flagWatcherDlg.Create(hWnd);
		SetSize(m_flagWatcherDlg.WindowWidth()+(WindowWidth()-ClientWidth()), 
				m_flagWatcherDlg.WindowHeight()+(WindowHeight()-ClientHeight()));
	}
Example #6
0
	int SetWindowXY(HWND hWnd, int x, int y){
		return MoveWindow(hWnd, x, y, WindowWidth(hWnd), WindowHeight(hWnd), true);
	}
Example #7
0
	int WindowWidth(const Window& w){
		return WindowWidth(w.GetHWND());
	}