Class A will only know what you tell it. Class B can call the correct method of Class A for a given button, or pass the information about which button was clicked to Class A.
More information about your classes, and perhaps some code, would be helpful.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…