Prepared functional hooks in PostWindow

This commit is contained in:
Snowyfox 2021-07-31 07:36:56 -04:00
parent 13132c8fa9
commit 1704a22847

View File

@ -83,6 +83,36 @@ implements ActionListener {
repliesDisplay.setReplies(replies);
}
public void
openAuthorProfile()
{
}
public void
favourite()
{
}
public void
boost()
{
}
public void
reply()
{
}
public void
openMedia()
{
}
// - -%- -
public void
@ -119,7 +149,7 @@ implements ActionListener {
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setLocationByPlatform(true);
postDisplay = new PostComponent();
postDisplay = new PostComponent(this);
repliesDisplay = new RepliesComponent();
@ -152,7 +182,11 @@ implements ActionListener {
class
PostComponent extends JPanel {
PostComponent extends JPanel
implements ActionListener {
private PostWindow
primaire;
private String
author, time, text;
@ -163,7 +197,7 @@ PostComponent extends JPanel {
profile,
favouriteBoost,
replyMisc,
prevNext,
nextPrev,
media;
// ---%-@-%---
@ -191,6 +225,41 @@ PostComponent extends JPanel {
// - -%- -
public void
actionPerformed(ActionEvent eA)
{
Object src = eA.getSource();
/*
* Umm, ActionEvent is the wrong thing to listen for here.
* We want mouse presses. The custom button would publish
* events that mention which button it was.
*
* Default JButton ignores RMB.
*/
if (src == profile)
{
primaire.openAuthorProfile();
}
else if (src == favouriteBoost)
{
// Fancy!!
}
else if (src == replyMisc)
{
}
else if (src == nextPrev)
{
}
else if (src == media)
{
primaire.openMedia();
}
}
protected void
paintComponent(Graphics g)
{
@ -230,32 +299,39 @@ PostComponent extends JPanel {
// ---%-@-%---
PostComponent()
PostComponent(PostWindow primaire)
{
this.primaire = primaire;
author = time = text = "";
profile = new JButton("P");
profile.setSize(40, 40);
profile.addActionListener(this);
favouriteBoost = new JButton("☆/B");
favouriteBoost.setSize(40, 40);
favouriteBoost.addActionListener(this);
// We have to overload the buttons to accept RMBs.
// Which perform the secondary functionality.
replyMisc = new JButton("R");
replyMisc.setSize(40, 40);
replyMisc.addActionListener(this);
prevNext = new JButton("↓/↑");
prevNext.setSize(40, 40);
nextPrev = new JButton("↓/↑");
nextPrev.setSize(40, 40);
nextPrev.addActionListener(this);
media = new JButton("M");
media.setSize(40, 40);
media.addActionListener(this);
setLayout(null);
profile.setLocation(8, 8); add(profile);
favouriteBoost.setLocation(8, 8+48); add(favouriteBoost);
replyMisc.setLocation(8, 8+48+48); add(replyMisc);
prevNext.setLocation(8, 8+48+48+48); add(prevNext);
nextPrev.setLocation(8, 8+48+48+48); add(nextPrev);
media.setLocation(8, 8+48+48+48+48); add(media);
/*